Part V: A Closer Look at the Terrain Editing

Part V: A Closer Look at the Terrain Editing
GAME 1303.8001, Fall 2006
Dan Dao
We are still left with the problem of seeing walls at the edges of our level. Most often,
you will find that level designers will simply add some sort of obstruction to block the
player from see the walls housing the terrain. These objects can be a cliff walls, rock
piles, buildings, and so on. Careful placement of these objects can do a great job of
hiding the fact that the player is at the outer edge of the level.
With our level, we will use a similar approach, but instead of using static meshes or
textures to fake an ongoing landscape, we will use a secondary terrain that is placed in
our skybox. For this to work, we will need to make the remaining walls around our level
into take backdrops. By doing this, we will not only create the illusion of our terrain
going on into the distance, but we will even out the lighting caused by the sunlight. We
will be creating this backdrop during this unit, but first, we need to take a look at the tools
available to us to control the look of terrain.
At this point, you just know the basic: You can make terrain, place a texture on it, and
create a light and environment for it. Now, we need to see how we can customize, alter,
and bring out the full potential of our virtual landscapes. To do this, we will need to
access the Terrain Editing tools, located within the Terrain Editing dialog.
The Terrain Editing dialog offers a wide range of tools for developing terrain. The effects
caused by these tools vary depending on what you are manipulating, be it the shape of the
terrain itself (height map), the color of the terrain (texture layer), or the objects scattered
across it (DecoLayers).
NOTE: Before we start, a word of warning, although UnrealEd’s terrain editing system
is extremely powerful and easy to use, it is always possible to make a simple mistake.
Unfortunately, UnrealEd’s undo functionality is not always dependable. You could see
very unpredictable results and its usefulness when painting is limited. Because of this, it
is recommended to save often when working with terrain.
Terrain Editing User Interface
1
This is truly the center of the terrain control system. We will talk about the full interface
of the Terrain Editing dialog for the purposes of shaping and texturing our landscape.
We will discuss how to apply and control DecoLayers to scatter collections of static
meshes across the surface of your terrain. Up to this point, we discussed about the
Miscellanous Tab, we will look at the other options and it’s capabilities found therein.
The Tabs
We will begin at the bottom of the window, with the three tabs for Terrain, Layers, and
Decorations. These are some of the most important aresa of the windows, as they allow
you to select which area you want to edit. One of the biggest problem beginners have
when working with terrain is that you must remember to have the item you editing
selected in this window before any changes will take place. For example, if you want
to alter the height map of your terrain, you must select that height map in this window
before the brush will have any effect. The same goes for texture layers. You must have
the texture you want to edit selected before the tools will affect it at all. Through these
tabs, you will be able to sort through and select any of the element of your terrain.
The Terrains Tab
The Terrain tab allows you to sort through the height maps of the various TerrainInfo
Actors that you have available in you level. At the bottom of the tab, you will see a
button that allows you to create new TerrainInfo Actors, in case you need more than one
area of terrain in your level. For example, you may have one terrain that is the floor of a
2
cave, and another for the cave’s ceiling. Keep in mind, though, that you can only have
one height map per TerrainInfo Actor.
Just above this, you will see a list of all of the TerrainInfo Actors in your scene. You can
use this list to select a specific TerrainInfo for editing. Keep in mind, though, that this list
does not always update; if you delete a TerrainInfo Actor from you level, and thentry to
select that Actor from the list, UnrealEd will likely crash.
As you select each TerrainInfo, you will see its Height Map texture to the right of the list.
This is the texture that you are editing to control the physical shape of the terrain. The
texture begins as a flat grey. Darker areas on the texture will denote depressions in the
landscape, whereas lighter areas will create rises. When you use the Painting tool to
change the shape of your terrain, which we will cover later in this unit, it is this texture
that you are actually updating. Keep in mind that in order to adjust the shape of your
texture with the Painting tool, you will need to have this texture selected, maeaing that
you must actually click on it to highlight it.
NOTE: To select this texture, you will usually need to click on the top of the bar to the
right of the TerrainInfo list.
The Layer Tab
Next to the Terrain tab, you will see the Layers tab, which is where you can add, select,
and arrange your texture layers. Be ware that this is evaluated from the top down,
meaning that the lowest layer of the terrain is actually at the top of the list. Therefore, if
you were to place a grass texture beneath a dirt texture in the list, your terrain would be
completely covered in grass, and your dirt would be invisible.
To edit a texture, you must have that texture selected in this tab. You can only edit the
texture that you currently have selected. As with the height map in the Terrains tab,
selecting the texture usually requires that you click on the top of the appropriate bar.
To the right of the texture layer list, you will see three buttons. The first is the New
button, which allows you to create new texture layers. The Delete button will obviously
remove unwanted texture layers, where the Duplicate button will copy an existinig layer
into the next slot down.
Below these three buttons you will see three smaller buttons, the first two allow you to
rearrange the position of the texture in the texture layer list. For example
, you can
select a texture and click the Up arrow, and the texture will swap place with the texture
directly above it. The Down arrow, conversely, will swap the texture with the layer
directly underneath the selected layer. The third option is the Grid Option button
, The
Grid Options button will allow you to show or hide a grid on any of the layers or opens a
drop-down list that give you access to a grid for specific layers. This grid allow you to
more easily see where textures are visible on a terrain. For example, your grass texture
may be so spars that it is hard to see where you painted it. If, however, you switch on the
3
grid for the grass texture layer, you will see a bright white grid on all areas of the terrain
where the grass texture is at all visible. This is a great guide to see where textures have
been placed on your terrain.
The Editing Tools
At the top left of the window, we see the Tools group.This contains a list of 11 tools that
will allow you to edit an aspect of terrain in some way. Not all of the tools work with all
terrain components, though some will work with more than one. For example, the
Painting tool will work with height maps, allowing you to edit the elevation of a certain
area of terrain. However, it functions differently for textures, in that it allows you to
control the value of your alpha channel to show one texture through another.
We will present these tools not in the order in which they are listed, but rather in the
order of the an efficient terrain workflow. We will begin by shaping our height map,
while demonstrating all of the tools that affect and control the shape of terrain. Next, we
will move on to placing texture on our terrain, discussing each of the necessary tools for
controlling the placement and look of our texture layers. Later, in separate section, we
will discuss the creation and control of DecoLayers, in order to add static mesh
decorations to your terrain such as grass, rocks, debris, and so on.
The Brush
Before we begin, we need to discuss the Terrain Editing brush (not to confused with a
BSP brush). Most of the tools available through the Terrain Editing dialog are
represented by a brush that appears of the surface of the terrain, which can only be seen
when the Terrain Editing mode is active. It appears as two circles, an inner and an outer,
at the location of the mouse. The inner circle applies the full strength of the tool,
determined by the designer, to the terrain. The effect drops off between the inner and
outer circle. At the center of the brush you will see a red dot, indicating the brush’s
center.
4
Inner and Outer Radius
The Inner and Outer Radius sliders determine the size of the brush. It is withing the inner
radius that the maximum strength for the selected tool is applied. The effect of the
selected tool diminishes between the inner radius and the out radius to an effect of zero
when the outer radius is achieved.
Lock Icon
Clicking on the Lock icon will cause the Inner radius setting to become locked. It will
retain its’ off-set from the outer radius. When the outer radius is adjusted, the inner radius
will move in tandem automatically. When the inner radius reaches a value of one, it will
remain there as the outer radius value continues to fall, but the tool will remember the
offset so that when the outer radius value increase past the amount of the offset, the inner
radius will begin to move again.
Per Tool
The Per Tool check box will allow the level designer to give each tool a different brush
setting. Each option set in the Tool Options section will be independent for each tool. If
Per Tool is turned off, the global tool options will be used. The Per Tool settings are not
lost when the option is turned off. When Per Tool is enabled again, the old individual
setting will still be valid.
Strength
The Strength option is used to determine the amount of effect a particular tool will have.
Not all tools will use the Strength option. The Strength setting is a percentage value
ranging from 0 to 100%. The value of this strength is applied to the inner radius of the
brush.
Adjust
The Adjust option is a multiplier value added only to the Painting and Noise tools. By
default this is set to a value of 32. Increasing this value will make you paint stroke and
noise values much more dramatic. Be ware that extreme values can cause this tool to
behave wildly, and usually result in undesired effects.
Ignore Invisible Quads
The Ignore Invisible Quads option is a setting reserved for DecoLayers. Its purpose is to
prevent static meshes from being scattered across invisible quads. For example, you may
need to make an area of your terrain invisible in order to carve a cave or bunker into it. If
you had a DecoLayer of grass across most of the terrain, you wouldn’t want it to be on
the area of a cave entrance, as it would appear to be floating in air. In such cases, you
would want this option to be activated.
5
Mirror
The Mirror option offers a drop-down menu that allows you to choose an axis (or pair of
axes) which to mirror the brush. This is especially useful when trying to make a
symmetrical area, perhaps for a Capture the Flag map. You can mirror across the X or Y
axes, or you may mirror across both, which will result in four brushes, all working in
double symmetry.
Height Map Editing Tools
To begin, let’s take a look at how we can control the shape of our terrain by adjusting our
height map. The Terrain Editing dialog offers several tools that allow us to physically
alter our terrain’s surface in variety of ways. This section describes all of the tools you
can use to edit your height map, along with a description of how they work. NOTE:
Remember that in order to make any of these tools work; you must physically select the
height map you want to edit in the Terrain tab. We will cover eight out of eleven tools in
this section.
Vertex Editing
The Vertex Editing tool allows you to adjust your height map by physically selecting and
moving groups of vertices either up or down. Raising a selection will lighten that area of
the height map, whereas lowering a selection will darken it. Along with this tool comes
the ability to use Soft Selection, an option located in the Soft Selection group, found in
the upper-right corner of the Terrain Editing dialog. Within this group is a check box that
allows you to switch on Automatic soft selection.
The Vertex Editing tool always works with some level of soft selection. The Automatic
check box simply offers you a way to automatically expand a soft selection by clicking a
second area. While Automatic is deactivated, the behavior of vertex selection is as
follows: Ctrl + clicking the surface will allow you to make a selection of vertices, based
on the inner and outer radii of your brush. Vertices that fall within the inner radius of the
brush will receive the strength value found under the Strength percentage. Any selections
that are made after that first will only add individual vertices to the selection.
CAUTION: When adding individual vertices to the Vertex Editing tool, you must be
extremely careful that you do not move the mouse at all as you click subsequent
vertices. The slightest motion will cause UnrealEd to create a new soft selection,
essentially starting you over from square one!
If you activate the Automatic check box for soft selection, any subsequent selections you
make will expand the radius of all previous selection made. For example, if you Ctrl +
click on an area of the terrain, you will have a single soft selection, based on the side of
your inner and outer radii. If you then Ctrl + click an area outside the current selection,
the radius of the original selection will expand to include the second click.
6
After you have made a vertex selection, you can then move the selected vertices either up
or down by holding the Ctrl key and both the left and right mouse buttons, and then
moving the mouse up or down. The motion will be based on the amount of falloff of your
selection. You can see this falloff in the viewport by looking at the color-coded vertices.
White vertices will receive 100% of the motion of the mouse, whereas black vertices
receive virtually none. All shades of grey in between will receive varying levels of
strength, resulting in a softened effect as you move the vertices up and down. This is a
great way to crate perfectly circular hills or pits in your terrain, or to have fluid control
over moving an entire area up or down.
The Select Tool
This tool is primarily used for the Terrain Generator. You will make a squared selection
on your terrain, and the Terrain Generator will rebuild only the terrain within the
selection. If, however, you have the Use Enter HeightMap option checked in the Terrain
Generator, the entire landscape will be rebuilt, regardless of the selection.
Painting
This is the primary tool for height map editing. This is very intuitive tool that allows you
to raise and lower areas of the terrain just by painting the brush across them. Its use is
very simple. Merely select a strength and brush size, and perhaps set you Adjust value for
fine control. As you hold down Ctrl and left-drag across the surface of the terrain, you
will raise the terrain wherever you paint. Dragging with the right mouse button while
holding the Ctrl key will lower the terrain, so that you are creating depressions in the
surface. Remember that it is usually best to leave your strength relatively low, and add
your brush strokes slowly, one atop the other, to create your final terrain. You can also
use the mirror option with this tool to keep your painted strokes symmetrical across a
given axis or axes.
Smoothing
This tool allows you take out any harsh contrast in your height map. This, in effect,
smooths out your terrain by removing harsh edges. This is perfect tool to make your
terrain looks less jagged, especially when adding features such as rolling hills.
Technically, the tool is taking the lowest point average of the gray scale pixel value
within the radius of the brush. You will usually want to strength value to be relatively
low when using this tool, as it is easy to “melt” away the detail that you have been
working on.
Noise
The Noise tool applies a noise value to your height map, which has the effect of creating
patches of “lumpy” areas of terrain. A grayscale noise appears to be a patchy
conglomeration of dark and light areas. When this is added to an existing height map, the
7
result is closely placed group of raised and lowered areas. Use of noise combined with
low-strength smoothing can result in very realistic terrain features.
Flatten
The flatten tool, as its name suggests, allows you to flatten you an area. This is especially
useful for carving roads and other such landmarks out of your terrain. It can also be used
to create plateaus, mesas, and buttes in your terrain. Its use is remarkable simple. Just
move the mouse over an area that is the desired height of your new flattened area, and
then Ctrl +left-drag to paint. All of the terrain within the outer radius of the brush will be
forced flat at the selected elevation.
Visibility
The Visibility tool allows you to show or hide quads of the terrain. This is especially
useful when you need to open holes in your terrain, such as for a cave or bunker-type
building. When a quad is marked as invisible, it will no longer detect collisions with a
player, meaning that a player can fall through it.
Edge Turn
The Edge Turn tool allows you to modify the topology of your terrain by flipping the
triangle edge of a quad. Terrain geometry is composed of a series of four-sided polygons,
or quads, each divided into two right triangles. The direction of the triangle edge
determines how the surface will bend. You can use this tool to flip the triangle edge of
quads in your terrain so that it is deforming properly. It works in a paintbrush fashion,
changing the edge of faces that you paint over.
Applying the Terrain Editing Tools - Shaping Your Own Landscapes
Until now, the only thing we have done to our terrain was to use the Terrain Generator to
give some life to the landscape. Although the generator can be a great way to produce a
starting point, it does not give us the absolute control needed to sculpt the landscape we
need our games, simulations, and so on.
1. You may continue from the end of recent exercise, “Enhancing the Look of our
Terrain by Adding a Skybox”. You will see the terrain and skybox we completed
earlier with the Terrain Generator. We will now rebuild our terrain by hand. To make
the most of our height map, we will push down and pull up detail to create a range of
mountains separating two bases.
2. To begin, we will flatten out the entire terrain. The fastest way to do this is to choose
the Select tool from the list, and then switch over to the Miscellaneous tab. In the
Terrain Generation group, enter a step value of 1, and a Strenght value of 1. Check
Use Entire Heightmap, and click the Build button. Rebuild the lighting when finished
to remove any unwanted shadows.
8
3. We first need to build the outer hills that will prevent the player from seeing the edge
of the terrain. We’re doing this to prevent the player from running off the edge of the
map. Later, you will be able to supplement these hills with blocking volumes, which
are invisible brushes that will behave like walls, preventing the player from getting to
the top o these hills.
4. To start, select the height map in the Terrain layer, and then choose the Painting tool.
Set the following setting for your brush:
Inner Radius: 330
Outer Radius: 684
Strength: 44
Adjust: 32
Mirror: XY
TIP: When finished, you may want to set the Mirror back to None, in order to add some
asymmetry to your map.
We’re setting the Mirror value to XY so that each stroke is copied across the X and Y
axes. This means that you can paint each of the corners of the map, and your strokes will
be mirrored.
We’re going to create a setup that will allow for two bases, one on each corner of the
map. Make sure that Mirror is set to None, and use the Paint tool to create two
depressions at opposite corners of the map.
5. Please select the Flatten tool. Move the brush over one of the lower areas of one of
the depressions. Ctrl + left – drag to flatten the entire depression to that elevation. Be
careful that you do not cut too far into the hills behind the base area.
6. Now, using the Painting tool, create a series of hills and mountains in the middle of
the map. Adjust the inner and outer brush radii as necessary. Remember that if you
keep your brush too small, your hills will be very tight, which will not look natural.
Also, don’t be shy about adjusting the strength. It is almost always better to use
lower-strength strokes and layer your strokes on top of one another.
TIP: You can also choose higher areas around the base, such as the surrounding hills, and
use the Flatten tool to create perfect areas to place turrets.
7. Let’s create some roads for our map to connect one base to the other. We will keep
these relatively small. Use the following setting on the brush for now:
Outer Radius: 102
9
Select the Flatten tool. Move the brush to an area that is just above the level of one of
your bases, and begin using the tool to carve in a road. Lead the road around the fringe of
the level, just inside the surrounding mountains. Pause from time to time create a raised
or lowered area from which to continue to road. This will keep your road from being
perfectly flat from one end to the other.
TIP: While modeling your terrain, try to imagine how you could use your terrain for
areass such as hidden bases, power-up areas, special defense areas, and so no. Also,
watch your geography very closely to make sure that it stays useful. If you want your
characters to be able to climb to the top of a hill, make sure its slope is not too steep or
prevent climbing.
Have fun with this step. Basically, you will need two roads, each connecting one base to
the other. Aside from that, you are free to create your own paths through the hills, or
anything you like. Be careful not to destroy too much of the landscape you’ve created.
8. Switch to the smoothing tool. Set the strength to a relatively low percentage, and
smooth out the areas of sharp cliffs on either side of the roads. You will also want to
smooth out any places where the road changed elevation, in order to create a “ramp”
from one level to the other. While you’re at it, you can also smooth out any areas
around your bases that are a little too sharp.
It could help to switch to a wireframe and see how things are looking. We are trying to
avoid having polygons that are stretched too far.
9. Make any tweaks and adjustments you like until you are satisfied with the look of the
level. When finished, be sure to save your level. You may find it handy to play-test
the level to make sure that areas you create are accessible and will work properly for
your ideas.
Now that our terrain is created and we have a Skybox in place, we can make the
surrounding environment much more interesting by adding a second terrain system into
the skybox in the next exercise.
Adding Terrain to the Skybox
1. Continue from the last exercise, we will now supplement our skybox and add a little
character to our level by creating a second terrain system inside the skybox. This will
produce the illusion that our level is surrounded by vast mountains far out in the distance.
2. Double-click the Search For Actor icon
. In the search line, start typing
SkyZoneInfo until the Actor list is filtered down to the SkyZoneInfo Actor. When you
see it in the list, double click it, and click the Close button.
10
This will select the SkyZoneInfo Actor and move the camera to its position. Open the
properties window. Expand the ZoneInfo category, and set bTerrainZone to True. This
will allow a TerrainInfo Actor to be placed and terrain to visible in the skybox.
3. In the Terrain Editing dialog, go to the Terrain tab and click the New Terrain button. In
the New Terrain dialog, input the following:
Package: myLevel
Group: Heightmaps
Name: HeightMap2
Xsize: 128
Ysize: 128
This will create a new TerrainInfo Actor at the position of the camera, which should be
near the center of the skybox.
4. Right now, the terrain is too big. Open the properties for the new TerrainInfo Actor
that was created in the skybox. Expand the Terrain category, and go to the TerrainScale
property. Set the X and Y values to 32. This should cause the terrain to fit nicely into the
skybox.
5. Using the skills that you have learned, placed the same texture used on the original
terrain onto the new terrain. Rebuild as necessary. When finished, use the height-map
editing tools to pull up some mountains on the outsides of the terrain. Leave the middle
area sunken down like a valley.
6. Move the camera into the main area of the level and press the K to view the skybox.
You should be able to see your new terrain surrounding your level. If necessary, move
the SkyZoneInfo Actor down lower to make the mountain surrounding the level appear
taller. Keep in mind that you may also need to relight the skybox terrain, as it is not affect
by the Sunlight Actor. Also, be aware that if you pull the mountains up so that they cover
any of the light that were in the skybox, those light will no longer be visible, resulting in
a darker sky. To alleviate this problem, reposition the lights as necessary.
7. Test and tweak the result until you are satisfied. Please keep in mind that your skybox
terrain may not be visible from some of the lower areas of your level and save your map.
TerrinaInfo Properties:
bkCollisionHalfRes
DecoLayerOffset
Typically, Karma uses the actual triangles of your terrain as
the collision mesh. Setting this property to True will cause the
number of triangle to be divided by two for the collison mesh,
resulting in simpler (read faster) collisions.
This property will offset your DecoLayer meshes from the
surface of the terrain. If the AlightToTerrain property (found
under DecoLayers) is set to 0, the meshes will simply offset
11
DecoLayer
Inverted
Layers
TerrainMap
TerrainScale
TerrainSectorSize
VertexLightMap
by moving up the number of units specified in the
DecoLayerOffset property. If AlignToTerrain is set to 1, the
meshes will offset in a direction perpendicular to the direction
of the triangle upon which the mesh was placed.
Refer to DecoLayer Properties table
Terrain is viewed from one side only. Setting this property to
true will invert the terrain such that you can only see it if you
were standing below it. This is an excellent way to add in
rocky ceiling as if you were in some sort or natural
underground cavern.
Refer to Layer Properties table
This is the Height Map texture. This is the texture responsible
for determining the altitude of the terrain.
This property allows you to control the three-deminsional
scale of the terrain.
This is mainly used for optimization. As terrain stops
rendering, it will disappear segments at a time. For example,
if you set this to 16, the terrain will be divided into sectors
that are 16 quads by 16 quads.
This allows you to specify your own light map texture for
your terrain.
12