Topic 7: 3D Transformations • Homogeneous 3D transformations • Scene Hierarchies • Change of basis and rotations in 3D
Representing 2D transforms as a 3x3 matrix Translate a point [x y] T by [t x t y ] T : x’ = 1 0 t x x y’ 0 1 t y y 1 0 0 1 1 Rotate a point [x y] T by an angle t : x’ = cost -sint 0 x y’ sint cost 0 y 1 0 0 1 1 Scale a point [x y] T by a factor [s x s y ] T x’ = s x 0 0 x y’ 0 s y 0 y 1 0 0 1 1
Representing 3D transforms as a 4x4 matrix Translate a point [x y z] T by [t x t y t z ] T : x’ = 1 0 0 t x x y’ 0 1 0 t y y z’ 0 0 1 t z z 1 0 0 0 1 1 Rotate a point [x y z] T by an angle t around z axis: x’ = cost -sint 0 0 x y’ sint cost 0 0 y z’ 0 0 1 0 z 1 0 0 0 1 1 Scale a point [x y z] T by a factor [s x s y s z ] T x’ = s x 0 0 0 x y’ 0 s y 0 0 y z’ 0 0 s z 0 z 1 0 0 0 1 1
Scene Hierarchies
Change of reference frame/basis matrix p c y b o x a z p = ap x ’ + bp y ’ + cp z ’ + o p = a b c o p’ 0 0 0 1 -1 p’= a b c o p 0 0 0 1
Topic 8: 3D Viewing • Camera Model • Orthographic projection • The world-to-camera transformation • Perspective projection • The transformation chain for 3D viewing
Camera model
Camera model: camera obscura
Camera model virtual image Ideal pinhole camera image pinhole object Real pinhole camera image aperture object
Camera model Real pinhole camera image aperture object Camera with a lens aperture object
Camera model Camera with a lens aperture object Depth of Field
Viewing Transform V up P eye P ref
Viewing Transform V up w=(P eye -P ref )/||P eye -P ref || P eye P ref
Viewing Transform V up w P eye u=(V up xw)/|| V up xw || P ref
Viewing Transform V up w v=wxu P eye u P ref
Change-of-basis Matrix V up w v=wxu P eye u P ref u x v x w x P eyex u y v y w y P eyey u z v z w z P eyez 0 0 0 1
Camera model
Camera model What is the difference between these images?
Camera model What is the difference between these images? Perspective Orthographic
Perspective: Muller-Lyer Illusion
Orthographic projection p ’= [1 0 0 0] p [0 1 0 0] p ’=[x y 1] T [0 0 0 1] p=[x y z 1] T
Orthographic projection Is |p- q| = |p’ - q’| ? q’ If m= (p+q)/2, Is m’ = (p’+q’)/2? m’ p ’=[x y 1] T q m p=[x y z 1] T
Cannonical view volume t Map 3D to a cube centered y f at the origin of side length 2! r x z l n p ’ b p
Cannonical view volume t Map 3D to a cube centered y f at the origin of side length 2! r x z l Translate(-(l+r)/2,-(t+b)/2,-(n+f)/2)) n p ’ Scale(2/(r-l), 2/(t-b), 2/(f-n)) b p
Camera model Perspective Projection
Perspective projection w v u
Perspective projection w v P’ P d u
Simple Perspective w v P’ P d u P(x,y,z) y P’(x’,y’,z’) z (0,0,d) Image plane
Simple Perspective P(x,y,z) y P’(x’,y’,z’) z (0,0,d) Image plane y’= yd/z x’= xd/z z’=d
Simple Perspective P(x,y,z) y P’(x’,y’,z’) z (0,0,d) Image plane x’ 1 0 0 0 x y’ = 0 1 0 0 y z’ 0 0 1 0 z w’ 0 0 1/d 0 1 w’= z/d
Simple Perspective P(x,y,z) y P’(x’,y’,z’) z (0,0,d) Image plane x’ 1 0 0 0 x y’ = 0 1 0 0 y z’ 0 0 a b z w’ 0 0 1/d 0 1 Find a and b such that z’= - 1 when z=d and z’=1 when z=D, where d and D are near and far clip planes.
Simple Perspective P(x,y,z) y P’(x’,y’,z’) z (0,0,d) Image plane x’ 1 0 0 0 x y’ = 0 1 0 0 y z’ 0 0 a b z w’ 0 0 1/d 0 1 z’=d( a z +b )/z => -1= a d+ b and 1=d( a D+ b )/D => b =2D/(d-D) and a =(D+d)/(d(D-d))
Viewing volumes Projected image
Viewing Pipeline object world camera modeling viewing projection transform transform transform cannonical view vol. 4D cannonical screen viewport cartesianize 2D perspective divide transform
Recommend
More recommend