Terrains and Landscapes in Un real Engine 461
To apply the Walkway static mesh to the spline, we first selected all of its seg-
ments by clicking on the Segments button in the L andscape Spline sectio n
of the Details rollout. We then added one mesh slot (element) to the Spline
Meshes section and assigned the walkway mesh to this element. Now our spline
has a renderable static mesh that looks like a walkway made o ut of cobblestones.
ADJUSTING THE SPLINE AND FINAL TOUCHE S
After ap plying our static mesh, we fou nd a couple of issues in our spline that
needed final touches to finish it up. The first issue was with some portions of our
spline being buried under the landscape. This issue is caused when we adjust the
landscape to conform to the shape of our spline; som e areas will be raised while
some other will be lowered. D oing so m ight make parts of the spline to intersect
the landscape.
The fix for the issue of portions of the splin e b eing covered in the landscape is
easy. We just need to select the control points at either en d of the spline segments
that are covered under the landscape and raise them a little along the Z (blue) axis.
The next issue was due to the fact that when we applied the mesh to our spline
segments, the X axis of the mesh was au tomatically aligned with the Forward
Axis of our spline. We wanted the Y a xis of the mesh to align w ith the Forward
Axis of the spline. The fix for this issue is also rather easy. In the Landscape
Spline Meshes section of a spline’s deta il rollout, there is a property called
Forward Axis. We simply need to cho ose the axis from the original mesh (e.g.,
the Y axis) to assign to the Forward Axis here.
Finally, we adjusted the UV tilings of the TexCoord material expression in
the M_Walkway_CobbleStone material to make the bricks look a little bigger
on the walkway. We used the value of 0.5 for both UTiling and VTiling in the
material editor.
ADDING A JUNCTION
In the final p ortion of our tutorial we added a jun ction to our walkway. The
process involves two very easy steps. In the first, we will have to select one
control point (or segment) from which we would like to fork the road. Once the
location for the junction is selected we can add new segments to our road by
simply pressing the Control key and Left-Clicking on the landscape.
In the second step, we will Shift+ Left-click on each n ewly added seg-
ment to select them. We then press the Only Selected button under the Deform
Landscape to Splines to make the landscape confo rm only to the newly
added segments of our spline. We will then go through anoth er cleanup p rocess
if some portions of the newly added segments got buried under the landscape.
Looks like our humble landscape is shaping up nicely. There are just a couple of
more things we ne ed to do to have completed our journey outdoors. It would be great
if we could add a river to the bottom of the valley in the landscape.
462 Game Development and Simulation with Unreal Technology
It would also be gr eat if we co uld add some props, like tree trunks, stones and bushes
to the landscape to make it look more rich. We will make these additions next. Let
us start by learn ing how to add instanced meshes to our landscape.
7.6 FOLIAGE AND FOLIAGE EDITOR
Unreal Engine 4 allows you to e asily add static me sh in stances to your level with
its Foliage System [14]. The process of adding instances of static meshes on a
landscape is very much like painting landscape layers. However, there is another
significant benefit to using the foliage system to add meshes to your landscape.
FIGURE 7.49: The Foliage Tool.
When you add instanced meshes with the use of th e foliage sy stem, the meshe s will
be grouped toge ther into c lusters th at are rendered by me ans of instancing. In other
words, instead of having to make one draw call for each individual mesh, a single
call will render all of the instances within a cluster at once.
To add instanced meshes to your landscape or on other meshes, you should use the
Foliage Tool shown in Figure 7.49. The Foliage Tool can be accessed in the
Modes panel by clicking on the branch icon or by pressing Shift+4 on your key-
board. Once in the Foliage Tool you will be given access to five (5) modes: Paint,
Reapply, Sele ct, Lass o, and Fill modes.
You will notice that the Meshes section of the Foliage Tool will be empty (see
Terrains and Landscapes in Un real Engine 463
Figure 7.49). Before you can paint static mesh instances using the Foliage Tool
you must add some static meshes to this list. To assign static meshes to the Fo-
liage Tool to draw on your landscape, simply drag a static mesh from the Content
Browser onto the Meshes section of the Foliage Tool.
NOTE
To add your first mesh to the list of meshes in the Foliage Tool you must
drag it from the Content Browser onto the black bar that reads Drag
static meshes from content browser into this area”. Once you
have added your first static mesh, you may add additional me shes by drag-
ging them from the Content Browser on top o f the existing ones in the
Meshes section.
Each static mesh in the Meshes list of the Foliage Tool will have three mode s
9
:
TABLE 7.26: Foliage Tool Modes
Hide De tails: This mode will hide all of the mesh settings and p arameters.
Once you have made the necessary adjustments to each mesh’s parameters
in the list, you can click on this m ode to easily se lect (or deselect) the
meshes you would like to p a int or mod ify in the viewp ort.
Show Painting Settings: This mode shows the parameters that control how
the in stances of the mesh wi ll be placed in the level.
Show Instance Settings: This mode shows the parameters that affect the
instance already pl a c e d in the level.
To select a mesh in the Meshes list of the Foliage Tool simply Left-c lick on the
checkbox next to its name. Each selected mesh will be highlighted with an orange
color. To deselect a mesh, Left-click on its checkbox a gain.
It is important to note that only selected m eshes will be affected in the editor. For
example, suppose you have some rocks and some tress in the level editor, and want
to erase only the trees while leaving the rocks. Simply deselect the rock mesh in the
Meshes list and select the tree mesh (Figure 7.50(a)). Pressing the Shift key a nd
Left-clicking on the level will only remove the tress (since the tree mesh is th e
only mesh selec te d in the Meshes list of the Foliage Tool).
The properties that control the currently selecte d tool are displayed above the Meshes
list (e.g., Figure 7.50(b) shows Paint Tool properties). The following list presents
9
The contents of this section are adopted from the official UE4 online documentation found at:
https://docs.unrealengine.com/latest/INT/.
464 Game Development and Simulation with Unreal Technology
(a) (b)
FIGURE 7.50: (a) Selecting and Deselecting Meshes in the Foliage Tool. (b) Brush Settings.
a description of e ach property
10
:
TABLE 7.27: Foliage Paint Tool Properties
Brush Size: This setting controls the size of the brush in Unreal Units.
Paint Density: This setting controls the target density you wish to a c h ieve
by Control +Click to add mesh instances. The value for brush density
ranges between 0 and 1. A value of 1 wi ll paint mesh instances at th e
maximum density l isted in the M esh Properties for each mesh [1 4]. If
the density is already higher than this value, no additional mesh instances
will be added.
Erase Density: This setting controls target density you wish to achieve whe n
erasing instance by Cont rol+Shift+Cli ck. The value ranges between 0
and 1. If the current density is already lower than this value, no more
meshes will be removed.
Filter: This setting controls the type of objects that you wish the mesh
instances to be painted on. For example, if you only want to place fo liage
mesh instances to the landsca pe and not any other object type, deselect
all but the landscape in the Filter section.
7.6.1 FOLIAGE TOOLS
As of Unreal En gine 4.6 release, there are five tools (modes) available in the Foliage
Tool. Each of these tools allows you to perform a specific action designed to work
with foliage and static mesh instances. The following descriptions are ad opted from
Unreal Engine’s Official Documenta tion [14].
10
The contents of this section are adopted from the official UE4 online documentation found at:
https://docs.unrealengine.com/latest/INT/.
Terrains and Landscapes in Un real Engine 465
Painting Sett ings
The Painting Settings affect the way the Foliage system places/removes mesh
instances to/from the level.
Paint Tool: This tool allows you to add/remove mesh instances to/from the world.
To add instan ces to the brush, area hold the Control key on the keyb oard
and Left-click on the target area . To remove fo liage from the level, hold
Control+Shift and Left-cl ick on a target area. Note: Only selected meshes
in the Foliage Tool will be adde d/removed.
TABLE 7.28: Paint Tool Properties
Paint Settings
Density /1Kuu
2
: The number of instances place for this mesh for
each 1000 × 1000 Unreal Unit area.
Radius: This is the minimum distance between mesh instanc e s for
this mesh.
Align to Normal: This setting, if true (checked), orients me sh in-
stances to orient wi th the direction of the normal to the surface
at wh ich they will be placed.
Max Angle: This setting s pec ifies the maximum angle to allow w h e n
aligning a mesh instance with surface normals.
Random Yaw: This setting, if true (checked), rotates each insta n c e
of the placed mesh randomly along its Z axis.
Uniform Scale: This setting, if true (checked), makes the instances
of the mesh scale uniformly. Unch e c k if you wis h to have in-
stances scale on X, Y, and Z axes independen tly.
Scale Min/Max: Each mesh instance will be randomly s c a led be-
tween the Min and Max values, when placed.
Random Pitch ±: Adds values up to the spe c ified value to the ori-
entation of each instance.
Ground Slope: If non-zero, will place foliage instances if the slope is
less than this value. Will ignore surfaces steeper than this value
for adding i n stances. If the value is negative, will add foliag e
instances to surfaces steeper than the specified value.
Height Min/Max: Will not place any instanc e s outside of this range.
Landscape Layer: If this value is specified, the instances will be
painted with a density proportional to the weight of th is la nd-
scape layer.
Reapply Tool: This tool allows you to change the param eters of instance that are
already placed in the level. In this tool you m ay check the appropriate setting( s)’
..................Content has been hidden....................

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