Game Engine Architecture

(Ben Green) #1

418 10. The Rendering Engine


highly tessellated, per-vertex lighting combined with Gouraud shading can
yield reasonably good results. However, when the triangles are too large, the
errors that arise from linearly interpolating the specular highlight can become
jarringly obvious, as shown in Figure 10.14.
To overcome the limitations of per-vertex surface att ributes, rendering en-
gineers use bitmapped images known as texture maps. A texture oft en contains
color information and is usually projected onto the triangles of a mesh. In this
case, it acts a bit like those silly fake tatt oos we used to apply to our arms when
we were kids. But a texture can contain other kinds of visual surface proper-
ties as well as colors. And a texture needn’t be projected onto a mesh—for
example, a texture might be used as a stand-alone data table. The individual
picture elements of a texture are called texels to diff erentiate them from the
pixels on the screen.
The dimensions of a texture bitmap are constrained to be powers of two
on some graphics hardware. Typical texture dimensions include 256 × 256,
512 × 512, 1024 × 1024, and 2048 × 2048, although textures can be any size on
most hardware, provided the texture fi ts into video memory. Some graph-
ics hardware imposes additional restrictions, such as requiring textures to be
square, or lift s some restrictions, such as not constraining texture dimensions
to be powers of two.

Types of Textures
The most common type of texture is known as a diff use map , or albedo map. It
describes the diff use surface color at each texel on a surface and acts like a de-
cal or paint job on the surface.
Other types of textures are used in computer graphics as well, including
normal maps (which store unit normal vectors at each texel, encoded as RGB
values), gloss maps (which encode how shiny a surface should be at each texel),

Figure 10.14. Linear interpolation of vertex attributes does not always yield an adequate
description of the visual properties of a surface, especially when tessellation is low.
Free download pdf