Graphics Reference
In-Depth Information
Inline Exercise 13.3:
Perform the corresponding computation for the lower-
right rear vertex of the perspective view volume, and continue until you're
convinced that the transformation works as promised.
Our unhinging transformation places the view volume in the standard parallel
view volume, which extends from 0 to
1in
z
; objects with
more positive
z
-values obscure those with
more negative z
-values. In a hardware
z
-buffer,
the
z
-values are often stored as unsigned integers; storing them as negative
numbers wastes 1 bit for the sign. So, rather than unhinging to a view volume
that ranges from 0 to
−
1 being “far away,” they unhinge to a view
volume that ranges from 0 to 1, with 1 being far away. To do this, you need
only negate the
z
-row of the unhinging matrix
M
pp
.
Alternatively, instead of having the standard parallel view volume extend
from 0 to
−
1, with
−
1in
z
, we could have it extend from 1 to 0 in
z
(i.e., we simply
add one to each transformed
z
-value). Then, although most transformed values
would cluster near zero, the problem would be minimized, because if we store
them as floating-point numbers, there are many more floating-point numbers
near zero than near one. This does in fact improve matters somewhat [AS06].
−
Rasterizing Renderer Pipeline
We described in Chapter 1 how graphics processing is typically done. First, geo-
metric models, like the ones created in Chapter 6, are placed in a 3D scene by
various geometric transformations. Then these models are “viewed” by a camera,
which amounts to transforming their world-space coordinates into coordinates in
the standard perspective view volume, and then transforming to the standard
par-
allel
view volume. Finally, they are projected to a 2D image, and this image is
transformed to the viewport where we see a picture.
Along the way, the geometric representation of each model must be processed
as shown in Figure 13.14. The 3D world coordinates of primitives (typically tri-
angles) are “clipped” against a view volume; in other words, those outside the
view volume are removed from consideration. A triangle that's partly inside the
3D world-coordinate
output primitives
Clipped
world coordinates
2D device
coordinates
Transform
into viewport
in 2D device
coordinates
for display
Clip against
view
volume
Project onto
film plane
Figure 13.14: Processing of geometry to create images.