# CS488 - Introduction to Computer Graphics - Lecture 8

## Comments and Questions

# Projecting the View Frustum

We don't want to throw away z, so we'll do a 2D to 2D projection:

- view frustrum to cube centred on the origin

Do this as a sequence of transformations

- Eye goes to infinity
- Translate centre
- Scale to (1,1), (-1,-1) cube

#### Eye Goes to Infinity

- (0,0,1) -> (0,infinity,1) = (0,-1,0)
- (0,f,1) -> (0,f,1) = \alpha*(0,f,1)
- (h,n,1) -> (h,n,1)
- (-h,n,1) -> (-h,n,1)
- A = nH
- B = f*f*G/n
- D = Gh
- E

That is,

- Near plane goes to z' = -1.
- Far plane goes to z' = 1
- Top plane goes to x' = 1
- Bottom plane goes to x' = -1

Represent the Mobius transformation as a matrix

/ \
| a b c |
| d e f |
| g h i |
\ /

Then, using the code

- zn: z coordinate of the near plane
- zf: z coordinate of the far plane
- mu: slope of the upper limit of the frustrum
- md: slope of the lower limit of the frustrum

we can map the four planes.

- (x, zn, 1 ) -> (sx', -s, s )
- (x, zf, 1 ) -> (tx'', t, t )
- (mu*z, z, 1 ) -> (u, uz', u )
- (md*z, z, 1 ) -> (-v, vz'', v )

Each of these gives two ordinary linear equations. (Why?) Just the right
number. (Why?) Solve them.

The result is

/ \
| 1 (mu + md) / (mu - md) 0 |
| 0 (zf + fn) / (zf - zn) -2*zf*zn / (zf - zn) |
| 0 1 0 |
\ /

Exercise. Check that this matrix creates the correct Mobius
transformation.

Exercise. Compare this matrix to the one in the notes. It should be the
same with the y row and column deleted. Why is it different?

Exercise. Solve the equations.

Exercise. Show that our 2D to 2D projection, followed by orthogonal
projection is the same as the 2D to 1D projection just above.

Exercise. Extend these results to 3D, and compare to the matrices given in
the notes.

#### Properties of this Projection

z' -> (z*(zf + zn) -2*zf*zn ) / z*(zf - zn)

- z = zf
- z = zn
- What maps to zero? z' = 2*zf*zn / (zf + zn )
Note the possible numeric problems.

- z -> +0
- z -> -0
- z -> infinity, z' = (zf + zn) / (zf - zn)

#### Return to: