406 Game Development and Simulation with Unreal Technology
What Happened in TUTORIAL 7.3. . .
You just created your first landscape material and applied its layers to your land-
scape. We will go over what we did in the tutorial step by step.
SETTING UP YOUR FIRST LANDSCAPE MATERIAL
In this section we just organized our assets. We created a fo lder to host our land-
scape materials and created a simple material in the folder as our first lan dscape
material.
SETTING UP THE MATERIAL COLORS
Next, we set up the Base color network of our material. In this section, we cre-
ated three Co nstant3Vectors for our Sand, Grass, and Snow material layers. We
assigned a brown color to Sand, a green color to Grass and a white color to the
Snow Vectors.
CREATE MATERIAL LAYERS
This section was actually where most of the action takes pla ce. We needed to
create three layers fo r each material (Sand, Grass, an d Snow) so that our rendered
can combine and blend them together. So we created three Layers, a SandLayer,
a GrassL ayer, and a Sno wLayer, using Landscape Layer Weight material
expressions.
If you rec all, these expressions have two inputs, a Base and a Layer input.
The Base input takes in a material network to apply as the first (bottom) blend
node. This layer will be the base of the combined calculations. The Layer input
takes in the material network to apply as th e second blend node. This layer will
be applied on top of the base for the blend calculations.
We want the Sand to be the first layer, Grass the second, and Snow the last.
This is because our landscape starts with a layer of sand (or rock). On top of th e
sand, we may have gr ass grow, and finally snow will go on top of the other two
layers.
So for th is reason, the SandLayer leaves the base input unconnected and
takes the Sand Color as its L ayer inp ut network. Then, GrassLayer took the
output of the SandLaye r as base and applied the Grass Color network as its
Layer input. Finally, the SnowLayer took the result of the GreenLayer calcu-
lations as its Base input and the Snow Color network as the Layer input. The
final output of this network was then applied to the Base Color channel of our
material (see Figure 7.12).
APPLYING LAND SCAPE MATERIALS TO LANDSCAPE
Once our landscape material is created we can assign it to o ur landscape ac tor
and start painting its layers. To assign a material (any material can be assigned
Terrains and Landscapes in Un real Engine 407
to a landscape), all you need to do is to select the landscape actor in the Scen e
Outliner and drag the material from the Content Browser to the Landscape
Material slot in its Landscape section in the Details rollout.
Next, we went to the Paint mode of the Landscape tool. In the paint m ode
you can select settings for your layer paintbrush, chan ge the br ush, and create
and assign Layer Infos to your la yers. Since we just created our layers, they did
not have any Layer Info assigned to them. We created one Layer Info for each of
the SandLayer, GrassLayer, and SnowLay er.
With the Layer Infos c reated for our landscape layers, we selected appropriate
settings for our paintbru sh, selected one of the three layers, and started painting
our layers. We kept switching between layers until we got the appropriate look
for our landscape.
Fantastic! Our landscape is starting to look b etter and better. But unless you were
making a cartoon-like terrain we are not close enough to have finished our job. Now,
that bein g said, setting up simple materials and layers is a great way to get your level
going and ready fo r the te am programmers to work with. It is also a great way to
debug the look and feel of your terrain w ithout having to incur a lot of computational
cost editing your level.
Before we move on to discussing other landscape features, we will create a nice
looking material based on some real textures in Tutorial 7.4. Then, we will c reate a
relatively powerful blending network to have ou r layer s blend with each other much
more smoothly in Tutorial 7.6.
The first landscape material you created in Tutorial 7.3 was actually quite simple and
did n ot really have any interesting features. We will show you how to bu ild a much
better and complex network for each of your material layer networks to make your
landscape look more realistic.
FIND ON THE WEBSITE
To find updates to this tutorial and u pdated instructions about its implementa-
tion on other UE 4 versions, please visit the books companion Website at:
http://www.RVRLAB.com/UE4Book/
TUTORIAL 7.4 Creating a Detailed Landscape Material
If you have not c ompleted Tu torial 7.1, go to page 386 to create a Landscape.
We w ill ne ed this landscape to complete our work below.
DUPLICATING LANDSCAPE MATERIAL
1. Go to the Materials folder you created in our earlier Tutorials.
408 Game Development and Simulation with Unreal Technology
2. Right-click on the Mat_LScape _Simple material we created in Tutorial 7.3
and duplicate it.
3. Rename the duplicated material to Mat_LScae_Textured.
4. Double-click the Mat_LSc ae_Textured material to open it in the material editor.
SETTING UP LAYER NETWORKS
With the new material opened in the Material Editor, let us go ahead a nd use
some textures instead of the simple color 3Vectors for the Sand and Grass.
5. Right-click to the left of the Sand Color vector and create a Texture Sa m ple
expression. Remember, you can alternatively create this expression by holding the
T key and click ing on the gr aph editor.
6. In th e Details rollout of this texture sample look fo r and apply the
T_Ground_Gravel_D texture. To do this, click on the drop-down box in front
of the Texture section and search for this texture. This is one of the textures that
comes with the UE 4s Starter Contents.
7. Type Gravel Tex ture in the Description tag of this expression.
8. Move the Sand Color vector out of the way and connect the RGBA chan nel of
the Gravel Texture expression to the Layer input channel of the SandLayer
expression.
9. Right-click to the left of the Grass Colo r vector and cr eate a Texture Sam-
ple expression. Remember, you can alter natively create this expression by holding
the T key and clicking on the graph editor.
10. In the Details rollout of this texture sample, look for and apply the
T_Ground_Grass_D texture. To do this, click on the drop-down box in front of
the Texture section and search for this texture. This is one of the textures that
comes with the UE 4s Starter Contents.
11. Type Grass Textu re in the Description tag of this expression.
12. Move the Grass Color vector out of the way and connect th e RGBA channel
of the Grass Texture expre ssion to the Layer input channel of the GrassLayer
expression.
13. Right-cl ick below the Snow Color vector and create a Texture Sample ex-
pression. Remember, you can alternatively create this expression by holding the
T key and click ing on the gr aph editor.
14. In the Details rollout of this texture sample, look for and apply the
T_Perlin_Noise_M texture. To do this, click on the drop-down box in front of
the Texture section and search for this texture. This is one of the textures that
comes with the UE 4s Starter Contents.
15. Type Snow Noise Texture in the Description tag of this expression.
16. Right-cl ick to the right of both the Snow Noise Texture and the Snow
Color and place a Multiply expression.
17. Connect the output of the Snow Color to input A and the RGBA o utput of the
Snow Noise Texture to input B of this Multiply expression.
18. Connect the output channel of the Multiply expression to the Layer input channel
of the SnowLayer expression.
Terrains and Landscapes in Un real Engine 409
FIGURE 7.16: Landscape Material Texture Setup.
19. Make sure th at the output channel of the SnowLayer is connected to the Base
Color of our material node.
20. Delete the Sand Color and Grass Color expression.
21. Your network should look similar to Figure 7.16.
22. Save your material a nd close the material editor.
APPLYING THE MATERIAL
This material is already looking great! Let us apply it to our landscape and
see how it looks. Applying the material to o ur landscape is easy, and you may
remembe r the steps we too k from Tutorial 7.3. But we will go through these
steps one more time:
23. In the main editor click on the name of you Landscape Actor (NOT the Landscape
Gizmo Actor) in the Scene Outliner to select it.
24. In the Details rollout of your landscape actor, find the Landscape section.
25. With your landscape actor selected, navigate to your Mater ia ls folder y ou created
earlier and find your Mat_LScape_Textured material you just create d.
26. Drag the Mat_Lscape_Textured material into the Landscape Material section
of your Landscape actor.
27. This will apply the landscape material we c reated to your landscape. Notice that
UE4 will immediately start compiling the shaders fo r this material.
28. At this stage your level editor should give you a warning about Lighting
Needs to Be Re built”. Click on the Build icon in the main editor toolbar to
build your lighting.
29. Compile and save your level.
410 Game Development and Simulation with Unreal Technology
PAINTING MATERIAL LAYERS ON THE LANDSCAPE
Now, let us paint our layers. To do this, we will go to the Paint mode of our
Landscape tool and select which layer to paint. We will then paint each layer
and keep switching layers to pa int.
FIGURE 7.17: Removing Old Landscape Layer Infos.
30. In the Landscape tool in the Modes Panel select the Paint section.
31. Use the following values for your Brush Settings and Tool Settings:
Brush Size: 512
Brush Falloff: 0.5
Toll Strength: 0.3
32. We will first remove the old Laye r Infos from our Paint mode. To do this, simply
click on the X icon next to the Obsolete Lay er In fos (see Figure 7.17). These were
the items we used in our previous Tutorial.
FIGURE 7.18: Landscape Textured Layers Painted.
33. Create n ew L ayer Infos for your new SnowLayer, SandLayer, and G rassLayer:
a. Select the SandLayer in the Target Layers Section of the Paint mode.
Click on the + sign on the Sand Layer item to add a layer info for it (see
Figure 7.14).
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.235.62