Recall that the bump map normal is formed by
. Assume that the surface
is coincident
with the
plane and that changes in
and
correspond to changes
in
and
, respectively. Then
can be substituted for
,
resulting in the following expression for the vector
:
In order to evaluate the lighting equation, must be normalized.
If the displacements in the bump map are restricted to small values,
however, the length of
will be so close to one as to be
approximated by one. Then
itself can be substituted for
without normalization. If the diffuse intensity component
of the lighting equation is evaluated with the
value presented above for
, the result is the following:
This expression requires the surface to lie in the plane and that
the
and
parameters change in
and
, respectively. Most
surfaces, however, will have arbitrary locations and orientations in space.
In order to use this simplification to perform bump mapping, the
view direction
, and
light source direction
are transformed into tangent space.
Tangent space has 3 axes, ,
and
.
The tangent vector,
, is parallel to the direction of
increasing
on the surface. The normal vector,
,
is perpendicular to the surface. The binormal,
,
is perpendicular to both
and
, and like
, lies in the plane tangent to the surface. These vectors
form a coordinate system that is attached to and varies over the surface.
The light source is transformed into tangent space at each vertex of the
polygon. To find the tangent space vectors at a vertex, use the vertex
normal for and find the tangent axis
by finding
the vector direction of increasing
in the object's coordinate
system. The direction of increasing
may also be used.
Find
by computing the cross product of
and
. These unit vectors form the transformation shown below:
This transformation brings coordinates into tangent space, where the
plane tangent to the surface lies in the plane, and the normal to
the surface coincides with the
axis. Note that the
tangent space transformation varies for vertices representing
a curved surface, and so this technique makes the approximation that
curved surfaces are flat and the tangent space transformation is
interpolated from vertex to vertex.