417
In order to determine how a ray of light will refl ect from a point on a sur-
face, most lighting models make use of a vector that is normal to the surface at
the point of the light ray’s impact. Since we’re performing lighting calculations
on a per-vertex basis, we can use the vertex normal ni for this purpose. There-
fore, the directions of a mesh’s vertex normals can have a signifi cant impact on
the fi nal appearance of a mesh.
As an example, consider a tall, thin, four-sided box. If we want the box
to appear to be sharp-edged, we can specify the vertex normals to be perpen-
dicular to the faces of the box. As we light each triangle, we will encounter the
same normal vector at all three vertices, so the resulting lighting will appear
fl at, and it will abruptly change at the corners of the box just as the vertex
normals do.
We can also make the same box mesh look a bit like a smooth cylinder by
specifying vertex normals that point radially outward from the box’s center
line. In this case, the vertices of each triangle will have diff erent vertex nor-
mals, causing us to calculate diff erent colors at each vertex. Gouraud shading
will smoothly interpolate these vertex colors, resulting in lighting that appears
to vary smoothly across the surface. This eff ect is illustrated in Figure 10.13.
Figure 10.13. The directions of a mesh’s vertex normals can have a profound effect on the
colors calculated during per-vertex lighting calculations.
10.1.2.5. Textures
When triangles are relatively large, specifying surface properties on a per-ver-
tex basis can be too coarse-grained. Linear att ribute interpolation isn’t always
what we want, and it can lead to undesirable visual anomalies.
As an example, consider the problem of rendering the bright specular
highlight that can occur when light shines on a glossy object. If the mesh is
10.1. Foundations of Depth-Buffered Triangle Rasterization