topic 7 3d transformations
play

Topic 7: 3D Transformations Homogeneous 3D transformations Scene - PowerPoint PPT Presentation

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. Topic 7: 3D Transformations • Homogeneous 3D transformations • Scene Hierarchies • Change of basis and rotations in 3D

  2. 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

  3. 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

  4. Scene Hierarchies

  5. 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

  6. Topic 8: 3D Viewing • Camera Model • Orthographic projection • The world-to-camera transformation • Perspective projection • The transformation chain for 3D viewing

  7. Camera model

  8. Camera model: camera obscura

  9. Camera model virtual image Ideal pinhole camera image pinhole object Real pinhole camera image aperture object

  10. Camera model Real pinhole camera image aperture object Camera with a lens aperture object

  11. Camera model Camera with a lens aperture object Depth of Field

  12. Viewing Transform V up P eye P ref

  13. Viewing Transform V up w=(P eye -P ref )/||P eye -P ref || P eye P ref

  14. Viewing Transform V up w P eye u=(V up xw)/|| V up xw || P ref

  15. Viewing Transform V up w v=wxu P eye u P ref

  16. 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

  17. Camera model

  18. Camera model What is the difference between these images?

  19. Camera model What is the difference between these images? Perspective Orthographic

  20. Perspective: Muller-Lyer Illusion

  21. 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

  22. 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

  23. 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

  24. 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

  25. Camera model Perspective Projection

  26. Perspective projection w v u

  27. Perspective projection w v P’ P d u

  28. Simple Perspective w v P’ P d u P(x,y,z) y P’(x’,y’,z’) z (0,0,d) Image plane

  29. 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

  30. 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

  31. 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.

  32. 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))

  33. Viewing volumes Projected image

  34. 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