i
i
i
i
i
i
i
i
198 6. Texturing
mapping, as the expanded mesh forms a separate shell over the original
model. By preserving the nonlinear nature of prisms when intersecting
them with rays, artifact-free rendering of heightfields becomes possible,
though expensive to compute.
To conclude, an impressive use of this type of technique is shown in
Figure 6.36.
6.7.5 Heightfield Texturing
One obvious method of rendering bumps is to model the bumps as true
geometry, in a very fine mesh. A space-efficient alternative is to use the
vertex texture fetch feature (introduced in Shader Model 3.0) to have a
flat meshed polygon access a heightfield texture. The height retrieved from
the texture is used by the vertex shading program to modify the vertex’s
location. This method is usually called displacement mapping,andthe
heightfield is therefore called a displacement texture in this context. Us-
ing a texture allows for faster manipulation of data for wave simulations
and other animations to apply to the mesh. These techniques can be ex-
pensive in both memory and in processing power, as each vertex in the
mesh requires three additional floating-point numbers, all of which must
be accessed (the less memory touched, the better). For large expanses
(e.g., terrain or ocean rendering [703]), where level of detail techniques can
be brought to bear to keep complexity down, such an approach can be
suitable. See Section 12.5.2. With the evolution of GPUs towards unified
shaders
14
and performing tessellation on the fly, the scale appears to be
tipping towards this being the preferred method in general. It is simple
to program and on newer GPUs has few drawbacks. We consider it likely
that this will be the preferred method once the minimum GPU required
for an application supports fast vertex texture access. Szirmay-Kalos and
Umenhoffer [1235] have an excellent, thorough survey of relief mapping and
displacement methods.
While relief and displacement mapping offer additional realism at a
generally reasonable cost, these techniques do have some drawbacks. The
fact that the base surface is unperturbed makes collision detection, and
therefore object interaction, more challenging. For example, if a displace-
ment map is used to model a rock protruding out of the ground, it will
be additional work to have a character’s foot properly stop at the correct
height at this location. Instead of a simple test against a mesh, the mesh
height will also need to be accessed.
Other surfaces than simple quadrilaterals can use displacement map-
ping. Its use with subdivision surfaces is discussed in Section 13.5.6. In
14
The original vertex texture fetch was slow compared to the pixel shader’s. With
unified shaders there is no difference.