i
i
i
i
i
i
i
i
142 7. Viewing
Figure 7.1. Left: wireframe cube in orthographic projection. Middle: wireframe cube in
perspective projection. Right: perspective projection with hidden lines removed.
the (x, y, z) coordinates of their two end points. Later chapters will discuss the
machinery needed to produce renderings of solid surfaces.
7.1 Viewing Transformations
The viewing transformation has the job of mapping 3D locations, represented
as (x, y, z) coordinates in the canonical coordinate system, to coordinates in the
image, expressed in units of pixels. It is a complicated beast that depends on
Some APIs use “viewing
transformation” for just the
piece of our viewing trans-
formation that we call the
camera transformation.
many different things, including the camera position and orientation, the type
of projection, the field of view, and the resolution of the image. As with all
complicated transformations it is best approached by breaking it up in to a product
of several simpler transformations. Most graphics systems do this by using a
sequence of three transformations:
• A camera transformation or eye transformation, which is a rigid body trans-
formation that places the camera at the origin in a convenient orientation.
It depends only on the position and orientation, or pose, of the camera.
• A projection transformation, which projects points from camera space so
that all visible points fall in the range −1 to 1 in x and y. It depends only
on the type of projection desired.
• A viewport transformation or windowing transformation, which maps this
unit image rectangle to the desired rectangle in pixel coordinates. It de-
pends only on the size and position of the output image.
To make it easy to describe the stages of the process (Figure 7.2), we give names
to the coordinate systems that are the inputs and output of these transformations.
The camera transformation converts points in canonical coordinates (or world