Game Development Reference

In-Depth Information

w

P

=

xyzw

,,,

P

P

w
=

1

y

x

Figure 4.5.
A 4D point
P
is projected into three-dimensional space by calculating the

point where the line connecting the point to the origin intersects the space where

w

=

1

.

ourselves to 3

matrices in this section since tangent and normal directions are

unaffected by translations.) Some care must be taken when transforming normal

vectors, however. Figure 4.6 shows what can happen when a nonorthogonal ma-

trix
M
is used to transform a normal vector. The transformed normal can often

end up pointing in a direction that is not perpendicular to the transformed surface.

Since tangents and normals are perpendicular, the tangent vector
T
and the

normal vector
N
associated with a vertex must satisfy the equation

×

3

N T
. We

must also require that this equation be satisfied by the transformed tangent vector

′

⋅

=

0

T
and the transformed normal vector

N
. Given a transformation matrix
M
, we

′

know that

TMT
. We would like to find the transformation matrix
G
with

which the vector
N
should be transformed so that

′ =

′

′

(

) (

)

N

⋅

T NMT
.

=

⋅

=

0

(4.30)

A little algebraic manipulation gives us

Search Nedrilad ::

Custom Search