Landscape Material Breakdown!

Posted on Posted in GameDev, Tutorial

By popular request Im doing a quick breakdown of the landscape material that we showed in our last post!
If there are any questions or if you would like an even more indepth look at it in form of a video tutorial or something let me know in the comments 🙂

This is the material we are talking about:

It has distance based tessellation, height blending between the textures and procedural puddles that you can paint on top.

Lets start with a look at the complete material:
material01

And its settings:

materialsettings

Its not using a mask since we dont need holes but it should not be a problem to add that to your version.

And this is what an instance looks like with all of the settings that are exposed to the artist:

materialinstance

The interesting part here are ofc the puddles.

So lets break down the Material, starting with the UVs:

material02_uv

Nothing too crazy here, just a world position and a multiply to control the tiling. This means the texture will stretch on steep angles, not important for us since we wont be using it there but you might want to change this if you plan on using it for rocks and stuff.

Next up is one of the material layers:

material03_layer

We put our materials into functions to keep the graph from getting messy and just expose the relevant settings as parameters. Were also feeding it the world position uvs.

Detail shot of the function:

material04_layerdetail

Pretty simple and regular setup with a few inputs for the parameters. We have the roughness, height and ao stored in one texture to save memory. Since the material attributes do funny things to the scalar value of the heightmap and were going to use that to mask stuff I created a separate output for that.

Important: If your using a lot of textures or layers you need to set the texture Sampler Source to Shared:Wrap.

We then use a regular Landscape Layer Blend node to blend the layers:

material04_blend

The important part here is having an unused alpha blend layer as well as having one layer that is going to cover the whole landscape as weight blended. We use this to get rid of problems with black spots on the landscape as well as it not compiling properly and showing the grey worldmaterial when more then 3 layers are used with tessellation.

We also use the separate heightmap output for the height input on the blend node.

Since we arent using the material attributes for the height information we need to blend that separately:

material05_blendheight

Here we sample the layers mask information and use that to lerp between the different heightmaps.

Once the materials are blended we add the puddles ontop:

material06_puddles

This layer has a lot of parameters that arent really necessary, I was experimenting with my procedural setup which is why I have so many 😀
We input the blended Material as well as the blended heightmap and the layer information for the landscape “puddles” layer that we sample here into this function.

This is  screenshot of the puddles function:

material07_puddlesdetail

Its still really messy as I havent found the time to clean it up yet. Its basically a custom blend, using the heightmap to blend between the terrain material and constants as well as a 3-vector for the puddle values. The cool stuff is in some features like normal blending and wetness on the edges, color and opacity for depth or dirty puddles and a option that allows us to shift the height of the puddle from nothing to covering the whole area. All of this is then masked by the puddle landscape layer information.

You can take a look at some other puddle tutorials to get similar results, most of them use vertex color to blend in the puddles, just use the layer information instead.
Edit: Added detail shots of this graph for anyone interested in what exactly it does.

Final step is the tessellation:

material08_tessellation

Here we use the heightmap information to get our worlddisplacement for the landscape material (upper right).
Our tessellation  setup is dependent on the camera location and has the vector length in there since unreal likes to tessellate the whole object otherwise (which we obviously dont want) We have some extra parameters to control the fade distance, offset and tessellation resolution.
We use a material parameter control to input our overall tessellation strength since we want to be able to control the effect via the users option menu (on all our materials at once).

And there you have it!
Keep in mind that this is a pretty expensive material and we only use it on the highest settings, its probably not something you should use on very big terrains and fewer layers is always better for performance.
Let me know if this was of any help or if you have any questions in the comments!

 

-Lukas

10 thoughts on “Landscape Material Breakdown!

  1. Really interesting and useful – I have been following through and building my material using all this info, but the crucial one I cannot read from the screenshot is the puddle… Its the puddle mat function that would be really useful to see – could you split it into 3 screenshots, or make a higher res one? Would be really useful to finish off the landscape material…

    1. Glad that its useful to you, you are right its kind of hard to see in that image. I took two separate screenshots and moved the nodes closer so that you might be able to figure out whats going on (sorry, only have one 1080p monitor right now or I would take a hirez img).
      I didnt really want to share this in its current state as I havent cleaned up this part so there are tons of useless connections and nodes atm but feel free to take a look anyway.
      (links as imgs dont work in comments)

      http://sanethegame.net/wp-content/uploads/2016/11/puddlebreakdown01.jpg
      http://sanethegame.net/wp-content/uploads/2016/11/puddlebreakdown02.jpg

      Hope this helps.

    1. Thanks, were really busy with the game right now but I would like to create one once things have cooled down a little.
      I personally hate it when tutorials are overly long and complicated because the creator didnt put enough time in planing them so I would like to do it properly when I do it 😀
      We also kinda promised a tutorial on our characters which faces the same problem 😛

    1. Thanks a lot!
      Sorry I cant share the material at this point as it still needs cleaning up (especially the puddles part) and I would have to adjust textures (were using them in our game).
      Since a lot of people asked for it im gonna do a video tutorial on this, its gonna take a while until I get to that since were really busy with the game right now. Ill let you know once I do.

  2. Ein Video Tutorial wär wirklich das non Plus Ultra. Wie du schon geschrieben hast braucht man für die Ausarbeitung solcher Techniken mehrere Wochen. Die haben wir Hobby-Unrealen leider nicht zur Verfügung 🙂
    Mit einem Video kann man die hierfür notwendigen Schritte zumindest nachstellen und etwas dabei lernen – so sollte es doch sein! Vielen Dank!

Leave a Reply