Graphics Reference
In-Depth Information
coordinates are denoted with subscript
p
. The following equations are used:
(3.2)
(3.3)
The result of Equation (3.2) may not be obvious at first inspection, but we can gain
some insight into this equation by plotting z after the divide by
W
as a
.
function of the input
Z-coordinate. This is demonstrated in Figure 3.47. Here we can see that the post projection
Z-value can reside in one of three general areas. If the input Z-coordinate is less than the
near clipping plane, Z
n
, the resulting Z
p
has a negative value. If the input Z-coordinate is
between
Z
n
and
Z
f
the resulting Z
p
has a value between 0 and
Z
f
Any input Z-coordinate
that is greater than Z
f
produces a Z
p
that is greater than Z
f
2
6
At some point after projection, these post-projection coordinates must be rehomoge-
nized by dividing by the
W
-coordinate. By dividing all of the coordinates by the
W
-coordinate,
we ensure that the post-divide
W
-coordinate will be 1. We can also consider what happens
to our post divide Z-coordinate by simply dividing the results discussed above by Z
1
. When
Z
1
equals
Z
n
,
the result is 0. When
Z
1
equals Z
f
, the result is 1. Thus, after the divide by
W
we have a valid depth range of values between 0 and 1, which correspond to the input val-
ues between
Z
n
and Z
f
We won't repeat the calculations here, but the
X-
and
Y
-coordinates
produce a similar behavior, with each of them producing valid values in the -1 to 1
Figure 3.47. The post-projection Z-coordinate of a position.
2
6
All of these equations assume a left-handed coordinate system, where Z is positive in the direction of view.
This is the standard coordinate system used in Direct3D.
Search WWH ::
Custom Search