Abhishek Sharma has returned to tell us about the Beauty of Nature project, discuss the Material Function workflow, and explain the nuances of his custom Auto Landscape Shader.
In case you missed it
You may find these articles interesting
Hi, my name is Abhishek Sharma. I’m currently working as a Lead Environment Artist at Ubisoft Mumbai. I did my game development course at Frameboxx Jaipur. I have 9 years of experience working in AAA game development and have contributed to projects like – Dark Souls2, Bloodborne, Hyper-scape, Kingdom Hearts III & 2.8, Tekken 7.
This project started as an exercise for creating my own custom Auto Landscape Shader. I majorly focused on creating an automatic system that helps in creating rich lush natural open-world environments. So I started with creating the Procedural Landscape shader with an auto foliage system.
Following are a few references that helped me understand the size and composition of the scene. As per references, my rough plan is to create a village/town near the lake and an iconic mountain in the background. For color and feel mostly, I have collected images from Switzerland.
Then I started creating terrain in World Machine Software. The terrain is 8*8 Kms in size.
I got the basic shape of terrain with the Basic Noise node and divided it with radial so I could make some space for the lake area. Then with the use of Perlin, I have added huge mountains into my scene. Then added some erosion feel to give more details in terrain.
Then I exported a Height Map and imported it into UE4. I used a Landscape tool with that Height Map to create this terrain and did some basic light setup to get the golden light feel.
Landscape properties and basic light setup:
The Unreal Water system helped me in creating this lake.
Then I used the WaterBody Lake tool to create the lake.
This is how it looks like after adding a lake into the scene.
After that, I adjusted its material as per requirement. I also added some VFX fog particles for far water areas.
Auto Landscape Shader
For this lush green landscape, I used 6 material layers:
- Cliff – For the mountain.
- Grass – For plains.
- Dry Grass – For blending between the mountain and plains.
- Snow – For mountain peaks
- Stones Ground – For pathways
- Water Puddle – To add water effect on the ground.
Initially, I created a few Materials Function that helped in adjusting texture within UE4.
Diffuse MF – This function gives control to edit diffuse tint, contrast, brightness, saturation.
RAM MF – This material function gives basic control to adjust Roughness, AO, and Metallic.
Normal MF – This material function helps in adjusting Normal Map strength.
The biggest issue I face when it comes to landscapes is obvious – texture tiling. Landscape textures often look good up-close near the player but at further distances, the tiling becomes very noticeable. So, to solve these issues I created a new material function that helps in adjusting tilling for near and far texture separately.
MF Distance Blend
Through this MF I have got two tilling control to adjust the texture for near and far distances. I have used Absolute World Position and Camera Position to create that mask and with it, I can adjust the distance in its material instance.
With and without Distance Blend:
This helps in fixing distance texture visibility issues. Now, I need to fix the tilling issues. To do so, I created another Material Function which helped in de-tilling the texture.
To explain it better, I have applied a gradient texture in this material.
With and without MF Cell Tiling:
This material function takes random patches of texture and rotates them and projects them on each other to remove tilling repetition. This technic only works with organic textures and is a bit expensive as well.
Then, I added the same Distance node again to fix distance texture visibility.
Adding some macro variation on the terrain texture gives the feel of realism.
Then multiply it with the final Diffuse Map.
To improve the performance of the shader I used both the Tilling method and put a Switch node to turn on/off de-tilling MF.
Using the same procedure, I have created all the other material layers except for the cliff.
Tri-Planar for Diffuse/RAM, for cliff material I have used the tri-planar technic to get texture projection from all the axis.
MF Tri-Planar Normal
This tutorial helped me to understand how tri-planar works.
Then, I added some Distance Tilling nodes to fix the far texture visibility issues.
MF Tri-Planar Distance
MF Tri-Planar Distance Normal
Now I need to compile all material layers in the final shader. Out of the 6-material layer, I have chosen three of them for the auto material paint feature as per height – Cliff (MF Cliff), Dry Grass (MF Material 01), and Grass (MF Material 02).
Then I used the World Aligned Blend node to create the alpha and then the MatLayerBlend node to blend Material Layers. Initially, I started with blending Cliff and Dry Grass. Blend Sharpness and Blend Bias help in controlling the blend intensity and area.
Just for testing, I put Red Color for Cliff, Green Color for Dry Grass, and Blue for Grass. Then, in the same way, I added a Blue material layer and blended it with Red and Green.
Then I created another blend graph which helped in blending dry grass with green grass with the help of noise texture.
Then I added snow on the top of the mountain, for that, I created a mask using my terrain Height Map.
And then I put tilling of 0.0248 on this snow mask, so it would align properly with the mesh.
After blending everything together, the result looks like this:
I have created one more material function for tessellation and given a few controls to set is distance and amount of tessellation.
Now, when the Auto-Blend Layer is ready, I add the feature of manual material painting as well. For that, I merged the Auto-Material Blend with the other 6 materials.
Then according to the material, I created a Landscape grass type which helped in generating foliage automatically as per the texture assigned.
For this project, I used 4 of them.
- Landscape Bush – Generate bush where noise mask is coming.
- Landscape Grass – Generate grass as per blue color mask.
- Landscape Tree – Generate trees as per green color mask.
- Landscape Stone – Generate stone where I paint my stone material.
And finally, this is the final graph for Auto Landscape Shader:
I tried to set a pleasant lighting mood. So, I chose golden hour time which also helps in getting golden reflection on the water. In Directional Light, I adjusted the color and intensity (3 lux) and then added some light shafts and bloom. To get the good shadow on the background forest I have increased the Dynamic Shadow Distance of movable light, I found this option in Cascaded Shadow Map in Directional Light.
Sky Light and Exponential Height Fog:
Clouds and Sky
For the sky, I used HDRI which helped me in getting realistic background clouds. The clouds that are moving over the mountains are volumetric.
In post-production, I tweaked a few parameters like white balance, shadows, and tones to make the scene more saturated and lusher.
I have spent around 3 months on this project. My major focus was to create an automatic system that helps in creating rich lush natural open-world environments and try new tools of UE 4.26. I really enjoyed the journey and faced a lot of challenges in understanding volumetric clouds and water.
Feedback is very important to improve overall quality, your mind works best for you, but if you want to show your work to the world, you must apply different points of view and learn from it. Special thanks to my friends for their continuous input for improving overall composition.
Abhishek Sharma, 3D Environment Artist
You may find these articles interesting