Game Development Reference
In-Depth Information
the size of the projected image increases, just like it did in a real cam-
era. However, inside a computer, the film actually increases by this same
proportion, rather than the view frustum changing in size. Because the
projected image and the film increase by the same proportion, there is no
change to the rendered image or the apparent size of objects within this
image.
In summary, zoom is always accomplished by changing the shape of
the view frustum, whether we're talking about a real camera or inside a
computer. In a real camera, changing the focal length changes the shape
of the view frustum because the film stays the same size. However, in a
computer, adjusting the focal distance d does not affect the rendered image,
since the “film” increases in size and the shape of the view frustum does
not change.
Some software allow the user to specify the field of view by giving a
focal length measured in millimeters. These numbers are in reference to
some standard film size, almost always 35 mm film.
What about orthographic projection? In this case, we do not want to
divide by z, so our clip matrix will have a right-hand column of [0,0,0,1] T ,
the same as the identity matrix. When multiplied by a vector of the
form [x,y,z,1], this will result in a vector with w = 1, rather than w =
z. The homogeneous division still occurs, but this time we are dividing
by 1:
2
4 1
3
0
0
0
5
0
1
0
0
x y z 1
=
x y z 1
=⇒
x y z
.
0
0
1
0
0
0
0
1
The next section fills in the rest of the clip matrix. But for now, the
key point is that a perspective projection matrix will always have a right-
hand column of [0,0,1,0], and a orthographic projection matrix will always
have a right-hand column of [0,0,0,1]. Here, the word “always” means
“we've never seen anything else.” You might come across some obscure
case on some particular hardware for which other values are needed, and it
is important to understand that 1 isn't a magic number here, it is just the
simplest number. Since the homogeneous conversion is a division, what is
important is the ratio of the coordinates, not their magnitude.
Notice that multiplying the entire matrix by a constant factor doesn't
have any effect on the projected values x/w, y/w, and z/w, but it will
adjust the value of w, which is used for perspective correct rasterization.
So a different value might be necessary for some reason. Then again, certain
hardware (such as the Wii) assume that these are the only two cases, and
no other right-hand column is allowed.
Search WWH ::




Custom Search