Game Engine Architecture

(Ben Green) #1

402 10. The Rendering Engine


of transparent and translucent objects in almost the same way opaque objects
are rendered. A simple numeric opacity measure known as alpha is used to
describe how opaque or transparent a surface is. This approach can lead to
various visual anomalies (for example, surface features on the far side of the
object may be rendered incorrectly), but the approximation can be made to
look reasonably realistic in many cases. Even amorphous objects like clouds
of smoke are oft en represented using particle eff ects, which are typically com-
posed of large numbers of semi-transparent rectangular cards. Therefore, it’s
safe to say that most game rendering engines are primarily concerned with
rendering surfaces.

10.1.1.1. Representations Used by High-End Rendering Packages

Theoretically, a surface is a two-dimensional sheet comprised of an infi nite
number of points in three-dimensional space. However, such a description is
clearly not practical. In order for a computer to process and render arbitrary
surfaces, we need a compact way to represent them numerically.
Some surfaces can be described exactly in analytical form, using a para-
metric surface equation. For example, a sphere centered at the origin can be rep-
resented by the equation x^2 + y^2 + z^2 = r^2. However, parametric equations aren’t
particularly useful for modeling arbitrary shapes.
In the fi lm industry, surfaces are oft en represented by a collection of rect-
angular patches each formed from a two-dimensional spline defi ned by a small
number of control points. Various kinds of splines are used, including Bézi-
er surfaces (e.g., bicubic patches , which are third-order Béziers —see htt p://
en.wikipedia.org/wiki/Bezier_surface for more information), nonuniform
rational B-splines (NURBS—see htt p://en.wikipedia.org/wiki/Nurbs), Bézi-
er triangles, and N-patches (also known as normal patches—see htt p://www.
gamasutra.com/features/20020715/mollerhaines_01.htm for more details).
Modeling with patches is a bit like covering a statue with litt le rectangles of
cloth or paper maché.
High-end fi lm rendering engines like Pixar’s RenderMan use subdivision
surfaces to defi ne geometric shapes. Each surface is represented by a mesh of
control polygons (much like a spline), but the polygons can be subdivided
into smaller and smaller polygons using the Catmull-Clark algorithm. This
subdivision typically proceeds until the individual polygons are smaller than
a single pixel in size. The biggest benefi t of this approach is that no matt er
how close the camera gets to the surface, it can always be subdivided further
so that its silhouett e edges won’t look faceted. To learn more about subdivi-
sion surfaces, check out the following great article on Gamasutra: htt p://www.
gamasutra.com/features/20000411/sharp_pfv.htm.
Free download pdf