1 / 36

Introduction to 3D Graphics Lecture 3: General Camera Model

Introduction to 3D Graphics Lecture 3: General Camera Model. Anthony Steed University College London. Overview. More Maths Rotations and translations Homogenous co-ordinates General Camera Specification Mapping to world coordinates. Vectors and Matrices.

yitro
Télécharger la présentation

Introduction to 3D Graphics Lecture 3: General Camera Model

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to 3D GraphicsLecture 3: General Camera Model Anthony Steed University College London

  2. Overview • More Maths • Rotations and translations • Homogenous co-ordinates • General Camera • Specification • Mapping to world coordinates

  3. Vectors and Matrices • Matrix is an array of numbers with dimensions M (rows) by N (columns) • 3 by 6 matrix • element 2,3 is (3) • Vector can be considered a 1 x M matrix

  4. Identity matrices - I Diagonal Symmetric Diagonal matrices are (of course) symmetric Identity matrices are (of course) diagonal Types of Matrix

  5. Operation on Matrices • Addition • Done elementwise • Transpose • “Flip” (M by N becomes N by M)

  6. Operations on Matrices • Multiplication • Only possible to multiply of dimensions • x1 by y1 and x2 by y2 iff y1 = x2 • resulting matrix is x1 byy2 • e.g. Matrix A is 2 by 3 and Matrix by 3 by 4 • resulting matrix is 2 by 4 • Just because A x B is possible doesn’t mean B x A is possible!

  7. A is n by k , B is k by m C = A x B defined by BxA not necessarily equal to AxB Matrix Multiplication Order

  8. Example Multiplications

  9. Inverse • If A x B = I and B x A = I then A = B-1 and B = A-1

  10. 3D Transforms • In 3-space vectors are transformed by 3 by 3 matrices

  11. Scale • Scale uses a diagonal matrix • Scale by 2 along x and -2 along z

  12. Rotation • Rotation about z axis • Note z values remain the same whilst x and y change Y X

  13. About X About Y Scale (should look familiar) Rotation X, Y and Scale

  14. Homogenous Points • Add 1D, but constrain that to be equal to 1 (x,y,z,1) • Homogeneity means that any point in 3-space can be represented by an infinite variety of homogenous 4D points • (2 3 4 1) = (4 6 8 2) = (3 4.5 6 1.5) • Why? • 4D allows as to include 3D translation in matrix form

  15. Homogenous Vectors • Vectors != Points • Remember points can not be added • If A and B are points A-B is a vector • Vectors have form (x y z 0) • Addition makes sense

  16. Translation in Homogenous Form • Note that the homogenous component is preserved (* * * 1), and aside from the translation the matrix is I

  17. Putting it Together • R is rotation and scale components • T is translation component

  18. Order Matters • Composition order of transforms matters • Remember that basic vectors change so “direction” of translations changed

  19. Overview • More Maths • Rotations and translations • Homogenous co-ordinates • General Camera • Specification • Mapping to world coordinates

  20. Simple Camera (Cross Section) Y d ymax Z -Z COP ymin

  21. General Camera • View Reference Point (VRP) • where the camera is • View Plane Normal (VPN) • where the camera points • View Up Vector (VUV) • which way is up to the camera • X (or U-axis) forms LH system

  22. UVN Co-ordindates • View Reference Point (VRP) • origin of VC system • View Plane Normal (VPN) • Z (or N-axis) of VC system • View Up Vector (VUV) • determines Y (or V-axis) of VCS • X (or U-axis) forms LH system

  23. World Coords and Viewing Coords Y V U V U V V R P N X We want to find a general transform (EQ1) of the above form that will map WC to VC Z

  24. View from the Camera N and VPN into the page V xmax, ymax VUV Z Y X U xmin, ymin

  25. Finding the basis vectors • Step 1 - find n • Step 2 - find u • Step 3 - find v

  26. Finding the Mapping (1) • u,v,n must rotate under R to i,j,k of viewing space • Both basis are normalised so this is a pure rotation matrix • recall in this case RT = R-1

  27. Finding the Mapping (2) • In uvn system VRP (q) is (0 0 0 1) • And we know from EQ1 so

  28. Complete Mapping • Complete matrix

  29. For you to check • If • Then

  30. Using this for Ray-Casting • Use a similar camera configuration (COP is usually, but not always on -n) • To trace object must either • transform spheres into VC • transform rays into WC

  31. Ray-casting • Transforming rays into WC • Transform end-point once • Find direction vectors through COP as before • Transform vector by • Intersect spheres in WC

  32. Ray-casting • Transforming spheres into VC • Centre of sphere is a point so can be transformed as usual (WC to VC) • Radius of sphere is unchanged by rotation and translation (and spheres are spheroids if there is a non-symmetric scale)

  33. Tradeoff • If more rays than spheres do the former • transform spheres into VC • For more complex scenes e.g. with polygons • transform rays into WC

  34. Alternative Forms of the Camera • Simple “Look At” • Give a VRP and a target (TP) • VPN = TP-VRP • VUV = (0 1 0) (i.e. “up” in WC) • Field of View • Give horizontal and vertical FOV or one or the other and an aspect ratio • Calculate viewport and proceed as before

  35. Animated Cameras • Animate VRP (observer-cam) • Animate VPN (look around) • Animate TP (track-cam) • Animate COP • along VPN - zoom • orthogonal to VPN - distort

  36. Summary • We set up the mathematics of transformations between co-ordinate spaces • We created a more general camera which we can use to create views of our scenes from arbitrary positions • Formulation of mapping from WC to VC (and back)

More Related