by William Shoaff with lots of help
You might want to read Blinn's article on the view transform now, see [Bli88]. You can also listen to an audio of the lecture (Windows Media Audio encoding (wma) file.
Our objective now is to construct the map from model (master, object) space into view space. This is a two step process:
There really is no single map that works here, the graphics designer gets to pick and choose what objects are in the world, where they are placed, their size, and orientation. This is all done by applying a linear or, more generally, an affine map to each object. These types of transformations are described in another section of this course. For review, here's a brief discussion.
Linear transformations, in which we are interested, have the form
A scale matrix has the form:
Rotations are a little more complex. There are three principle rotations: about the x, y, and z axes. There are accomplished as follows:
Rotating
about the z-axis by
radians
produces a new point
where
Rotating
about the x-axis by
radians
produces a new point
where
Rotating
about the y-axis by
radians
produces a new point
where
The third major type of transform is a translation. It belongs to a class of transformations called affine. (Note that linear transforms are a subclass of affine transforms.)
Affine transformations, in which we are interested, have the form
Specifically, we write translations as
Now to map an object from model to world space, a graphics designer decides where the object should be located, scaled, and oriented. That is some combination of translations, scales, and rotations are applied to an object.
The world can be viewed from any position, looking in any direction, and at any orientation. To define a view we need to specify two points in world space and a direction defining an orientation called up. More precisely, we need to know:
The view plane normal
and the eye point
e determine a plane orthogonal to
containing e.
The perpendicular projection
of
onto this plane
determines the y axis of view coordinates.
We'll want to normalize its length to one unit, and we'll
call this unit length perpendicular projection
.
It can be computed as
The x axis of view coordinates is, of course, orthogonal
to the y and z coordinates, that is,
a unit length vector along the x axis of view space can be computed
as the cross-product of the vectors
and
.
Most computer graphicist set up view space so that it is left-handed.
Thus, instead of computing the cross-product in the usual xyz order
we compute it in reverse zyx order. We'll call the unit vector
along the x axis of view space
.
The left-handed version of
is computed by the formula
All of the above is well and good, but how does it help us derive a transformation from world to view space? The answer is we
The translation matrix is given by
M rotates the the view plane normal
to the z axis,
that is,
M rotates the up vector into the yz plane.
That is,
We have specified that the up vector has unit length, and so we know
Finally, we can compute M1 the first column of M via cross products:
To summarize, the view transform from world to view space is given by
where
The map from model space to view space is composed of modeling transforms that place objects in the world and a view transform that presents the world as seen from a virtual camera. The modeling transforms are made from scales, rotations, and translations and can vary from one object to another. The view transform is made from a translation and a rotation-reflection. View space is left-handed.