i
i
i
i
i
i
i
i
4.6. Projections 95
The field of view is an important factor in providing a sense of the scene.
The eye itself has a physical field of view compared to the computer screen.
This relationship is
φ = 2 arctan(w/(2d)), (4.67)
where φ is the field of view, w is the width of the object perpendicular
to the line of sight, and d is the distance to the object. For example,
a 21-inch monitor is about 16 inches wide, and 25 inches is a minimum
recommended viewing distance [27], which yields a physical field of view
of 35 degrees. At 12 inches away, the field of view is 67 degrees; at 18
inches, it is 48 degrees; at 30 inches, 30 degrees. This same formula can
be used to convert from camera lens size to field of view, e.g., a standard
50mm lens for a 35mm camera (which has a 36mm wide frame size) gives
φ = 2 arctan(36/(2 ∗ 50)) = 39.6 degrees.
Using a narrower field of view compared to the physical setup will lessen
the perspective effect, as the viewer will be zoomed in on the scene. Setting
a wider field of view will make objects appear distorted (like using a wide
angle camera lens), especially near the screen’s edges, and will exaggerate
the scale of nearby objects. However, a wider field of view gives the viewer
a sense that objects are larger and more impressive, and has the advantage
of giving the user more information about the surroundings.
The perspective transform matrix that transforms the frustum into a
unit cube is given by Equation 4.68:
16
P
p
=
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎝
2n
r − l
0 −
r + l
r − l
0
0
2n
t − b
−
t + b
t − b
0
00
f + n
f − n
−
2fn
f − n
00 1 0
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎠
. (4.68)
After applying this transform to a point, we will get another point q =
(q
x
,q
y
,q
z
,q
w
)
T
.Thew-component, q
w
, of this point will (most often) be
nonzero and not equal to one. To get the projected point, p, we need to
divide by q
w
: p =(q
x
/q
w
,q
y
/q
w
,q
z
/q
w
, 1)
T
.ThematrixP
p
always sees
to it that z = f maps to +1 and z = n maps to −1. After the perspective
transform is performed, clipping and homogenization (division by w)is
done to obtain the normalized device coordinates.
To get the perspective transform used in OpenGL, first multiply with
S(1, 1, −1), for the same reasons as for the orthographic transform. This
simply negates the values in the third column of Equation 4.68. After
this mirroring transform has been applied, the near and far values are
16
The far plane can also be set to infinity. See Equation 9.8 on page 345 for this form.