Projecting from 3D to the Plane
An Introduction
Prof. David Bernstein
James Madison University
Computer Science Department
bernstdh@jmu.edu
Motivation
What We Have:
A way to represent shapes in 3D
2D visual output devices
What We Need:
A way to reduce the dimensionality of our shapes
Some Intuition
The Traditional Approach:
Think about a camera
An Alternative Approach:
Think about an object that produces light rays from each point on its surface
Each ray is called a
projector
Each ray has a
direction of projection
Each ray passes through a translucent screen (called the
projection plane
)
Projection Matrix
Defined:
An \(n \times n\) matrix that takes a point in \(\mathbb{R}^{n}\) to a subspace
Properties:
The columns of \(\bs{P}\) are the projections of the standard basis vectors
A matrix \(\bs{P}\) is a projection matrix iff \( \bs{P} \bs{P} = \bs{P}\)
Orthogonal/Orthographic Projections
Defined:
The projectors are all parallel
The projection plane is perpendicular to the projectors
A Warning About Terminology:
A matrix is often said to be orthogonal if \(\bs{A}^{T} \bs{A} = \bs{I}\)
Rotation matrices and reflection matrices have this property but are not projection matrices
Orthographic Projections (cont.)
Projecting onto the Plane \(z = n\):
We want to project the point \(\left[ \begin{array}{c}x \\ y \\ z \\1 \end{array}\right]\)
to the point \(\left[ \begin{array}{c}x \\ y \\ n \\ 1 \end{array}\right]\)
The projection matrix is: \( \left[ \begin{array}{r r r r} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & n \\ 0 & 0 & 0 & 1 \end{array}\right] \)
Projecting onto the Plane \(z = 0\):
The projection matrix is: \( \left[ \begin{array}{r r r r} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{array}\right] \)
Perspective Projections
Intuition:
All projectors meet at a (finite)
Center of Projection
(COP)
An Important Property:
When an object is moved farther from the viewer it gets smaller (called
diminution
or
foreshortening
)
From Art Class:
Think about drawing a house and having the parallel lines where walls meet intersecting at a
vanishing point
when drawn on paper
Which parallel lines on the object intersect depends on whether you are using one-point, two-point, or three-point perspective
Perspective Projections (cont.)
A Partial Visualization:
The Projected Point:
\(\tan \alpha = y/(z+d)\)
\(\tan \alpha = y^{*}/d\)
So: \(y^{*} = \frac{y}{z/d +1}\)
Perspective Projections (cont.)
Another Partial Visualization:
The Projected Point:
\(\tan \beta = x/(z+d)\)
\(\tan \beta = x^{*}/d\)
So:\(x^{*} = \frac{x}{z/d +1}\)
Perspective Projections (cont.)
Getting Part Way:
\( \left[ \begin{array}{r r r r} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 1/d & 1 \end{array}\right] \left[ \begin{array}{r} x \\ y \\ z \\ 1 \end{array}\right] = \left[ \begin{array}{r} x \\ y \\ 0 \\ z/d + 1 \end{array}\right] \)
Converting to Homogeneous Coordinates:
Divide by \(z/d + 1\) to obtain:
\(\left[\begin{array}{c} \frac{x}{z/d +1} \\ \frac{y}{z/d +1} \\ 0 \\ 1 \end{array}\right]\)
Perspective Projections (cont.)
One Interpretation:
The orthographic projection is the limiting case of the perspective projection as the COP goes to infinity
Another Interpretation:
The perspective projection is the product of a perspective transformation:
\( \left[ \begin{array}{r r r r} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 1/d & 1 \end{array}\right] \)
and an orthographic projection:
\( \left[ \begin{array}{r r r r} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{array}\right] \)
Perspective Projections (cont.)
Be Careful:
Perspective projections can reverse the sign and ordering of \(z\) values
The Result:
Line segments that cross \(z=0\) can be "torn"
Variants of these Projections
One Approach:
Think about different projection matrices that fit in each category
Another Approach:
Think about orienting/transforming the object before applying the projection
There's Always More to Learn