Next: Why Map Z?
Up: Projections and Projective
Previous: Projections and Projective
- Perspective Projection
-
- Identify all points with a line through the eyepoint.
- Slice lines with viewing plane, take intersection point
as projection.
\
- This is not an affine transformation, but
a projective transformation.
- Projective Transformations:
-
- Angles are not preserved (not preserved under Affine Transformation).
- Distances are not preserved (not preserved under Affine Transformation).
- Ratios of distances are not preserved.
- Affine combinations are not preserved.
- Straight lines are mapped to straight lines.
- Cross ratios are preserved.
- Cross Ratios
-
- Comparison:
-
- Perspective Map:
-
- Pseudo-OpenGL version
- of the perspective map:
- Maps a near clipping plane z=n to z'= -1
- Maps a far clipping plane z=f to z'=1
\
- The ``box'' in world space known as
``truncated viewing pyramid'' or ``frustum''
- Project x, y as before
- To simplify things, we will project into the z=1 plane.
- Derivation:
-
- Want to map x to x/z (and similarly for y).
- Use a matrix multiply followed by a division (normalization):
- Solve for a, b, c, and d such that
maps to .
- Know that we want to map x to x/z (assuming
our projection plane is at z=1) so
Thus,
- Our constraints on the near and far clipping planes
(e.g., that they map to -1 and 1) give us
This gives us
- After normalizing we get
- Could use this formula instead of performing the
matrix multiply followed by the division ...
- If we multiply this matrix in with the geometric transforms,
the only additional work is the divide.
- Verification:
-
- If z=n, then
- If z=f, then
- The OpenGL perspective matrix
- uses
- Our final matrix is
where the is 1 if we look down the z axis and -1 if
we look down the -z axis.
- OpenGL uses a slightly more general form of this matrix
that allows skewed viewing pyramids.
Readings: Hearn and Baker: 12-3,
Red book: Chapter 6,
White book: Chapter 6,
Blinn: Chapter 17, 18.
Next: Why Map Z?
Up: Projections and Projective
Previous: Projections and Projective
CS488/688: Introduction to Interactive Computer Graphics
University of Waterloo
Computer Graphics Lab
cs488@cgl.uwaterloo.ca