Reader small image

You're reading from  Grome Terrain Modeling with Ogre3D, UDK, and Unity3D

Product typeBook
Published inFeb 2013
Reading LevelIntermediate
Publisher
ISBN-139781849699396
Edition1st Edition
Languages
Right arrow
Author (1)
Richard A. Hawley
Richard A. Hawley
author image
Richard A. Hawley

Richard Hawley started programming in the early 1980s at the start of the home computer craze with the Sinclair ZX-81. Before leaving high school he had worked on three game projects for Assassin Software and later worked on conversions of classic strategy board games for 8- to 16-bit machines. He went on to develop end-user tools for popular flight simulations including Empire Interactives Enemy Engaged helicopter series and the highly successful Origin Janes Longbow series (MissioneerPlus). Hes the director of Tricubic Studios, a small UK company dedicated to creating simulation and training environments using off-the-shelf 3D engines including Unity and Leadwerks. Together with technical artist David Hopkinson (Total War: English Civil War conversion) and physics guru Fred Naar (creator of Helicopter Total Realism for Microsoft Flight Simulator X) they are collectively known for their work on helicopter simulations.
Read more about Richard A. Hawley

Right arrow

Chapter 6. Water, Rivers, and Roads

Now we come to add landmarks to our terrain. From a player's perspective, rivers and roads are easy to follow, they guide us between places of interest. They provide barriers to different zones and give us something pretty to look at.

Water is one of those elements highly dependent on the quality of textures and shaders used. In older game engines, water was a simple 3D plane (or quad) with a reflective surface and maybe an animated normal map to simulate surface movement. Game engines such as Unity use this simple water plane technique. UDK features an actor that's capable of sophisticated physics-based water interaction; drop an object into UDK water and it sends dynamic ripples across the surface. UDK even does water refraction but these effects do come at a price. GROME is more like Unity, it uses a simple plane on which an animated material is applied. The basic water material has some nice options to adjust the color, opacity, and reflectivity of...

Water layers


A water layer contains information about a water surface such as height level, texture, tiling, reflection, speed of waves, and so on.

Water is a simple plane object that fits the assigned zone, positioned at a height specified in the "level" parameter. By changing the "level" we can move the water plane up and down, intersecting the terrain.

Note

A plane is a 2D surface. The simplest is a quad made up of two triangles.

Sometimes in 3D engines that use water planes, ugly z-fighting artifacts are visible in areas where the ground geometry intersects the water plane, usually in the middle. This effect is more visible the higher the viewer is relative to the plane.

Terrain geometry close to the water plane is near coplanar (lying in the same plane), as a result of mathematical inaccuracies this can cause parts of the z-buffer to "fight" for dominance.

Note

The z-buffer is an offscreen area which stores the depth of each generated onscreen pixel. Almost every 3D system uses one.

Z-fighting...

Water toolset


As with other tools, they are split into Brush and Procedural groups. Both feature methods to paint the water mask. The waterBrush tool is useful for touching up small areas as required. The Brush tool paints directly to the coverage mask on the water plane. But generally we will make good use of the "water generator" tool.

Generator tool

First button in the Procedural toolset is Generator which creates the water mask based on terrain height. Very simple to use, the only parameter we might want to adjust is Depth attenuation. This is how far in world units we want to see under the water plane. This is used to feather shoreline transparency.

The following is an image of a mask for a single zone, the dark areas are hidden. On the right-hand side is a 3D view of a zone where terrain has been flattened so that we can see the mask resolution along the shoreline.

If the resolution of the mask is too low (or high), hit the Resampler button and set the resolution you want (remember to...

Creating rivers


Presently, there's no tool to create rivers or water bodies that flow downhill but there are a few methods we can use.

One approach is to use a plane, then switch to a heightmap brush. Using the brush we paint the path of the river, lowering the terrain below the water plane. This is simple and very much hands on.

An alternative is to use a selection, this is great if we have some real-world reference or diagram to use. Mark out the area of the river using a selection mask. Then use selection filters such as blur, extend, and smooth to give the area a more organic feel. Then, with the mask active, we apply the elevation tool to lower the terrain below the water line.

There are different ways you can work in river features and I strongly encourage experimentation.

Creating a small stepped river feature

One approach is to have a stepped river and use multiple water layers. These can be visually connected by using a waterfall effect in Unity or UDK. GROME doesn't yet have particle...

Roads


These are sometimes and perhaps more accurately described as "spline" objects. Splines are curves defined by a set of control points.

Generally, these objects are difficult to export to other game engines. The COLLADA file exporter can save roads as 3D models, saving the triangulated mesh as model sections. The GROME plugin SDK exposes all necessary functions to get at them. Because we can't easily export spline objects as roads or models to other game engines, all we can do is quickly cover how to use them in GROME but we won't be using them later except as a guide for painting.

To find the Road tool we need to click on the World tab on the toolbar panel. Currently there's only one set of tools (Roads), the options are shown in the following screenshot:

World Editor projects are self-contained and can be used without a terrain surface. But when working with terrain surfaces GROME provides special layers for linking roads to the ground.

Create tool

Before we can create a road there's one...

Summary


In this chapter, we used the water toolset to create a simple water plane, mask, and shoreline. We also touched upon using several water planes to create multilevel water effects like the previous one. Then we explored the road tools, creating spline objects and using them as a terrain modifier.

In the final chapter, we export the terrain into three different 3D engines: Unity, Unreal Development Kit, and Ogre3D. Prepare for the final chapter, this is game development where some assembly is required and batteries are never included.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Grome Terrain Modeling with Ogre3D, UDK, and Unity3D
Published in: Feb 2013Publisher: ISBN-13: 9781849699396
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Richard A. Hawley

Richard Hawley started programming in the early 1980s at the start of the home computer craze with the Sinclair ZX-81. Before leaving high school he had worked on three game projects for Assassin Software and later worked on conversions of classic strategy board games for 8- to 16-bit machines. He went on to develop end-user tools for popular flight simulations including Empire Interactives Enemy Engaged helicopter series and the highly successful Origin Janes Longbow series (MissioneerPlus). Hes the director of Tricubic Studios, a small UK company dedicated to creating simulation and training environments using off-the-shelf 3D engines including Unity and Leadwerks. Together with technical artist David Hopkinson (Total War: English Civil War conversion) and physics guru Fred Naar (creator of Helicopter Total Realism for Microsoft Flight Simulator X) they are collectively known for their work on helicopter simulations.
Read more about Richard A. Hawley