403
10.1.1.2. Triangle Meshes
Game developers have traditionally modeled their surfaces using triangle
meshes. Triangles serve as a piece-wise linear approximation to a surface,
much as a chain of connected line segments acts as a piece-wise approxima-
tion to a function or curve (see Figure 10.2).
Triangles are the polygon of choice for real-time rendering because they
have the following desirable properties:
z The triangle is the simplest type of polygon. Any fewer than three vertices,
and we wouldn’t have a surface at all.
z A triangle is always planar. Any polygon with four or more vertices need
not have this property, because while the fi rst three vertices defi ne a
plane, the fourth vertex might lie above or below that plane.
z Triangles remain triangles under most kinds of transformations, including
affi ne transforms and perspective projections. At worst, a triangle viewed
edge-on will degenerate into a line segment. At every other orientation,
it remains triangular.
z Virtually all commercial graphics-acceleration hardware is designed around
triangle rasterization. Starting with the earliest 3D graphics accelerators
for the PC, rendering hardware has been designed almost exclusively
around triangle rasterization. This decision can be traced all the way
back to the fi rst soft ware rasterizers used in the earliest 3D games like
Castle Wolfenstein 3D and Doom. Like it or not, triangle-based technolo-
gies are entrenched in our industry and probably will be for years to
come.
Tessellation
The term tessellation describes a process of dividing a surface up into a collec-
tion of discrete polygons (which are usually either quadrilaterals, also known
as quads, or triangles). Triangulation is tessellation of a surface into triangles.
One problem with the kind of triangle mesh used in games is that its level
of tessellation is fi xed by the artist when he or she creates it. Fixed tessellation
Figure 10.2. A mesh of
triangles is a linear ap-
proximation to a sur-
face, just as a series of
connected line seg-
ments can serve as a
linear approximation to
a function or curve.
x
f(x)
Figure 10.3. Fixed tessellation can cause an object’s silhouette edges to look blocky, especially
when the object is close to the camera.
10.1. Foundations of Depth-Buffered Triangle Rasterization