Graphics Reference
In-Depth Information
the eye position p e . Intuitively, this is exactly the inverse of M w 2 e .Inthisway,
M e 2 w
=
M eb 2 wb T
(
x e ,
y e ,
z e )
x w
y w
z w
0
1000
0100
0010
x e
x u
y u
z u
0
=
x v
y v
z v
0
(14.6)
0
0
0
1
y e
z e
1
.
x w
y w
z w
0
x u
y u
z u
0
=
x v
y v
z v
0
x e
y e
z e
1
Interestingly, in the EC-to-WC transformation matrix, the original axis directions
( w , u ,and v ) are organized as the row vectors in the corresponding x , y ,and z
rows. The eye position is also neatly encoded in the fourth row of the matrix.
This information will become important when we need to transform mouse clicks
back to WC space (to be discussed in Section 15.4).
14.6
The Projection Transform: EC to NDC
This is the third and final stage of the transformation pipeline where vertices are
transformed from EC to NDC space. Let's first review the NDC space. In 3D
space, the NDC is defined to be
1
x
+
1
,
NDC range
=
1
y
+
1
,
1
z
+
1
.
As discussed in Section 10.2, NDC is a well-known coordinate space where the
±
1 range is convenient for performing further transformations. Most modern
graphics APIs expect output from the transformation pipeline to be in the NDC
space. In this way, the APIs can clip to eliminate all vertices that are outside of the
NDC range and convert all primitives inside the NDC range into the application
drawing area.
As illustrated in Figure 14.20, the projection transform scales the view frus-
tum into a rectangular cube. Notice that in this transformation, the x / y and z values
of vertices are treated differently. The z value of vertices is scaled proportionally
from the length far
.
near to 1
0, or
1
.
0
z ndc =
near .
z ec
far
Search WWH ::




Custom Search