Terrains and Landscapes in Un real Engine 391
will import a landscape in th e next tutorial.
We also added a BP_Sky_Sphere actor, a Directional_Light actor, and a
Player Start actor into our level. We also assigned the Directional_Light to
the Directional Lig ht Actor property of our Sky Sphere actor.
CREATE A LANDSCAPE
This section was actually the section in which we added the landscape to our
level. Creating a new land scape was actually pretty easy. All we needed to do is
to go to the La ndscape Tool in the Modes Panel, enter some basic properties
for our new landscape and c lick on the Create button.
SCULPT YOUR LANDSCAPE
Once the landscape was created, we made some sculpting edits to it to make it
look pretty impressive. To sculpt our landscape we made some changes to our
brush. Using left-click and shift + left-click of the mouse we raised
and lowered the elevation of our landscape.
Finally, we built our level’s lighting as the geometry of our level changed with
the sculpting of the landscape.
Congratulations! You just created your first la ndscape in Unr eal Engine 4. As you
noticed, the creation of landscape (even the simple sculpting we did) was fairly easy.
Now, let us export our landscape ’s Heightma p to a PNG file. We will then duplicate
our level, delete its terrain and recreate it. Exc ept this tim e, we will import the height
map to create the landscape.
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.2 Creating a Landsca pe from Heightmap Files
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.
EXPORTING THE HEIGHTMAP
In this section we will export the Heightmap of our landscape.
1. Go to the Landsc ape Tool in the Modes Panel. To do this, either click on the
Mountain icon or p ress Shift+3 on yo ur keyboard.
392 Game Development and Simulation with Unreal Technology
2. Since we alrea dy have a landscape in ou r level, you should be in the Sculpt mode
of your landscape tool.
NOTE
If the sculpt mode is disabled, you probably do not have a terrain (la ndscape)
in the level. Go to Tutoria l 7.1 on page 38 6 to create one.
3. Right-click on the H eightmap in the Sculpt mode and choose Export to
File (see Figure 7.8).
4. When the Export Landscap e Heightmap window p ops open, navigate to a location
where you c an easily fin d the expo rted Heightmap la te r.
5. Give your Heightmap file a distinctive name, such as MyFirstHe ightmap. Note:
I recommend not having sp aces in the name.
FIGURE 7.8: Exporting the Heightmap t o File.
6. Before we proceed to dup licate our level, save everything.
DUPLICATING THE LEVEL AND IMPORT LAN DSCAPE
HEIGHTMAP
In th is section we will duplicate our level, delete the Landscape actor, and create
one by importing the Heightmap.
7. In th e Content Browser, double-click on the Maps folder you created in Tuto-
rial 7.1 to open it.
8. You sh ould see you r Outdoors level (the o range thumbnail with the word “Level”
on it).
9. Right-click on the Outdoors Level, and choose Duplicate. Once Duplica te d,
UE4 will give it the name Outd oors2.
10. The duplicate level (Outdoors2) will have a copy of all of our creations so far.
11. Select the level Outdoors2 (Lef t-click on it once) and save it by pre ssing
Control+S on your keyboard.
12. In the Scen e Outliner (upper right corne r of the editor) find the Landscape actor.
Select it by left-clicking on it once, and press delete key on your keyboard to
Terrains and Landscapes in Un real Engine 393
delete it. Once the L andscape is deleted, you should notice that the Modes Panel
of the editor snap s back to the Place mode.
13. In the Modes Panel go bac k to the Landsca pe Tool (click on the Mountain icon,
or press Shift+3 ).
14. This time , select the Import from File radio button.
15. Click on the . . . (or browse) button next to the Heightmap File and navigate
to the folder to which you exported your Heightmap in step 4.
16. Use the following properties f or the lan dscape:
Location: (0,0,-200)
Size Sect ion: 15 × 15 Quads
Section Per Component: 2 × 2 Section
Number of Components: 4 × 4
Overall Resolution: 121 × 121
17. Click on the Import button to create your landscape.
18. Save your level.
What Happened in TUTORIAL 7.2. . .
You just exported your the H eightmap of fir st landscape and used it to create
another landscape.
EXPORTING THE HEIGHTMAP
In this section we exported our Heightmap file to a PNG file. This is a great way
to save your landscape Heightmaps and re-use them in other projects and levels
to save yourself a tr emendo us amount of time creating brand new landscapes
from scratch.
DUPLICATING THE LEVEL AND IMPORT LANDSCAPE
HEIGHTMAP
Creating a landscape from imported H eightmap files was as easy as simply cre-
ating a new landscape actor. All you needed to do is to specify the Heightmap,
and choose the p roperty of your landscape. Then, you ca n just simply import the
Heightmap to create the landscape.
If you want to use the same lan dscape p roperties as the original landscape
on which the Heightmap is based, you can click Fit to Data butto n. This will
automatically fit the Heightmap to the data.
Great! We have learned how to create landscapes with just the p ress of a button in two
different ways. But as you can see the landscapes we have created so far (although
sculpted) do not look nearly as nice as what you have imagined. That is because there
is much more that goes into a landscape than just the Heightmap.
394 Game Development and Simulation with Unreal Technology
You should h ave noticed that we lef t th e landscape mater ia l empty when we created
our landscapes in Tutorials 7.1 and 7.2.
In the following section we will discuss La ndscape Materials [28] and Landscape
specific Ma terial Expressions [26]. A more compreh ensive list and descriptions of
functionalities may be found on the Unreal Engine documentation Website
2
.
CROSS-REFERENCE
To learn more Unreal Engine 4’s Materials and Mater ia l Editor, check out
Chapter 4 and Section 4.3 on page 127.
7.3 LANDSCAPE MATERIALS
Although you can use any material as a landscape material, Unreal Engine 4 allows
for much more complex and specialize material systems to be used in tandem with
landscapes. These specialized materials give you a tremendous amou nt of control and
flexibility in texturing Landscapes in UE4. We will take a look at what is so special
about Landscape Materials, learn how we can utilize them in our landscapes, and
how the rendering engine in UE4 provides specific functiona lities to these materials.
7.3.1 HOW LANDSCAPE MATERIALS BLEND
In UE4, the rendering mechanism uses a weight blending approach in combinin g
landscape materials, as opposed to alpha blending. The blending values f or all of the
layers involved with a landscape material at any given lo cation will be n ormalized
–i.e., they add up to 1.0.
There are advantage and disadvantages to this approach. T he advantage is that you
will have the flexibility to paint any layer on any location in the landscape. As you
add more and more of that layer, its weight increases wh ile simultaneously decreas-
ing the weights of the other layers.
This comes at a cost. If you have a layer at 100% weight e.g., the first layer you
paint, you may not be able to remove it. This is b ecause when a layer is at 100%
weight, normalization forces the weight of all the other layers to be 0. When attem pt-
ing to remove this layer, UE4 will not have a mechanism to know which layer you
want it to be replaced with.
7.3.2 LANDSCAPE MATERIAL EXPRESSIONS
Landscape material expressions are those expressions that allow you to design land-
scape specific functionalities for the materials to be used as a landscape material.
2
https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/
ExpressionReference/index.html
Terrains and Landscapes in Un real Engine 395
The following list is ad opted from th e Unreal Engine 4 official online documenta tion
[26].
CROSS-REFERENCE
A comprehensive list of Material Expressions ma y be found in Appen dix A.
Landscape Layer Blend: This expression, shown in Figure 7 .9, enables you to
blend multiple textures or material networks together to be used as landscap e
layers. This expression uses an array of objects that store infor mation about ea ch
layer. This informatio n inclu des the la yer’s name, blend type, preview weight,
layer input and height input.
FIGURE 7.9: Landscape Layer B lend Expression.
To add a layer to the array of lay ers, simply click on the + sign next to Layers in
the D etails rollout o f this expression.
To remove a layer simply, c lick on the trash bin icon, and select the name of the
layer to delete, or click on the tria ngle icon next to the nam e of the layer and
choose delete.
..................Content has been hidden....................

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