Overview
One of the most important operations in rendering is
the projection of a a three-dimensional scene onto a
two-dimensional screen from an arbitrary
camera position. A fundamental part of this operation is the
specification of a viewing
transformation, a
matrix that transforms a region of
space into
image space.
For a pdf version of these notes look
here.
If you wish to ``cut to the chase'' and view the matrix directly, look here
Specification of the Parameters
We will assume that the user has defined a camera
transform
which can be
applied to the
object in the Cartesian frame. This transform will convert the
coordinates of the object into the local coordinate system of the
camera. Assuming this, we can assume that we are viewing the
object from the origin of the camera frame and the scene has
been transformed to lie on the negative
-axis of the frame. We also assume that the user has
defined the following parameters:
A three-dimensional view of the camera and its viewing space is given in the following figure.
A side view of the this space, with the
-axis coming out of the
paper, is given in the following figure. Note the field-of-view angle
.
The specification of
forms a viewing volume
in the shape of a pyramid with the camera (placed at the origin) at the apex
of the pyramid and the negative-
axis forming the axis of the
pyramid. This pyramid is commonly referred to as the viewing
pyramid.
The specification of the near and far planes forms a
truncated viewing pyramid giving a region of space that
contains the portion of the scene which is the ``center of attention''
of the camera. The viewing transform, defined below, will
transform this truncated viewing pyramid onto the image space volume
.
The Viewing Transformation Matrix
Given the specification of the parameters
, we define a
transformation that
can be applied to all elements of a scene and
takes the truncated viewing volume
(bounded by the viewing pyramid and the planes
and
) to the cube
. This transformation is given by
The transformation
is commonly referred to as the
viewing transformation and is developed below.
Development of the Matrix
The viewing transformation
is not a combination of simple translations, rotations,
scales or shears: its development is more complex. First, we
motivate the development of the projection portion of the matrix and
then apply this knowledge to the construction of the actual matrix.
Motivation
As motivation,
consider the case when the camera is at the origin, the viewing direction is
along the negative
-axis, and points are to be projected along the
line that passes through both the origin and the point, onto a
plane defined by
. The following figure illustrates the
projection of a point
onto the plane.
By a similar triangle argument
So the projection induces a unique fourth column in the matrix. When
the matrix is applied to a point
it returns
the
distance of the
coordinate from the
plane (
because
is
negative). Since we divide by the
coordinate, the result of the
operation is inversely proportional to the distance of the point from
the
plane.
Now, consider the case where
,
and the field of view
are
present as parameters, and it is necessary to transform the viewing pyramid
defined by the angle
and the planes
and
into the cube
.
To transform the truncated viewing pyramid to the cube, we will start
with a transformation
of the form
To calculate these, we apply the matrix to obtain
![]() |
||
![]() |
![]() |
||
![]() |
||
![]() |
If we apply our transformation to these points, we obtain
The Inverse of the Viewing Transformation
The above transformation transforms the truncated viewing pyramid into image space. The inverse of this transformation does the opposite - transforms points from image space into the truncated viewing pyramid. This inverse is given by
Summary
We have developed a matrix that works in the local coordinates of the camera space and transforms the points of an object into image space. The matrix is applied in homogeneous space, so that the perspective divide must be done after the viewing matrix is applied.
Return to
the Graphics Notes Home Page
Return
to the Geometric Modeling Notes Home Page
Return
to the UC Davis Visualization and Graphics Group Home Page
This document maintained by Ken Joy
All contents copyright (c) 1996, 1997, 1998,
1999
Computer Science Department
University of California, Davis
All rights reserved.