SE 313 – Computer Graphics Lecture 8: Transformations and Projections Lecturer: Gazihan Alankuş 1
Plan for Today Post-exam talk Revisit transformations Projections 2
Exam Talk Go over exam questions 3
Transformations (summary) Three types of linear transformations – Translation (point-vector addition) – Rotation (3x3 matrix multiplication) – Scale (vector-scalar multiplication) 4
Transformations (summary) Three types of linear transformations – Translation (point-vector addition) – Rotation (3x3 matrix multiplication) – Scale (vector-scalar multiplication) Cannot combine these operations in one type of operation – Convert them to one type of operation (not possible unless you use homogeneous coordinates) 5
Transformations (summary) Homogeneous coordinates enable us to represent translation, rotation and scale using 4x4 matrix multiplications. This way we can combine them easily by multiplying matrices together. The resulting matrix is another transformation. 6
Transformations (summary) 4x4 matrices that are combinations of translation, rotation and scale Rotation and scaleTranslation
Transformations (summary) You can read the local coordinate frame from 4x4 transformation matrices Rotation and scaleTranslation Where in the world the local frame’s origin is The x, y and z axes of the local frame
Transformations (summary) Intuitive understanding of transformations Local-to-world: insert new transformations near the wall (world) World-to-local: insert new transformations near the object 9
Transformations (summary) Quaternions: data structure for rotation – Useful for animations Ways of representing rotations 10 Three angles (euler angles) One axis, one angle 3x3 matrix Quaternion Best interpolation (slerp) Great-looking animations
Plan for Today Post-exam talk Revisit transformations Projections 11
Projection Projections from 3D to 2D – Taking pictures of the virtual world 12 [Images are borrowed from
Projection Types Perspective projection – Just like our eyes and cameras Orthographic projection – Architectural drawing with no distance distortion 13
Orthographic vs. Perspective Projection 14 [Images are borrowed from
Orthographic Projection Get the 3D world, compress it on a 2D paper 15 [engineeringtraining.tpub.com]
Orthographic Projection Great for isometric games (Starcraft, Diablo I- II) No depth sensation 16
Orthographic Projection in Blender Select the camera The viewport is defined by the render output size Camera has – Scale – Start and end clipping distances 17
Perspective Projection Take the picture of the world from a single point 18
Perspective Projection What parameters do I need? 19
Perspective Projection 20
Perspective Projection How do you do it mathematically? – Also using a 4x4 matrix 21 [songho.ca]
Perspective Projection Let’s try to make sense of it very simply Translating in z Output’s w depends on input’s z The further it is in z, the smaller it will get
Perspective Projection What that matrix does 23
Perspective Projection in Blender Select the camera The viewport is defined by the render output size Camera has – Field of view angle – Start and end clipping distances 24
Perspective vs Orthographic Projection 25 Perspective Orthographic Fov=60 ◦, distance = 1 Fov=30 ◦, distance = 3 Fov=10 ◦, distance = 5
Perspective vs Orthographic Projection Orthographic camera is a perspective camera where the camera is at the infinity and the field of view angle is zero 26
Perspective vs Orthographic Projection In this transition, the size of the arrow in the image stays the same This is also "called the “dolly-zoom”, “Hitchcock zoom”, or “vertigo effect” Demonstration in Unity and sample scenes from movies 27
For next week No homework Study what we learned today, there will be a quiz Next week, a part of the lab will be about projection 28