i
i
i
i
i
i
i
i
64 4. Transforms
described in Section A.3.1. The adjoint is always guaranteed to exist. The
normal is not guaranteed to be of unit length after being transformed, so
typically needs to be normalized.
The traditional answer for transforming the normal is that the transpose
of the inverse is computed [1277]. This method normally works. The full
inverse is not necessary, however, and occasionally cannot be created. The
inverse is the adjoint divided by the original matrix’s determinant. If this
determinant is zero, the matrix is singular, and the inverse does not exist.
Even computing just the adjoint for a full 4×4 matrix can be expensive,
and is usually not necessary. Since the normal is a vector, translation will
not affect it. Furthermore, most modeling transforms are affine. They do
not change the w component of the homogeneous coordinate passed in, i.e.,
they do not perform projection. Under these (common) circumstances, all
that is needed for normal transformation is to compute the adjoint of the
upper-left 3 × 3components.
Often even this adjoint computation is not needed. Say we know the
transform matrix is composed entirely of a concatenation of translations,
rotations, and uniform scaling operations (no stretching or squashing).
Translations do not affect the normal. The uniform scaling factors sim-
ply change the length of the normal. What is left is a series of rotations,
which always yields a net rotation of some sort, nothing more. A rotation
matrix is defined by the fact that its transpose is its inverse. The transpose
of the inverse can be used to transform normals, and two transposes (or two
inverses) cancel each other out. Put together, the result is that the original
transform itself can also be used directly to transform normals under these
circumstances.
Finally, fully renormalizing the normal produced is not always neces-
sary. If only translations and rotations are concatenated together, the
normal will not change length when transformed by the matrix, so no
renormalizing is needed. If uniform scalings are also concatenated, the
overall scale factor (if known, or extracted—Section 4.2.3) can be used to
directly normalize the normals produced. For example, if we know that a
series of scalings were applied that makes the object 5.2 times larger, then
normals transformed directly by this matrix are renormalized by dividing
them by 5.2. Alternately, to create a normal transform matrix that would
produce normalized results, the original matrix’s 3 × 3 upper-left could be
divided by this scale factor once.
Note that normal transforms are not an issue in systems where, after
transformation, the surface normal is derived from the triangle (e.g., using
the cross product of the triangle’s edges). Tangent vectors are different
than normals in nature, and are always directly transformed by the original
matrix.