Game Development Reference
In-Depth Information
Figure 10.15
Transforming normals with nonuniform scale. The light red vectors show the normals multiplied by the
same transform matrix used to transform the object; the dark red vectors are their normalized versions.
The light blue vectors show the correct normals.
part of the discussion. Normals and other types of gradients, known as dual
vectors, do not behave like this.
Imagine that we stretch a 2D object, such as a circle, horizontally, as
shown in Figure 10.15. Notice that the normals (shown in light blue in the
right figure) begin to turn to point more vertically—the horizontal coordi-
nates of the normals are decreasing in absolute value while the horizontal
coordinates of the positions are increasing. A stretching of the object (ob-
ject getting bigger while coordinate space stays the same) has the same
effect as scaling down the coordinate space while holding the object at the
same size. The coordinates of the normal change in the same direction as
the scale of the coordinate space, which is why they are called covariant
vectors.
To properly transform surface normals, we must use the inverse trans-
pose of the matrix used to transform positions; that is, the result of trans-
posing and inverting the matrix. This is sometimes denoted M
−T , since it
−1 . If
the transform matrix doesn't contain any scale (or skew), then the matrix
is orthonormal, and thus the inverse transpose is simply the same as the
original matrix, and we can safely transform normals with this transform.
If the matrix contains uniform scale, then we can still ignore this, but we
must renormalize the normals after transforming them. If the matrix con-
tains nonuniform scale (or skew, which is indistinguishable from nonuniform
scale combined with rotation), then to properly transform the normals, we
must use the inverse transpose transform matrix, and then re-normalize the
resulting transformed normals.
−1 ) T = ( M T )
doesn't matter if we transpose first, or invert first: ( M
Search WWH ::




Custom Search