CS 184: COMPUTER GRAPHICS
Lecture #10 -- We: 2/24, 1999.
PREVIOUS
< - - - - > CS
184 HOME < - - - - > CURRENT
< - - - - > NEXT
Preparation:
Read: Ch 5.6 "3D Transformations"; Ch 11.1.3, "Plane Equations";
Ch 15.2.4, "Backface Culling"
Lecture Topics
More on Degrees of Freedom
How many DOF for: infinitely long lines in 2D: (2);
planes in 3D: (3)
-- How can this be achieved ?
{hint: use normal vector through origin}
More on Transformations
Relative positions between objects in different subtrees in hierarchical
scene trees.
Interpretation with a modified scene hierarchy:
Inverse transformation, matrix inversion.
[ ( )S->W ]-1 is needed above. Similarly an
inverse x-form is needed whenever we go up the tree, towards the root,
against the arrows ...
So, what is [ ( )S->W ]-1 ? --
It is something that "un-does" the effect of ( )S->W ;
so that: ( )S->W * [ ( )S->W ]-1
= 1
Inverses of basic x-forms are:
T(a, b)-1 = T(-a, -b),
S(a, b)-1 = S(1/a, 1/b),
R(a)-1 = R(-a)
Inverse of a composite are inverses of components in reverse order
(T1 * T2 * T3 )-1 = T3-1 * T2-1 *
T1-1 .
Towards 3D !
3D Modeling Primitives
Points: just one extra coordinate, no extra treatment.
Lines reference points: exactly the same as in 2D.
Faces basically nothing new: but must be planar;
We need to find their plane equation; needed later for calculation of illumination.
Martin Newell's plane equation formula
Plane normal components are in same ratio as shadow of polygon on the three
coord planes.
Each shadow area is computed as 2D projection as sum of trapezoids
(x1-x2)(y1+y2)/2.
Form the sum of all such expressions around the contour; do it for
all 3 projections.
==Fig: Show projections and trapezoid method to calculate areas.
3D Transformation Matrices
Scaling ==> trivial; just add the 3rd coordinate.
Rotation around one coordinate axis ==> just like 2D, involving only
those two axes;
cyclically move through xy, yz, zx - planes.
Translation -- not really a linear transform ! ==> need to resort to
homogeneous coord. again.
Add an additional row and column in all matrices to make them 4x4.
See Ch 5.6, page 215 for detailed view of matrices.
Introduction to Projection
Now we can do modeling in 3D -- Next: how we can view this
scene on only 2D display.?
Need to go from 3D scene to 2D image.
Simplest way ==> just ignore z coordinate. ==> Parallel projection
along z-axis.
This is a parallel projection (all projection rays are parallel).
Alternative: Perspective; uses a center of projection.
SLIDE: projectionflag: 0==parallel; 1==perspective.
Backface Elimination
We cannot see the back-faces -- so why should we render them !
How do we know that a face is back-facing ?
==> If scalar product between face normal and viewing direction
is positive !
For our special case of parallel projection down the z-axis:
==> if face normal has negative z-component: (do not render
that face)
New Lab Work: 3D Viewer
"Crystal Ball" interface to manipulate 3D object.
Provide a convenient way to twiddle an object around for inspection.
Old, inconvenient way turn object around: in its master coordinate
system, first by sliders, later by mouse:
If you turn object left to right 180 degrees ==> confusion! (Story
of siggraph vendor booth demos).
We will do better: we will turn object in the screen coordinate system,
so that it always responds properly to the mouse cursor movements.
Discuss 3 mouse functions.
RIGHT: z-rotation
MIDDLE: "zoom" = uniform scaling of object
LEFT: Crystal ball interface = "simultaneous rotations around x &
y axes.
General Remarks on Human Factors
Key issues:
Make it easy for the user rather than for the computer.
Compute power is going to grow by 100 in next 10 years -> CPU cycles are
cheap !
Keep it reactive; move cursor immediately ! Do other stuff later.
Give good visual (acoustic, other) feedback of what is going on, what
has been selected,
whether cursor has snapped to a particular shape or alignment line
{e.g. hilite} ...
Speed AND Precision
Grids, gravity, auxiliary lines, ...
Combine all these ideas in Snap-dragging.
Application-dependent Conveniences.
Automate the most frequently occurring operations.
Provide proper defaults.
Reasonable ways to disambiguate the mouse movements.
Current Homework Assignment:
ASG#4:
"2D Polygon Clipper"
DUE: Saturday 2/27/99, 11:59pm.
TO BE DONE with a NEW PARTNER !
--> Next
Lecture
<-- Up to CS
184 HomePage
Page Editor: Carlo H. Séquin