Graphics Reference
In-Depth Information
Suppose we consider the perspective-to-parallel transformation
M
pp
for the case
c
=
1
f
is the
z
-position of the near plane in the standard
perspective view volume.) If we take a sequence of points equally spaced between
c
and
−
2
. (Recall that
c
=
−
n
/
1onthe
z
-axis, and apply the transformation and homogenize, then we get
a sequence of points between 0 and
−
1 in the parallel view volume, but they're no
longer equally spaced. Figure 13.18 shows the relationship of the new coordinates
(
z
) to the input coordinates (
z
) for several values of
c
. When
c
is near
−
−
1, the
relationship is near linear; when
c
is near 0, the relationship is highly nonlinear.
You can see how the output values all cluster near
z
=
1.
Now suppose that the
z
-values are to be multiplied by
N
for some integer
N
and discretized to integer values between 0 and
N
−
1, as is common in many
z
-buffers, which use these discretized
z
-values to determine which polygon is
visible at a given pixel. If
c
is very small, then all the
z
-values will be so near
to 1 that they almost all discretize to
N
−
1, and the
z
-buffer will be unable to
determine occlusion. In consequence, if you choose a near plane that's too near
the eye, or a far plane that's too distant, then your
z
-buffer may not perform as
expected. The near-plane distance is by far the more important: To avoid so-called
z
-fighting, you always want to push the near plane as far from the eye as possible
while still seeing everything you need to see.
−
Modeling Hierarchy
Recall that in Section 10.11 we made a hierarchy of transformations to represent
the clock face of Chapter 2, and we said that a similar hierarchy could be created
for a 3D model. For a 3D model, the product of all the matrices representing
0.0
c
52
0.7
c
52
0.4
c
52
0.1
2
0.1
2
0.2
2
0.3
2
0.4
2
0.5
2
0.6
2
0.7
2
0.8
2
0.9
2
1.0
2
1
2
0.8
2
0.6
2
0.4
2
0.2
0
z
Figure 13.18: Points equispaced in depth in the perspective view volume transformed to
unevenly spaced ones in the parallel view volume.