170 likes | 307 Views
CS 455 – Computer Graphics . Viewing Transformations I. Motivation. Want to see our “virtual” 3-D world on a 2-D screen. Graphics Pipeline. Object Space. Model Transformations. World Space. Viewing Transformation. Eye/Camera Space. Projection & Window Transformation. Screen Space.
E N D
CS 455 – Computer Graphics Viewing Transformations I
Motivation Want to see our “virtual” 3-D world on a 2-D screen
Graphics Pipeline Object Space Model Transformations World Space Viewing Transformation Eye/Camera Space Projection & Window Transformation Screen Space
Viewing Transformations • Projection: take a point from m dimensions to n dimensions where n < m • There are essentially two types of viewing transforms: • Orthographic: parallel projection • Points project directly onto the view plane • In eye/camera space (after viewing tranformation): drop z • Perspective: convergent projection • Points project through the origin onto the view plane • In eye/camera space (after viewing tranformation): divide by z
Parallel Projections • We will first deal with orthographic projection • Get the concept and models down • Projection direction is parallel to projection plane normal • Center of projection (COP) is at infinity • Parallel lines remain parallel • All angles are preserved for faces parallel to the projection plane p1 p1’ Center of projection at infinity p2 p2’ Projectors
Orthographic Projection • Points project orthogonally onto (i.e., normal to) the view plane: • Projection lines are parallel y z x
y d x z Projection Environment • We will use a right-handed view system • The eyepoint or camera position is on the +z axis, a distance d from the origin • The view direction is parallel to the z axis • The view plane is in the xy plane and passes through the origin
y (x, y, z) (x’, y’, z’) x z Parallel Projection • A point in 3-space projects onto the viewplane via a projector which is parallel to the z axis • What is (x’, y’, z’)?
(x’, y’, z’) Parallel Projection • Looking down the y axis: (x, y, z) x z • So z’ = 0, x’ = x
(x’, y’, z’) Parallel Projection • Looking down the x axis: y (x, y, z) z So y’ = y
Parallel Projection • Thus, for parallel, orthographic projections, • x’ = x, y’ = y, z’ = 0 • So, to perform a parallel projection on an object, we need to multiply it by some matrix that has this effect What is M? i.e., we simply drop the z coordinate
Perspective Projection • In the real-world, we see things in perspective: • Parallel lines do not look parallel • They converge at some point
y x z Perspective Projection • Points project through the focal point (e.g., eyepoint) onto the view plane: • Projection lines are convergent
Perspective Projection • Center of projection (COP) is no longer at infinity • Projectors form a view frustum that is a pyramid with the tip at the COP eye view plane
Perspective Projection • We will start with the projection plane parallel to the XY plane and perpendicular to the Z axis • Lines parallel to the X or Y axis remain parallel • X and Y distances become shorter as Z becomes more negative, e.g. a cube viewed in perspective: y x
Perspective Projection Computation • Assume the projection plane is normal to the Z axis, located at Z = 0. • Assume the center of projection (COP, eyepoint) is located at Z = d • What is P’(x’, y’, z’)? P(x, y, z) projection plane y P’(x’, y’, z’) x Center of Projection z