Unreal Engine 2: Introducing materials and landscape painting

Rob Redman introduces materials and landscape painting in part two of our video tutorial series for creating a playable level in Unreal Engine, complete with free assets...
Tutorial assets
I created my own texture maps for this which you can find in the assets folder. These were made using simple diffuse textures which were taken into Crazybump for generating normals, specular, displacement and so on.
Previous tutorials
Part 1: Setting up a new project
Introducing materials and landscape painting
Importing assets
First things first we need to get our textures in place, so open up your project and make sure your landscape level is open. Now go to your content browser and, if you haven't already, create a folder for your project and right click to add a new folder within that called 'Materials'. Click the import button to load all your textures into your browser.

Managing assets with the content manager is a breeze and helps keep things organised
New material
Choose a location for your new material. I chose the same folder as the textures, to keep everything together. Right-click and choose New Material then rename it to Landscape and double-click it to open up the node editor. This is where most of the setup work happens and is a great workflow. If you're new to nodes persevere. They make for a powerful tool once you get used to it.

Opening up the node editor can be daunting but it's a simple but effective way of working
Set up your nodes
Drag the colour and normal textures from the content browser into the node window and lay them out in pairs. I tend to stack them in realworld order, where applicable, so rock, gravel and grass here. You can add more if you like so if you want earthy patches or flowers etc you can do so.
Now. right-click and find and add a Landscape Blend node. In the details you want to add three elements and rename them to match your textures. Then set the preview weights to set the order of importance, from 0, 0.5 and 1.0. All three Blend types should be LB Height Blend.
You'll also need a Landscape co-ordinates node, which is essentially a UV generator for the terrain.

Getting the nodes in place
Connection and refinements
Now we need to start connecting the nodes to generate the material, so hook up the colour textures to the first input of each material on the blend node and the alpha outputs into the height input.
Select the co-ordinate and blend nodes and hit Ctrl+W to duplicate, then connect the corresponding normal maps to the blend node, then the blend to the normal input of the material node.
If you want, you can do the same with the occlusion and specular maps too. A constant with a low value can take the shine off, if the specular map makes things too glossy.

Connect the nodes up as in the image. The preview might look odd but it will make sense in a minute
Apply and prep
Save and exit the node window and once back in the main workspace select the landscape in the outliner, and in the details tab add the newly created material to the material slot. You can simply drag and drop from the content browser into the details tab. You should find that, after it compiles, your landscape in the viewport is covered in a mixture of the three sub-materials. This is normal and we will paint in the parts we want next.

Our landscape now has the newly created material applied, ready for detail painting
Brush setup
Move to the landscape tool section and select the paint tool. You should now see the three sub materials in the Target Layers window. A really important step is to click the + sign next to each and set it to Weight Blend Layer. If you don't do this you wont be able to paint properly. Now you can go ahead, choose a layer and begin to paint. You can see I added a second grass layer, for a little more variation and to help cover some of the tiling.

Keep varying your brush size and rotation to keep things looking naturally chaotic
Painting details
You may find that as you paint that you want to add in details, like pathways, scorched areas or paving and so on. You can go back into the material at any point and add new layers to paint with. Just be sure to hook up the nodes in the same way as before and in the paint palette make sure you change the blend mode as you did previously.
Finalise your painting now, as in the next episode we will start adding in some other models, populating the scene with foliage and interesting rocks and so on.

Adding specific details can be done any time. You can reapply your node setups when needed
Top tip: Painting with Alpha
Load up an alpha for your painting brush for better results. A smooth falloff looks wrong for this type of work, so a little noise in the alpha can work wonders.

The alpha brush I used is in the assets folder
Related links
Download Unreal Engine 4
For more from Rob, check out Pariah Studios
Check out part 1 of the Unreal tutorial series: Setting up a new project
Fetching comments...