On-Line Computer Graphics Notes
THE CAMERA TRANSFORM

Overview

To understanding the rendering process, you must master the procedure that specifies a camera and then constructs a transformation that projects a three-dimensional scene onto a two-dimensional screen. This procedure has two several components: First, the specification of a camera model; second, the conversion of the scene's coordinates from Cartesian space to the space of the camera; and finally the specification of a viewing transformation that projects that scene into image space

The Camera Model

We specify our initial camera model by identifying the following parameters.

1.
A scene, consisting of polygonal elements each represented by their vertices,
2.
A point that represents the camera position -- ,
3.
A point that represents the center-of-attention'' of the camera (i.e. where the camera is looking) -- ,
4.
A field-of-view angle, , representing the angle subtended at the apex of the viewing pyramid.
5.
The specification of near'' and far'' bounding planes. These planes considered perpendicular to the direction-of-view vector at a distance of and from the camera, respectively.

The specification of , and forms a viewing volume in the shape of a pyramid with the camera position at the apex of the pyramid and the vector 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 which gives the region of space which contains the primary portion of the scene to be viewed (We note that objects may extend outside the trunchated pyramid. In many situations polygons will lie between the near plane and the camera, or, in distance, beyond the far plane.). The viewing transform, transforms this truncated pyramid onto the image space volume .

The Camera Transform

Given the definition of a camera , the camera transformation is a combination of a transform that first converts the coordinates of the Cartesian frame to the local coordinates of the camera's frame,

and second, applies the viewing transform. These two transformations are usually multiplied together to form a single matrix that is applied to all points of the scene.

Defining a Frame at the Camera Position

The main idea here is to define a frame at the camera position. Given such a frame , we generate a transformation that converts the Cartesian Frame coordinates to the camera's frame.

To define a frame at the camera position is easy - and there are actually an number of ways of doing this. One of the vectors is obvious - that is, we want

(the transformed camera should be looking along the negative axis).

In order to define the other vectors that make up the frame, we must make an assumption. We assume that the vertical direction of the camera must be in the plane defined by and the vector . This frequently happens when you are taking a picture, if you think about it - and it actually fairly easy to arrange. See the following figure for an illustration of this process. In the figure, the dotted line is the direction of view, and should be placed on the negative axis by the transformation.

To define and we utilize the following steps

• define ,
• define . This insures that is in the - plane.
This also insures that the vectors are all unit vectors, and that they are mutually perpendicular.

We note that this works well, except when you wish to have the camera look in the direction or . In these cases, either or and , and we cannot calculate a frame in this manner. However, we can utilize another vector as the up direction'' to utilize with to obtain .

Calculating the Matrix

To calculate the actual matrix that implements the transformation, we can write each of the vectors , and as a linear combination of , , and (Since the vectors defining are linearly independent). In addition, we can write the vector as a linear combination of , and . Thus we can calculate the values , where

These equations can be solved by Cramers Rule,: To obtain , we have

 , , and

To obtain , we have

 , , and

And to obtain , we have

 , , and

In addition, if , then we have

 , , and

to get .

The matrix that convets the coordinates of objects in the frame into coordinates for the frame is given by

Any point can be written in the frame by

But by the above calculations this is equal to

which implies that the coordinate

is the coordinate of the point in the frame .

We note, that by our construction, the frame is an orthonormal frame (all vectors are unit vectors and are mutually perpendicular) and in this case the equations above simplify tremendously. In particular, all the denominators , and we can simplify the numerators utilizing the identities

to obtain

The first few of these are extremely simple, as, for example is just the first coordinate of , etc.

Overview

The camera transform is a Cartesian-frame-to-frame transform. This is combined with the viewing transform to give a transformation that converts a scene into image space.

This document maintained by Ken Joy