Game Development Reference
In-Depth Information
, as illustrated in Figure 10.3 , we would have
the common case. It suces to locate the triangle strip, remove its triangles to form
a simple polygon, and retriangulate that polygon so that it includes the road edge.
Figure10.4 showstheresultswhentheroadedgeis
If the road edge had been
V 0 ,P
. The retriangulation
generates an upper polygon and a lower polygon, both polygons sharing the edge
V 0 ,P
V 0 ,P
.
In practice, we have no such luck in always having the common case. Sometimes,
the road edge contains an interior point that is also a vertex in the Delaunay
triangulation, for example, the point
in Figure 10.3 . It is even possible that the
road edge overlaps an entire edge of the Delaunay triangulation, for example, the
edge
P
in Figure 10.3 . Handling these special cases requires quite a large amount
of programming.
E
10.3.2 Inherited Texture Coordinates
The output of the edge-insertion phase is a set of ordered edges . Most of these edges
are the original road edges, but some of them are road subedges obtained when
coincident vertices and coincident edges are encountered during the insertion. The
edges are ordered in the following sense. The
-domain of the road is a simple
polygon, which is the union of the triangles that form the road's triangle strip. This
polygon is ordered counterclockwise to an observer looking down on the road (in
the negative
xy
-direction).
The output edges still form the boundary of a simple polygon with counter-
clockwise ordering, although the polygon no longer represents a triangle strip. We
may iterate over all
z
-vertices in the Delaunay triangulation and apply point-in-
polygon tests. Any vertices inside the road polygon are “inherited” by the road.
The vertex positions remain the same, and the texture coordinates are implicitly
the
xy
1] 2 ). But now, the texture coor-
dinates must be replaced with ones that make sense for the road. Each such terrain
vertex that is now a road vertex lives in one of the triangles of the original road's
triangle strip. It suces to locate the triangle of the strip that contains that vertex,
compute the barycentric coordinates of the vertex relative to that triangle, and use
these coordinates to compute a weighted sum of the texture coordinates that the
artists have assigned to the triangle in the strip. As long as the road does not have
an extremely large turn, there are no noticeable artifacts from selecting the texture
coordinates in this manner.
xy
-values of the vertex positions (scaled to [0
,
10.3.3 Dealing with Malformed Roads
Each road was built from a central spline curve. The modeling package provided
the artists with the ability to modify the density of the quads along the spline.
When the density was larger at spline points of large curvature (at sharp turns in
the road) than along relatively straight sections of the curve, sometimes the quads
Search WWH ::




Custom Search