i
i
i
i
i
i
i
i
Chapter 6
Texturing
“All it takes is for the rendered image to look right.”
—Jim Blinn
A surface’s texture is its look and feel—just think of the texture of an oil
painting. In computer graphics, texturing is a process that takes a surface
and modifies its appearance at each location using some image, function,
or other data source. As an example, instead of precisely representing the
geometry of a brick wall, a color image of a brick wall is applied to a single
polygon. When the polygon is viewed, the color image appears where the
polygon is located. Unless the viewer gets close to the wall, the lack of
geometric detail (e.g., the fact that the image of bricks and mortar is on a
smooth surface) will not be noticeable. Color image texturing also provides
a way to use photographic images and animations on surfaces.
However, some textured brick walls can be unconvincing for reasons
other than lack of geometry. For example, if the mortar is supposed to be
glossy, whereas the bricks are matte, the viewer will notice that the gloss is
the same for both materials. To produce a more convincing experience, a
second image texture can be applied to the surface. Instead of changing the
surface’s color, this texture changes the wall’s gloss, depending on location
on the surface. Now the bricks have a color from the color image texture
and a gloss value from this new texture.
Once the gloss texture has been applied, however, the viewer may notice
that now all the bricks are glossy and the mortar is not, but each brick
face appears to be flat. This does not look right, as bricks normally have
some irregularity to their surfaces. By applying bump mapping,thesurface
normals of the bricks may be varied so that when they are rendered, they
do not appear to be perfectly smooth. This sort of texture wobbles the
direction of the polygon’s original surface normal for purposes of computing
lighting.
From a shallow viewing angle, this illusion of bumpiness can break
down. The bricks should stick out above the mortar, obscuring it from
view. Even from a straight-on view, the bricks should cast shadows onto
147
i
i
i
i
i
i
i
i
148 6. Texturing
Figure 6.1. Texturing. Color, bump, and parallax occlusion texture mapping methods
are used to add complexity and realism to a scene. (Image from “Toyshop” demo
courtesy of Natalya Tatarchuk, ATI Research, Inc.)
the mortar. Parallax and relief mapping use a texture to appear to deform
a flat surface when rendering it. Displacement mapping actually displaces
the surface, creating triangles between the texels. Figure 6.1 shows an
example.
These are examples of the types of problems that can be solved with
textures, using more and more elaborate algorithms. In this chapter, tex-
turing techniques are covered in detail. First, a general framework of the
texturing process is presented. Next, we focus on using images to texture
surfaces, since this is the most popular form of texturing used in real-time
work. Procedural textures are briefly discussed, and then some common
methods of getting textures to affect the surface are explained.
6.1 The Texturing Pipeline
Texturing, at its simplest, is a technique for efficiently modeling the sur-
face’s properties. One way to approach texturing is to think about what
happens for a single shaded pixel. As seen in the previous chapter, the
color is computed by taking into account the lighting and the material, as
well as the viewer’s position. If present, transparency also affects the sam-

Get Real-Time Rendering, Third Edition, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.