Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 12

COMPUTER GRAPHICS

Lecture 3
2D & 3D Viewing
1
IMPLEMENTATION OF VIEWING.

 Transform into camera coordinates.

 Perform projection into view volume or screen coordinates.


 Clip geometry outside the view volume.

2
VIEW PROJECTION
We want to create a picture of the scene viewed from the camera
Two sorts of projection
Parallel projection
Perspective projection

3
TRANSFORMATIONS
MATHEMATICS OF VIEWING
 We need to generate the transformation matrices for
perspective and parallel projections.

5
PARALLEL PROJECTIONS
(ORTHOGRAPHIC PROJECTION)
 Specified by a direction of projection, rather than a point.
 Objects of same size appear at the same size after the
projection

6
PARALLEL PROJECTION.
Orthographic Projection onto a plane at z = 0.
xp = x , yp = y , z = 0.

1 0 0 0
0 1 0 0
M orth 
0 0 0 0
 
0 0 0 1

7
PERSPECTIVE PROJECTION
 Specified by a center of projection and the focal distance (distance
from the eye to the projection plane)
 Objects far away appear smaller, closer objects appear bigger

8
PERSPECTIVE PROJECTION – SIMPLEST
CASE.
Centre of projection at the origin,
Projection plane at z=d.
d: focal distance Projection
Plane.
y
P(x,y,z)

x Pp(xp,yp,-d)

d 9
PERSPECTIVE PROJECTION – SIMPLEST
CASE.
From similar triangles :
xp x
x yp y
 ; 
d z d z P(x,y,z)
xp
z
dx x dy y
xp   ; yp  
z z/d z z/d d

y z d
P(x,y,z)

Pp(xp,yp,-d)
z yp P(x,y,z)
d y 10

x
3D VIEW VOLUME
 The volume in which the visible objects exist
 For orthographic projection, view volume is a box.

 For perspective projection, view volume is a frustum.

 The surfaces outside the view volume must be clipped

left
Far clipping plane.

Near clipping plane

11
right
Need to calculate intersection
With 6 planes.
TRANSFORMING THE VIEW FRUSTUM
 Let us define parameters (l,r,b,t,n,f) that determines the
shape of the frustum
 The view frustum starts at z=-n and ends at z=-f, with
0<n<f
 The rectangle at z=-n has the minimum corner at (l,b,-n)
and the maximum corner at (r,t,-n)

12

You might also like