Graphics Reference
In-Depth Information
y
z
x
Figure 13.7: The standard perspective view volume is the pyramid that ranges from
1 to 1 in x and y, and from 0 to
1 in z. The scale in z is exaggerated.
and similar expressions determine
θ v , the vertical field of view, and the length
of AC :
P = Position
(13.9)
A = P
f w
(13.10)
B = A + f tan θ h
2
u = P + f tan θ h
2
u
f w
(13.11)
C = A + f v = P + f tan θ v
2
v
f w .
(13.12)
Notice that the near-plane distance n has not entered into our computations
yet.
We now use the four points P , A , B , and C to transform the view frustum to
the standard view frustum shown in Figure 13.7, and known as the standard per-
spective view volume.
All we need to do is say where the four points should be sent. We want to send
P to the origin, A to the midpoint of the back face, which is ( 0, 0,
1 ) , B to the
mid-right edge of the back face, which is ( 1, 0,
1 ) , and C to the mid-top edge,
which is ( 0, 1,
1 ) . The matrix that performs this transformation is denoted M per
(for “perspective”), so we'll call the associated transformation Tper . The code that
creates our transformation is
1
2
3
4
Transform3 Tper =
Transform3.PointsToPoints(
P , A , B , C ,
Point3(0, 0, 0), Point3(0, 0, -1)), Point3(1, 0, -1), Point3(0, 1, -1));
Under this transformation, points of the far plane are transformed to the
z =
1 plane. Since distances along the ray from P to A must transform linearly,
points of the near plane are transformed to the plane z =
n / f . We're nearly done
at this point: We've transformed the view volume to a standard view volume, and
from this point onward, almost everything we'll do is independent of the camera
parameters, the exception being that the ratio
n
/
f will enter into some of our
computations.
 
 
Search WWH ::




Custom Search