Game Development Reference

In-Depth Information

The X and Y members of the viewport are almost always 0, so we can go one step

further and come up with the following equations. The projection window also

coincides with the plane where Z = 1, so we can now set the Z component of the

3D coordinate we are trying to calculate.

There is one last factor that must be considered to correctly solve for
W
. Different

fields of view can be used to present a scene, and the projection matrix scales the

points on the projection window to simulate these fields of view. To reclaim the

original values before scaling occurs, we must transform the points by the inverse

of the scaling operations. The variable
projection
will be used to signify the pro-

jection matrix, and the subscripts represent the matrix entries. Entries 00 and 11

of a transformation matrix scale the X and Y values, so we can produce the fol-

lowing equations.

Note

The Managed Direct3D Matrix object uses a slightly different numbering convention for row and

column entries. The properties M11 and M22 represent the 00 and 11, respectively.