With this addition to the Landscape painting material system, I’m adding a layer that will change texture/color depending on how steep the terrain is. Credits go to CodeLikeMe for teaching me this.
Starting from the previous tutorial…
- Open M_Landscape
- Find and click the ‘Layer Blend’ node
- Go add a new array element under the section “Material Expression Landscape Layer Blend,”
- Change its label name to ‘auto’
- Set its preview weight to 1
- Make the first array’s preview weight value to 0
- Make ‘Auto’ the first element in that array list
- It should look like this:
- Now find yourself an area above the Layer Blend and right-click
- Type “WorldAlignedBlend” and create that node. It should look something like this.
- Right-click the IN nodes, Blend Sharpness then promote to the parameter.
- Do the same for Blend Bias
- Add ‘L1’ to the name of the new params
- Connect the OUT node ‘w/Vertex Normals’ to ‘BlendMaterialAttributes’ Alpha node
- Connect the ‘A’ node to the OUT of MF_Layer connected to L1
- Connect the ‘B’ node to the OUT of MF_Layer connected to L2
- Connect the OUT node ‘BlendMaterialAttributes’ to ‘BlendMaterialAttributes’ ‘A’ node
- Connect the ‘B’ node to the OUT of MF_Layer connected to L3
- For the alpha node, duplicate the previous alpha node’s IN but change the param’s name to have L2 instead of L1
- Connect the OUT node to the Layer Blend Auto IN.
- Your code should resemble this:
- Go into the landscape mode, and into the paint section
- Look at the layers section and find Auto
- Press the ‘+’ button and Select Weight-Blended Layer
- Its saves location will be in the default folder
- Go to the MI_Landscape material instance
- You’ll find new values under Scalar Parameter Values. Check all the boxes
- You could use my values if you’d like
- BUT due to the nature of this setup, L3 will be grass (in this case) and L1 will be rock. This is easy to flip around, but it’s not a big deal.If future me thinks it is, I’ll fix it here.
- You should be able to paint this material onto terrain now.