Game Development Reference
In-Depth Information
would overlap in the height direction. I watched the artists adjust the density,
and it was never apparent that there was overlap. I discovered the overlap only
after several assertions in the terrain tool were triggered due to the consequences
of overlap.
The amount of overlap was never large, so I modified the terrain tool to prepro-
cess each road, verifying that the quads/triangles formed a height field. They did
not when small needle-like triangles were misoriented (normals pointing downward
instead of upward). The tool would then slightly perturb vertices of those triangles
to undo the overlap.
10.4 Variations in the Content Pipeline
The discussion in this chapter was focused on roads built as quad strips that have
the topology of a rectangle—the strip is a sequence of quads, each quad is decom-
posed into two triangles, and there is a starting edge and a final edge. The actual
game had a need for variations in the tool, and the level artists had ways of taking
the best-written tool and finding every bug possible.
10.4.1 Iteration of the Tool
Although the original design was to decimate 16-bit height images and stitch in
lofted roads, it was only natural that after this first pass the decimated-and-stitched
terrain be saved to a file to allow the level artists to load it later and manipulate
it. Once happy with the quality of the decimated height field, the level artists
would design new roads to be stitched into the terrain. The terrain tool had to be
modified to load an already decimated terrain and a separate collection of roads
to be stitched into that terrain. The bookkeeping is significant, and the addition
of new roads kept me busy fixing bugs in the tool, several of them generated by
floating-point round-off errors when the new road vertices were significantly close
to the vertices of the original decimated terrain.
10.4.2 Closed-Loop Roads
The obvious variation is that many of the racing tracks were closed loops represented
as quad strips that have the topology of an annulus. This presents a dicult
challenge. The level artists build such roads to have the topology of a rectangle
so that texture coordinates may be chosen to obtain a repeating texture along the
road with the correct wraparound at the shared edge corresponding to the starting
and final edges.
The triangulation is modified to accomodate the starting edge. However, in-
serting the final edge is a no-operation because it already exists in the modified
triangulation. Instead, some bookkeeping was necessary for those vertices and
shared edges. Each vertex that is on the boundary between the terrain and road
Search WWH ::




Custom Search