Lecture 2 Transformations

Slides:



Advertisements
Similar presentations
Computer Graphics 02/10/09Lecture 41 Computer Graphics Lecture 3 Transformations.
Advertisements

Computer Graphics Lecture 4 Geometry & Transformations.
Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Transformations Rüdiger Westermann Lehrstuhl für Computer Graphik und.
Transformations.
Two-Dimensional Geometric Transformations
Transformations II Week 2, Wed Jan 17
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz
Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of coordinate systems Translation Scaling Rotation.
Transformations Objectives Understand how transformations work in 2D and 3D Understand the concept of homogenous coordinate system Understand scene graphs.
3-D Geometry.
Computer Graphics with OpenGL 3e
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Mathematical Fundamentals
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Transformations Dr. Amy Zhang.
Chapter 2 Robot Kinematics: Position Analysis
Transformation & Projection Feng Yu Proseminar Computer Graphics :
Lecture Notes: Computer Graphics.
Geometric Transforms Changing coordinate systems.
Autonomous Navigation for Flying Robots Lecture 2.2: 2D Geometry
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
Geometric Transformations
Computer Graphics 2D Transformations. 2 of 74 Contents In today’s lecture we’ll cover the following: –Why transformations –Transformations Translation.
Robot Kinematics: Position Analysis 2.1 INTRODUCTION  Forward Kinematics: to determine where the robot ’ s hand is? (If all joint variables are known)
Transformation.
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
Geometric Transformations Hearn & Baker Chapter 5 Some slides are taken from Robert Thomsons notes.
Geometric Transformations
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
3-D Geometric Transformations
3D Geometric Transformation
3D Geometric Transformation
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Modeling Transformation
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
Instructor: Dr. Shereen Aly Taie Basic Two-Dimensional Geometric Transformation 5.2 Matrix Representations and Homogeneous Coordinates 5.3 Inverse.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
Chapter 11 Three-Dimensional Geometric and Modeling Transformations
Computer Graphics 2D Transformations
Geometric Transformations
3D Geometric Transformation
Geometric Transformations Hearn & Baker Chapter 5
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics Transformations.
2D Transformations with Matrices
Review: Transformations
3D Transformation.
3D Geometric Transformations
Computer Graphics Transformations.
Introduction to Computer Graphics CS 445 / 645
Review: Transformations
Linear Algebra Review.
Transformations.
COMP 175: Computer Graphics February 9, 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Transformations 3 University of British Columbia
Chapter IV Spaces and Transforms
2D Geometric Transformations
Transformations 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Geometrical Transformations
Transformations 2 University of British Columbia
TWO DIMENSIONAL TRANSFORMATION
The Pinhole Camera Model
Presentation transcript:

Lecture 2 Transformations Computer Graphics Lecture 2 Transformations Lecture 2

Transformations. What is a transformation? P=T(P)‏ What does it do? Transform the coordinates / normal vectors of objects Why use them? Modelling -Moving the objects to the desired location in the environment -Multiple instances of a prototype shape -Kinematics of linkages/skeletons – character animation Viewing Virtual camera: parallel and perspective projections Transformations are very important.

Types of Transformations Geometric Transformations Translation Rotation scaling Linear (preserves parallel lines)‏ Non-uniform scales, shears or skews Projection (preserves lines)‏ Perspective projection Parallel projection Non-linear (lines become curves)‏ Twists, bends, warps, morphs,

Geometric Transformation Once the models are prepared, we need to place them in the environment Objects are defined in their own local coordinate system We need to translate, rotate and scale them to put them into the world coordinate system 17/09/2018 Lecture 1

2D Translations. P’ P

2D Scaling from the origin. P’ P

2D Rotation about the origin. y x r P’(x’,y’)‏ P(x,y)‏ 

2D Rotation about the origin. y P’(x’,y’)‏ P(x,y)‏ r  y r  x x

2D Rotation about the origin. y P’(x’,y’)‏ P(x,y)‏ r  y r  x x

2D Rotation about the origin. Substituting for r : Gives us :

2D Rotation about the origin. Rewriting in matrix form gives us :

Transformations. Translation. Scale Rotation P=T + P P=S  P P=R  P We would like all transformations to be multiplications so we can concatenate them  express points in homogenous coordinates.

Homogeneous coordinates Add an extra coordinate, W, to a point. P(x,y,W). Two sets of homogeneous coordinates represent the same point if they are a multiple of each other. (2,5,3) and (4,10,6) represent the same point. If W 0 , divide by it to get Cartesian coordinates of point (x/W,y/W,1). If W=0, point is said to be at infinity. V. important

Translations in homogenised coordinates Transformation matrices for 2D translation are now 3x3.

Concatenation. When we perform 2 translations on the same point

Concatenation. Matrix product is variously referred to as compounding, concatenation, or composition

Concatenation. Matrix product is variously referred to as compounding, concatenation, or composition.

Properties of translations. Note : 3. translation matrices are commutative.

Homogeneous form of scale. Recall the (x,y) form of Scale : In homogeneous coordinates :

Concatenation of scales.

Homogeneous form of rotation.

Orthogonality of rotation matrices.

Other properties of rotation.

How are transforms combined? Scale then Translate (5,3)‏ Scale(2,2)‏ (2,2)‏ Translate(3,1)‏ (1,1)‏ (3,1)‏ (0,0)‏ (0,0)‏ Use matrix multiplication: p' = T ( S p ) = TS p 1 1 1 3 1 2 1 2 1 2 2 3 1 TS = = Caution: matrix multiplication is NOT commutative! 02/10/09 Lecture 4

Non-commutative Composition Scale then Translate: p' = T ( S p ) = TS p (5,3)‏ Scale(2,2)‏ (2,2)‏ Translate(3,1)‏ (1,1)‏ (3,1)‏ (0,0)‏ (0,0)‏ Translate then Scale: p' = S ( T p ) = ST p (8,4)‏ Translate(3,1)‏ (4,2)‏ Scale(2,2)‏ (1,1)‏ (6,2)‏ (3,1)‏ (0,0)‏ 02/10/09 Lecture 4

Non-commutative Composition Scale then Translate: p' = T ( S p ) = TS p 1 1 3 1 2 2 1 2 2 3 1 TS = = Translate then Scale: p' = S ( T p ) = ST p 2 1 2 1 1 1 3 1 1 2 2 6 2 ST = = 02/10/09 Lecture 4

How are transforms combined? Rotate then Translate (3,sqrt(2))‏ (0,sqrt(2))‏ (1,1)‏ Rotate 45 deg‏ Translate(3,0)‏ (0,0)‏ (0,0)‏ (3,0)‏ Translate then Rotate (1,1)‏ Translate(3,0)‏ (3/sqrt(2),3/sqrt(2))‏ Rotate 45 deg‏ (0,0)‏ (0,0)‏ (3,0)‏ Caution: matrix multiplication is NOT commutative! 02/10/09 Lecture 4

Non-commutative Composition Rotate then Translate: p' = T ( R p ) = TR p 1 1 3 1 1 1 1 -1 -1 -1 1 1 1 -1 3 1 TR = = Translate then Rotate: p' = R ( T p ) = RT p 1 1 1 -1 -1 -1 1 1 1 1 1 1 3 1 1 -1 -1 3 1 RT = = 02/10/09 Lecture 4

Types of transformations. Rotation and translation Angles and distances are preserved Unit cube is always unit cube Rigid-Body transformations. Rotation, translation and scale. Angles & distances not preserved. But parallel lines are.

Transformations of coordinate systems. Have been discussing transformations as transforming points. Always need to think the transformation in the world coordinate system Sometimes this might not be so convenient i.e. rotating objects at its location

Transformations of coordinate systems - Example Concatenate local transformation matrices from left to right Can obtain the local – world transformation matrix p’,p’’,p’’’ are the world coordinates of p after each transformation

Transformations of coordinate systems - example is the world coordinate of point p after n transformations

Quiz I sat in the car, and find the side mirror is 0.4m on my right and 0.3m in my front I started my car and drove 5m forward, turned 30 degrees to right, moved 5m forward again, and turned 45 degrees to the right, and stopped What is the position of the side mirror now, relative to where I was sitting in the beginning?

Solution The side mirror position is locally (0,4,0.3)‏ The matrix of first driving forward 5m is

Solution The matrix to turn to the right 30 and 45 degrees (rotating -30 and -45 degrees around the origin) are

Solution The local-to-global transformation matrix at the last configuration of the car is The final position of the side mirror can be computed by TR1TR2 p which is around (2.89331, 9.0214)‏

This is convenient for character animation / robotics In robotics / animation, we often want to know what is the current 3D location of the end effectors (like the hand)‏ Can concatenate matrices from the origin of the body towards the end effecter

Transformations of coordinate systems. Lecture 4

3D Transformations. Use homogeneous coordinates, just as in 2D case. Transformations are now 4x4 matrices. We will use a right-handed (world) coordinate system - ( z out of page ). z (out of page)‏ y x 02/10/09 Lecture 4

Translation in 3D. Simple extension to the 3D case:

Scale in 3D. Simple extension to the 3D case:

Rotation in 3D Need to specify which axis the rotation is about. z-axis rotation is the same as the 2D case.

Rotating About the x-axis Rx()‏

Rotating About the y-axis Ry()‏

Rotation About the z-axis Rz()‏

Rotation about an arbitrary axis Rotate(k, θ)‏ y θ About (ux, uy, uz), a unit vector on an arbitrary axis u x z x' y' z' 1 uxux(1-c)+c uyux(1-c)+uzs uzux(1-c)-uys uzux(1-c)-uzs uzux(1-c)+c uyuz(1-c)+uxs uxuz(1-c)+uys uyuz(1-c)-uxs uzuz(1-c)+c 1 x y z 1 = where c = cos θ & s = sin θ

Rotation Not commutative if the axis of rotation are not parallel 02/10/09

Shearing

Calculating the world coordinates of all vertices For each object, there is a local-to-global transformation matrix So we apply the transformations to all the vertices of each object We now know the world coordinates of all the points in the scene

Normal Vectors We also need to know the direction of the normal vectors in the world coordinate system This is going to be used at the shading operation We only want to rotate the normal vector Do not want to translate it

Normal Vectors - (2)‏ We need to set elements of the translation part to zero

Viewing Now we have the world coordinates of all the vertices Now we want to convert the scene so that it appears in front of the camera

Mw←c View Transformation We want to know the positions in the camera coordinate system We can compute the camera-to-world transformation matrix using the orientation and translation of the camera from the origin of the world coordinate system Mw←c Lecture 4

vw = Mw←c vc = Mc ← w vw View Transformation We want to know the positions in the camera coordinate system vw = Mw←c vc vc = Mw ← c vw = Mc ← w vw Point in the camera coordinate Camera-to-world transformation Point in the world coordinate -1

Summary. Transformations: translation, rotation and scaling Using homogeneous transformation, 2D (3D) transformations can be represented by multiplication of a 3x3 (4x4) matrix Multiplication from left-to-right can be considered as the transformation of the coordinate system Need to multiply the camera matrix from the left at the end Reading: Foley et al. Chapter 5, Appendix 2 sections A1 to A5 for revision and further background (Chapter 5)‏