1
CS 543 - Computer Graphics: Projection
by Robert W. Lindeman gogo@wpi.edu
(with help from Emmanuel Agu ;-) R.W. Lindeman - WPI Dept. of Computer Science 2
CS 543 - Computer Graphics: Projection by Robert W. Lindeman - - PDF document
CS 543 - Computer Graphics: Projection by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) 3D Viewing and View Volume Recall: 3D viewing set up R.W. Lindeman - WPI Dept. of Computer Science 2 1 Projection Transformation
(with help from Emmanuel Agu ;-) R.W. Lindeman - WPI Dept. of Computer Science 2
R.W. Lindeman - WPI Dept. of Computer Science 3
R.W. Lindeman - WPI Dept. of Computer Science 4
projection plane camera
R.W. Lindeman - WPI Dept. of Computer Science 5
R.W. Lindeman - WPI Dept. of Computer Science 6
R.W. Lindeman - WPI Dept. of Computer Science 7
x y z y z θ field of view (view angle) center of projection
R.W. Lindeman - WPI Dept. of Computer Science 8
x y z Near plane Far plane
R.W. Lindeman - WPI Dept. of Computer Science 9
x y z Near plane Far plane View Frustum
R.W. Lindeman - WPI Dept. of Computer Science 10
R.W. Lindeman - WPI Dept. of Computer Science 11
x y z y z fovy eye near far Aspect = w / h w h θ
R.W. Lindeman - WPI Dept. of Computer Science 12
x y z left right bottom top near far
R.W. Lindeman - WPI Dept. of Computer Science 13
x y z left right bottom top near far
R.W. Lindeman - WPI Dept. of Computer Science 14
R.W. Lindeman - WPI Dept. of Computer Science 15
x y z x y z Perspective: gluPerspective( ) Parallel: glOrtho( )
R.W. Lindeman - WPI Dept. of Computer Science 16
x y z (x,y,z) (Xp, Yp)
R.W. Lindeman - WPI Dept. of Computer Science 17
(-1, -1, 1) (1, 1, -1) Canonical View Volume glOrtho( xmin, xmax, ymin, ymax, near, far ) (xmin, ymin, near) (xmax, ymax, far) Projection: Need to build 4x4 matrix to do mapping from actual view volume to CVV
R.W. Lindeman - WPI Dept. of Computer Science 18
R.W. Lindeman - WPI Dept. of Computer Science 19
20
R.W. Lindeman - WPI Dept. of Computer Science 21
M2 M1= 2/(xmax xmin) (xmax+ xmin)/(xmax xmin) 2/(ymax ymin) (ymax+ ymin)/(ymax ymin) 2/(zmax zmin) (zmax+ zmin)/(zmax zmin) 1
2 xmax xmin 2 ymax ymin 2 zmax zmin 1
22
x y z (0,0,0) d Projection plane Eye (center of projection ) (x,y,z) (x’,y’,z’)
z y Based on similar triangles: y -z y’ d d y’ = y *
=
R.W. Lindeman - WPI Dept. of Computer Science 23
x
z
y
z
24
x 2 + P y 2 + P z 2
x
z
y
z
z + b
z
R.W. Lindeman - WPI Dept. of Computer Science 25
z + b
z
R.W. Lindeman - WPI Dept. of Computer Science 26
(2, 4, 6, 1) or (4, 8, 12, 2) where w=2 or (6, 12, 18, 3) where w = 3
R.W. Lindeman - WPI Dept. of Computer Science 27
28
We have already solved a and b x y z
Z = 1 z = -1
R.W. Lindeman - WPI Dept. of Computer Science 29
R.W. Lindeman - WPI Dept. of Computer Science 30
R.W. Lindeman - WPI Dept. of Computer Science 31
(-1, -1, 1) (1, 1, -1) Canonical View Volume x y z
R.W. Lindeman - WPI Dept. of Computer Science 32