Game Development Reference
In-Depth Information
10.3.2
Clip Space and the Clip Matrix
From camera space, vertices are transformed once again into clip space, also
known as the canonical view volume space. The matrix that transforms
vertices from camera space into clip space is called the clip matrix, also
known as the projection matrix.
Up until now, our vertex positions have been “pure” 3D vectors—that
is, they only had three coordinates, or if they have a fourth coordinate, then
w was always equal to 1 for position vectors and 0 for direction vectors such
as surface normals. (In some special situations, we might use more exotic
transforms, but most basic transforms are 3D a ne transformations.) The
clip matrix, however, puts meaningful information into w. The clip matrix
serves two primary functions:
Prepare for projection. We put the proper value into w so that the
homogeneous division produces the desired projection. For the typical
perspective projection, this means we copy z into w. We talk about
this in Section 10.3.3.
Apply zoom and prepare for clipping. We scale x, y, and z so that
they can be compared against w for clipping. This scaling takes
the camera's zoom values into consideration, since those zoom values
affect the shape of the view frustum against which clipping occurs.
This is discussed in Section 10.3.4.
10.3.3 The Clip Matrix: Preparing for Projection
Recall from Section 6.4.1 that a 4D homogeneous vector is mapped to the
corresponding physical 3D vector by dividing by w:
2
4 x
3
5
2
3
Converting 4D
homogeneous
coordinates to 3D
x/w
y/w
z/w
y
z
w
4
5
=⇒
.
The first goal of the clip matrix is to get the correct value into w such that
this division causes the desired projection (perspective or orthographic).
That's the reason this matrix is sometimes called the projection matrix,
although this term is a bit misleading—the projection doesn't take place
during the multiplication by this matrix, it happens when we divide x, y,
and z by w.
If this was the only purpose of the clip matrix, to place the correct
value into w, the clip matrix for perspective projection would simply be
 
Search WWH ::




Custom Search