I decided to do a deeper dive into the power of Unreal’s Material Editor by creating an Auto Landscape Material. This is a type of material that automatically blends different textures based on the slope or height of the landscape, and it’s a great way to learn different features and techniques for materials in Unreal Engine. The version I created here has up to three slope-based layers: the base layer (grass), the slope layer (rock/cliff face) and the optional transition layer (soil) between the two. I also added optional upper and lower height-based layers (think for snow and sand, respectively) for more variety and control.
This auto landscape material has a ton of options exposed for the user to fine tune their landscape. You can tweak the slope and height based layer masks in the material instance, and each layer has its own controls for texture cell bombing (to reduce tiling) and basic texture map editing. There is also global macro variation you can add, and the slope layer has an option to enable triplanar projection to avoid stretching. It also utilizes the Landscape Grass node to spawn foliage based on the material layer. The landscape material is compatible with Runtime Virtual Textures for a performance boost or, if you don’t use RVT, you can enable Camera Depth Fading to further reduce tiling and get some nice dynamic variation in texture scale for the foreground versus background.
Here's an overview of the master material. Essentially I am just blending together different material layers using slope and height masks.
Each landscape layer is built in a similar way. All of that layer's parameters are fed into a material function that processes those parameters and outputs the material for that layer.
Here's a short clip of running through the landscape. In this version, I've enabled the Camera Depth Fade for the cliff textures. This means that the texture scale shifts as the camera gets closer. Thus you can use a super large texture scale for far away mountains, so that they still maintain that rocky look, and a smaller texture scale for close up so you can maintain crisp details. Unfortunately, this method does not work with Runtime Virtual Textures, so like many things in game dev, there is a tradeoff in visual believability versus performance.
I also experimented with adding displacement via a Virtual Heightfield Mesh. You can see some displacement in the rocks on the left of the image. That feature is still experimental, so it’s still a bit buggy, but I enjoyed playing around with it nonetheless!
Auto landscape materials are super useful to have in the toolbelt. You can create so much variety with instances of the same master material. Here I'm using the same height map, but I can get three very different terrains by just changing the material parameters.
Overall this was super fun to work on. I relearned some old things I had forgotten and learned some new things. I really enjoy being in-engine and problem solving, and I love how working in the material editor scratches that programming itch!

Material developed with the help of Vince Petrelli’s Udemy Course: “Unreal Engine 5: One Course Solution For Material”
Back to Top