Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Transformations Rüdiger Westermann Lehrstuhl für Computer Graphik und.

Slides:



Advertisements
Similar presentations
Computer Graphics: 2D Transformations
Advertisements

3D Transformations Assist. Prof. Dr. Ahmet Sayar
Computer Graphics: 3D Transformations
Advanced Piloting Cruise Plot.
Chapter 1 The Study of Body Function Image PowerPoint
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Today Composing transformations 3D Transformations
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Points, Vectors, Lines, Spheres and Matrices
7.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 7 Introducing SVG Transformations on Elements.
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
GR2 Advanced Computer Graphics AGR
SI23 Introduction to Computer Graphics
ABC Technology Project
VOORBLAD.
Vector-Valued Functions 12 Copyright © Cengage Learning. All rights reserved.
© 2012 National Heart Foundation of Australia. Slide 2.
1Computer Graphics Homogeneous Coordinates & Transformations Lecture 11/12 John Shearer Culture Lab – space 2
Computer Graphics 02/10/09Lecture 41 Computer Graphics Lecture 3 Transformations.
Splines I – Curves and Properties
6.4 Best Approximation; Least Squares
Linear Algebra (Mathematics for CG) Reading: HB Appendix A
25 seconds left…...
Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Sampling Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Lighting Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
We will resume in: 25 Minutes.
PSSA Preparation.
Transformations Ed Angel Professor Emeritus of Computer Science
Principles of Computer-Aided Design and Manufacturing Second Edition 2004 ISBN Author: Prof. Farid. Amirouche University of Illinois-Chicago.
CS 691 Computational Photography Instructor: Gianfranco Doretto Image Warping.
Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Computer Graphics Lecture 4 Geometry & Transformations.
Transformations.
Geometric Transformations
CS5500 Computer Graphics March 22, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple.
3-D Geometry.
Transformations. 2 Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple geometry, most of us.
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
CS 450: Computer Graphics 2D TRANSFORMATIONS
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Geometric Objects and Transformation
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
CSE Real Time Rendering Week 5. Slides(Some) Courtesy – E. Angel and D. Shreiner.
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Affine Geometry.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Modeling Transformation
Computer Graphics CC416 Week 15 3D Graphics.
(c) University of Wisconsin, CS559
Presentation transcript:

Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Transformations Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung

Technische Universität München Computer Graphics Motivation In computer graphics we often have to transform objects –Define camera position and orientation - Viewing –Define object and light position, extend and orientation - Modelling –Get 3D objects onto 2D screen - Projection 2

Technische Universität München Computer Graphics Motivation Objects are typically modeled in a local object coordinate space –e.g. vertex coordinates are within the unit cube –Many objects are used to create the final scene 3

Technische Universität München Computer Graphics Motivation What we render is a portion of the global world coordinate space –Objects have to be placed in this space World coordinate system Object coordinate system 4

Technische Universität München Computer Graphics Motivation Objects are modeled once and they should then be rendered in multiple instances –Instances can be positioned at different locations, they can be scaled and rotated 5

Technische Universität München Computer Graphics Motivation Complex objects are often compose of multiple instances of base objects What we need is a general approach to arbitrarily transform objects in space 6

Technische Universität München Computer Graphics 3D Transformations 7

Technische Universität München Computer Graphics 3D Transformations Lemma:  L  M  ℝ 3x3 : L(p)= Mp,  p  ℝ 3 L(p) = L(x e 1 + y e 2 + z e 3 ) = x L(e 1 ) + y L(e 2 ) + z L(e 3 ) = x f 1 + y f 2 + z f 3 L(p) = M  [x,y,z] T with 8

Technische Universität München Computer Graphics 3D Transformations What kind of transformations can we imagine? –Move object: Translation –Change size of object: Scaling –Shear object: Shear 9

Technische Universität München Computer Graphics 3D Transformations What kind of transformations can we imagine? –Rotate object: Rotation Rotation is about a rotation axis Distance of points on the objects to rotation axis does not change 10

Technische Universität München Computer Graphics 3D Transformations Scaling, for instance about the x-axis –Multiplication of each coordinate with a scaling factor –Keeps direction of e i but changes their length f 1 =  e 1 = [  0 0] T f 2 =  e 2 = [0  0] T f 3 =  e 3 = [0 0  ] T yields 11

Technische Universität München Computer Graphics 3D Transformations Shear, for instance along the x-axis –Translation of x-coordinates about factor depending on y and/or z –Changes direction of some of the e i f 1 = e 1 = [1 0 0] T f 2 = s e 1 + e 2 = [s 1 0] T f 3 = e 3 = [0 0 1] T yields 12

Technische Universität München Computer Graphics 3D Transformations Rotations, for instance about the x-axis –Points on the x-axis remain fix –All other points rotate along a circle about the x-axis f 1 = e 1 = [1 0 0] T f 2 = [ 0, cos(  ), -sin(  ) ] T f 3 = [ 0, sin(  ), cos(  ) ] T yields  Z Y f3f3 f2f2 13

Technische Universität München Computer Graphics 3D Transformations Rotations, for instance about the y-axis –Points on the y-axis remain fix –All other points rotate along a circle about the y-axis f 1 = [ cos(  ), 0, sin(  ) ] T f 2 = e 2 = [0 1 0] T f 3 = [ -sin(  ), 0, cos(  ) ] T yields Z Y X 14

Technische Universität München Computer Graphics 3D Transformations Rotations, for instance about the z-axis –Points on the z-axis remain fix –All other points rotate along a circle about the z-axis f 1 = [ cos(  ), -sin(  ), 0 ] T f 2 = [ sin(  ), cos(  ), 0 ] T f 3 = e 3 = [0 0 1] T yields Z Y X 15

Technische Universität München Computer Graphics Transformation classes Affine transforms –Preserve parallel lines Translation Rotation Rigid Linear Similarity Isotropic Scaling Scaling Shear Reflection Identity Affine 16

Technische Universität München Computer Graphics Combining transformations (0,0) (1,1) (2,2) (0,0) (5,3) (3,1) Scale(2,2)Translate(3,1) TS = = Scale then Translate Use matrix multiplication: p' = T ( S p ) = TS p Caution: matrix multiplication is NOT commutative!

Technische Universität München Computer Graphics Combining transformations Scale then Translate: p' = T ( S p ) = TS p Translate then Scale: p' = S ( T p ) = ST p (0,0) (1,1) (4,2) (3,1) (8,4) (6,2) (0,0) (1,1) (2,2) (0,0) (5,3) (3,1) Scale(2,2)Translate(3,1) Scale(2,2) 18

Technische Universität München Computer Graphics Combining transformations TS = ST = Scale then Translate: p' = T ( S p ) = TS p = = Translate then Scale: p' = S ( T p ) = ST p

Technische Universität München Computer Graphics Combining transformations 20

Technische Universität München Computer Graphics 3D Transformations What is the inverse of a rotation? –It is the rotation about the same axis but using the negative angle of rotation –In general, the inverse of a transformation is just the inverse transformation matrix –In a rotation matrix, { p 1, p 2, p 3 } form an orthonormal basis (unit vectors are orthogonal to each other) ⇒ the inverse of a rotation matrix is just its transpose [ p 1, p 2, p 3 ] -1 = [ p 1, p 2, p 3 ] T 21

Technische Universität München Computer Graphics 3D Transformations How does the mapping from one rotation onto another rotation look like? –{ p 1, p 2, p 3 }  { q 1, q 2, q 3 } ??? –[ p 1, p 2, p 3 ] : { e 1, e 2, e 3 }  { p 1, p 2, p 3 } –[ q 1, q 2, q 3 ] : { e 1, e 2, e 3 }  { q 1, q 2, q 3 } –[ p 1, p 2, p 3 ] -1 : { p 1, p 2, p 3 }  { e 1, e 2, e 3 } –[ q 1, q 2, q 3 ][ p 1, p 2, p 3 ] -1 : { p 1, p 2, p 3 }  { q 1, q 2, q 3 } 22

Technische Universität München Computer Graphics 3D Transformations Arbitrary axis of rotation –How does the transformation look like if we want to rotate about an arbitrary axis of rotation? –Can be obtained by concatenation of transformations, i.e. by multiplying the respective matrices 23

Technische Universität München Computer Graphics 3D Transformations Arbitrary axis of rotation 1. Translate so that rotation axis passes through origin - Use coordinates of any point along the axis 2. Rotate so that the rotation axis is aligned with one of the principle coordinate axes - See next slide 3. Perform rotation of object about coordinate axis - Use standard rotation matrix 4. Perform inverse rotation of (2) 5. Perform inverse translation of (1) 24

Technische Universität München Computer Graphics 3D Transformations Arbitrary axis of rotation 1. Rotate so that the rotation axis r is aligned with one of the principle coordinate axes Determine an orthogonal basis {r, s, t} s = r x e 1 or r x e 2 if e 1 colinear to r t = r x s normalize r, s, t Change basis to r, s, t M = [r, s, t ] -1 25

Technische Universität München Computer Graphics 3D Transformations Translations –Moving every point a constant distance in a specified direction f 1 = [ 1 + t x, 0, 0 ] T f 2 = [ 0, 1 + t y, 0 ] T f 3 = [ 0, 0, 1 + t z ] T yields Wrong 26

Technische Universität München Computer Graphics 3D Transformations Translations –Translation is NOT linear; cannot be represented in a 3x3 matrix (image of origin: L(0) = 0) –Affine transformation = linear transformation + translation A : p  L(p) + t –Matrix representation  extended coordinates 27

Technische Universität München Computer Graphics 3D Transformations Translations –Expressing points and vectors in extended coordinates; What should happen to a point/vector under translation? A vector should remain unchanged Therefore: Point: [x y z 1] T Vector: [x y z 0] T 28

Technische Universität München Computer Graphics 3D Transformations Rendering (ray-tracing) transformed objects for (each model m) do build the model matrix M to position, orient, scale m for (each vertex v) do v´ = Mv// model matrix for vertices n´ = (M T ) -1 n// inverse transpose for normals endo// see board endo raytrace(scene) 29