Graphics Reference
In-Depth Information
transformations from the world-coordinate system down to some primitive
element (typically a triangle specified by its vertex coordinates) is called the
com-
posite modeling transformation matrix
or
CMTM.
This matrix, multiplied by the modeling coordinates of some vertex, produces
the world coordinates of the corresponding point on the modeled object. (Remem-
ber that all coordinates need to be expressed homogeneously, to allow us to gen-
erate translations, so the CMTM is a 4
×
4 matrix.)
Inline Exercise 13.4:
Explain why the last row of the CMTM, assuming that
the transformations in the modeling hierarchy are all translations, rotations,
and scaling transformations (i.e., they are all
affine
transformations), must be
0001
.
To transform world coordinates to the standard parallel view volume, we must
multiply these coordinates by
M
per
and then
M
pp
, and then homogenize. The
product
CTM
=
M
pp
·
M
per
·
CMTM
(13.19)
is called (in OpenGL) the
modelview projection matrix
or
composite transfor-
mation matrix
or
CTM
.
We can consider the
uvw
triple of vectors, determined by the camera specifi-
cation, together with the camera location, as defining another coordinate system,
eye coordinates.
To transform a vertex from world to eye coordinates, we must
multiply by the matrix
⎡
⎣
⎤
⎦
⎡
⎣
⎤
⎦
u
x
u
y
u
z
0
v
x
v
y
v
z
0
w
x
w
y
w
z
0
0001
100
−
P
x
010
−
P
y
N
=
.
(13.20)
001
P
z
000 1
−
Inline Exercise 13.5:
Confirm that
N
transforms
P
to the origin, transforms
the vector
u
to
1000
T
, and similarly for
v
and
w
.
The product
N
CMTM
is called the
modelview
matrix in OpenGL.
Inline Exercise 13.6:
Suppose you've modeled a scene—two robots talking—
and have placed a camera so as to view the scene. You want to show a friend the
“larger context”—a more distant view of both robots
and
a geometric represen-
tation of the camera: a small pyramid whose vertex is at the eye. Fortunately,
you happen to have a vertex-and-triangle-table representation of the standard
perspective view volume, shortened by a factor of two in the
y
direction so that
it's twice as wide as it is tall. What transformation would you apply to this
model to place it in the scene with its apex at the eye and its base parallel to
the
uv
-plane, with its
y
-axis (the shorter one) aligned with
v
?