Transformations III. Week 2, Fri Jan 19

Similar documents
Transformations II. Week 2, Wed Jan 17

Transformations III. Week 3, Mon Jan 18

Notes. University of British Columbia

Transformations IV. Week 3, Mon Jan 22

Transformations IV. Week 3, Wed Jan 20

Viewing/Projections III. Week 4, Wed Jan 31

Viewing/Projection IV. Week 4, Fri Jan 29

1/29/13. Computer Graphics. Transformations. Simple Transformations

CSE328 Fundamentals of Computer Graphics: Theory, Algorithms, and Applications

News. Projections and Picking. Transforming View Volumes. Projections recap. Basic Perspective Projection. Basic Perspective Projection

6. Modelview Transformations

Modeling Transformations

Modeling Transformations

Using GLU/GLUT Objects. GLU/GLUT Objects. glucylinder() glutwirecone() GLU/GLUT provides very simple object primitives

Viewing/Projections IV. Week 4, Fri Feb 1

Modeling Transformations

Modeling Transformations

CS559: Computer Graphics

Image Warping. Some slides from Steve Seitz

1. We ll look at: Types of geometrical transformation. Vector and matrix representations

Name: [20 points] Consider the following OpenGL commands:

Scene Graphs & Modeling Transformations COS 426

Computer Graphics. P04 Transformations. Aleksandra Pizurica Ghent University

Image Warping : Computational Photography Alexei Efros, CMU, Fall Some slides from Steve Seitz

Modeling Transformations

Computer Graphics. Geometric Transformations

Transformations II. Arbitrary 3D Rotation. What is its inverse? What is its transpose? Can we constructively elucidate this relationship?

Homogeneous Coordinates

CPSC 314, Midterm Exam. 8 March 2010

Image Warping (Szeliski Sec 2.1.2)

Computer Graphics. Geometric Transformations

Image Warping. Some slides from Steve Seitz

CS 428: Fall Introduction to. Viewing and projective transformations. Andrew Nealen, Rutgers, /23/2009 1

CS Computer Graphics: Transformations & The Synthetic Camera

CPSC 314, Midterm Exam 1. 9 Feb 2007

(x, y) (ρ, θ) ρ θ. Polar Coordinates. Cartesian Coordinates

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CS 428: Fall Introduction to. Transformations in OpenGL + hierarchical modeling. Andrew Nealen, Rutgers, /21/2009 1

Image Warping CSE399b, Spring 07 Computer Vision

Lecture 5: Transforms II. Computer Graphics and Imaging UC Berkeley CS184/284A

CS770/870 Spring 2017 Transformations

Lecture 5b. Transformation

Viewing and Projection

4. Two Dimensional Transformations

What and Why Transformations?

Image warping. image filtering: change range of image. image warping: change domain of image g(x) = f(h(x)) h(y)=0.5y+0.5. h([x,y])=[x,y/2] f h

Transforms 1 Christian Miller CS Fall 2011

CMSC 425: Lecture 10 Basics of Skeletal Animation and Kinematics

To Do. Demo (Projection Tutorial) Motivation. What we ve seen so far. Outline. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 5: Viewing

Hierarchical Modeling. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Computer Graphics. 2D transformations. Transforma3ons in computer graphics. Overview. Basic classes of geometric transforma3ons

CS 2770: Intro to Computer Vision. Multiple Views. Prof. Adriana Kovashka University of Pittsburgh March 14, 2017

2D/3D Geometric Transformations and Scene Graphs

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

To Do. Motivation. Demo (Projection Tutorial) What we ve seen so far. Computer Graphics. Summary: The Whole Viewing Pipeline

IMGD The Game Development Process: 3D Modeling and Transformations

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

Chapter 3: Modeling Transformation

CSCI-4530/6530 Advanced Computer Graphics

Reading. Topics in Articulated Animation. Character Representation. Animation. q i. t 1 t 2. Articulated models: Character Models are rich, complex

Motivation. What we ve seen so far. Demo (Projection Tutorial) Outline. Projections. Foundations of Computer Graphics

Transformations. Examples of transformations: shear. scaling

MEM380 Applied Autonomous Robots Winter Robot Kinematics

Two possible ways to specify transformations. Each part of the object is transformed independently relative to the origin

To Do. Course Outline. Course Outline. Goals. Motivation. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1

CS4670: Computer Vision

CPSC 314, Midterm Exam. 8 March 2013

Modeling Transformations Revisited

Computer Graphics Geometric Transformations

Reading. Hierarchical Modeling. Symbols and instances. Required: Angel, sections , 9.8. Optional:

Last Time. Correct Transparent Shadow. Does Ray Tracing Simulate Physics? Does Ray Tracing Simulate Physics? Refraction and the Lifeguard Problem

3D Geometry and Camera Calibration

Geometric Model of Camera

OpenGL/GLUT Intro. Week 1, Fri Jan 12

Lecture 6 Sections 4.3, 4.6, 4.7. Wed, Sep 9, 2009

Uses of Transformations. 2D transformations Homogeneous coordinates. Transformations. Transformations. Transformations. Transformations and matrices

Affine Transformations in 3D

What does OpenGL do?

5.8.3 Oblique Projections

Lecture 4: Viewing. Topics:

More on Transformations. COS 426, Spring 2019 Princeton University

Geometric Transformations

Warping, Morphing and Mosaics

Affine and Projective Transformations

Today s class. Geometric objects and transformations. Informationsteknologi. Wednesday, November 7, 2007 Computer Graphics - Class 5 1

T y. x Ax By Cz D. z Ix Jy Kz L. Geometry: Topology: Transformations

Graphics pipeline and transformations. Composition of transformations

Hierarchical Modeling and scene graphs

Projection: Mapping 3-D to 2-D. Orthographic Projection. The Canonical Camera Configuration. Perspective Projection

Two Dimensional Viewing

Computer Graphics. Chapter 5 Geometric Transformations. Somsak Walairacht, Computer Engineering, KMITL

CSC 470 Computer Graphics

CS F-07 Objects in 2D 1

Modeling Objects. Modeling. Symbol-Instance Table. Instance Transformation. Each appearance of the object in the model is an instance

CS 4204 Computer Graphics

Where We Are: Static Models

Determining the 2d transformation that brings one image into alignment (registers it) with another. And

Computer Graphics. Chapter 7 2D Geometric Transformations

Specifying Complex Scenes

6.837 Computer Graphics Hierarchical Modeling Wojciech Matusik, MIT EECS Some slides from BarbCutler & Jaakko Lehtinen

Transcription:

Universit of British Columbia CPSC 34 Computer Graphics Jan-Apr 2007 Tamara Munzner Transformations III Week 2, Fri Jan 9 http://www.ugrad.cs.ubc.ca/~cs34/vjan2007

Readings for Jan 5-22 FCG Chap 6 Transformation Matrices ecept 6..6, 6.3. FCG Sect 3.3 Scene Graphs RB Chap Viewing Viewing and Modeling Transforms until Viewing Transformations Eamples of Composing Several Transformations through Building an Articulated Robot Arm RB Appendi Homogeneous Coordinates and Transformation Matrices until Perspective Projection RB Chap Displa Lists 2

News reminder: office hours toda after class in 0 lab reminder: course newsgroup is ubc.courses.cpsc.44 3

4 Review: Shear, Reflection shear along ais push points to right in proportion to height reflect across ais mirror + = 0 0 0 sh + = 0 0 0 0

5 Review: 2D Transformations = + + = + ' ' b a b a ( ) ( ) ( ) ( ) = cos sin sin cos ' ' = b a 0 0 ' ' scaling matri rotation matri = ' ' d c b a translation multiplication matri?? vector addition matri multiplication matri multiplication ), ( b a (,) (_, _)

Review: Linear Transformations linear transformations are combinations of shear scale rotate reflect ' ' a c b d properties of linear transformations satisifes T(s+t) = s T() + t T() origin maps to origin lines map to lines parallel lines remain parallel ratios are preserved closed under composition = ' = ' = a c + + b d 6

Correction: Composing Transformations scaling S2 S = rotation s s 2 s s 2 so scales multipl R2 R = cos( + 2) sin( + 2) sin( + 2) cos( + 2) so rotations add 7

8 Review: 3D Homog Transformations use 44 matrices for 3D transformations = ' ' ' z c b a z translate(a,b,c) translate(a,b,c) = cos sin sin cos ' ' ' z z ), ( Rotate = ' ' ' z c b a z scale(a,b,c) scale(a,b,c) cos sin sin cos ), ( Rotate cos sin sin cos ), ( Rotate z

9 Review: Affine Transformations affine transforms are combinations of linear transformations translations properties of affine transformations origin does not necessaril map to origin lines map to lines parallel lines remain parallel ratios are preserved closed under composition = w f e d c b a w 0 0 ' '

More: Composing Transformations Ta Tb = Tb Ta, but Ra Rb!= Rb Ra and Ta Rb!= Rb Ta rotations around different aes do not commute 0

Review: Composing Transformations p'= TRp which direction to read? right to left interpret operations wrt fied coordinates moving object left to right OpenGL pipeline ordering! interpret operations wrt local coordinates changing coordinate sstem OpenGL updates current matri with postmultipl gltranslatef(2,3,0); glrotatef(-90,0,0,); glvertef(,,); specif vector last, in final coordinate sstem first matri to affect it is specified second-to-last

Interpreting Transformations translate b (-,0) moving object (2,) (,) intuitive? changing coordinate sstem (,) OpenGL same relative position between object and basis vectors 2

Matri Composition matrices are convenient, efficient wa to represent series of transformations general purpose representation hardware matri multipl matri multiplication is associative p_ = (T*(R*(S*p))) p_ = (T*R*S)*p procedure correctl order our matrices! multipl matrices together result is one matri, multipl vertices b this matri all vertices easil transformed with one matri multipl 3

Rotation About a Point: Moving Object rotate about p b : translate p to origin rotate about origin translate p back p = (, ) F W T(,,z)R(z,)T(,, z) 4

Rotation: Changing Coordinate Sstems same eample: rotation around arbitrar center 5

Rotation: Changing Coordinate Sstems rotation around arbitrar center step : translate coordinate sstem to rotation center 6

Rotation: Changing Coordinate Sstems rotation around arbitrar center step 2: perform rotation 7

Rotation: Changing Coordinate Sstems rotation around arbitrar center step 3: back to original coordinate sstem 8

General Transform Composition transformation of geometr into coordinate sstem where operation becomes simpler tpicall translate to origin perform operation transform geometr back to original coordinate sstem 9

Rotation About an Arbitrar Ais ais defined b two points translate point to the origin rotate to align ais with z-ais (or or ) perform rotation undo aligning rotations undo translation 20

Arbitrar Rotation Y Z W V problem: given two orthonormal coordinate sstems XYZ and UVW find transformation from one to the other answer: X transformation matri R whose columns are U,V,W: u v w R = u v w u z v z w z U

Arbitrar Rotation wh? u v w R(X) = u v w 0 u z v z w z 0 = (u,u,u z ) = U similarl R(Y) = V & R(Z) = W 22

Transformation Hierarchies 23

Transformation Hierarchies scene ma have a hierarch of coordinate sstems stores matri at each level with incremental transform from parent s coordinate sstem scene graph road stripe stripe2... car car2... w w2 w3 w4 24

Transformation Hierarch Eample world torso LUleg RUleg LUarm RUarm head LLleg RLleg LLarm RLarm Lfoot Rfoot Lhand Rhand trans(0.30,0,0) rot(z, ) 25

Transformation Hierarchies hierarchies don t fall apart when changed transforms appl to graph nodes beneath 26

Demo: Brown Applets http://www.cs cs.brown..brown.edu/eploratories/ freesoftware/catalogs/ /catalogs/scenegraphs.html 27

Transformation Hierarch Eample 2 draw same 3D data with different transformations: instancing 28

Matri Stacks challenge of avoiding unnecessar computation using inverse to return to origin computing incremental T -> T 2 Object coordinates T () T 2 () T 3 () World coordinates 29

Matri Stacks glpushmatri() D = C scale(2,2,2) trans(,0,0) glpopmatri() C D DrawSquare() C C C C glpushmatri() B A B A B A B A glscale3f(2,2,2) gltranslate3f(,0,0) DrawSquare() glpopmatri() 30

Modularization drawing a scaled square push/pop ensures no coord sstem change void drawblock(float k) { glpushmatri(); glscalef(k,k,k); glbegin(gl_line_loop); glverte3f(0,0,0); glverte3f(,0,0); glverte3f(,,0); glverte3f(0,,0); glend(); } glpopmatri(); 3

advantages Matri Stacks no need to compute inverse matrices all the time modularize changes to pipeline state avoids incremental changes to coordinate sstems accumulation of numerical errors practical issues in graphics hardware, depth of matri stacks is limited (tpicall 6 for model/view and about 4 for projective matri) 32

Transformation Hierarch Eample 3 F h F h F h F F h F h F h glloadidentit(); gltranslatef(4,,0); glpushmatri(); glrotatef(45,0,0,); gltranslatef(0,2,0); glscalef(2,,); gltranslate(,0,0); glpopmatri(); F W 33

Transformation Hierarch Eample 4 2 4 5 3 gltranslate3f(,,0); glrotatef( (,0,0,); DrawBod(); glpushmatri(); gltranslate3f(0,7,0); DrawHead(); glpopmatri(); glpushmatri(); gltranslate(2.5,5.5,0); glrotatef( ( 2,0,0,); DrawUArm(); gltranslate(0,-3.5,0); glrotatef( ( 3,0,0,); DrawLArm(); glpopmatri();... (draw other arm) 34

Hierarchical Modelling advantages define object once, instantiate multiple copies transformation parameters often good control knobs maintain structural constraints if well-designed limitations epressivit: not alwas the best controls can t do closed kinematic chains keep hand on hip can t do other constraints collision detection self-intersection walk through walls 35

Single Parameter: Simple parameters as functions of other params clock: control all hands with seconds s m = s/60, h=m/60, theta_s = (2 pi s) / 60, theta_m = (2 pi m) / 60, theta_h = (2 pi h) / 60 36

Single Parameter: Comple mechanisms not easil epressible with affine transforms http://www.fling-pig.co.uk 37

Single Parameter: Comple mechanisms not easil epressible with affine transforms http://www.fling-pig.co.uk uk/mechanisms/pages/irregular.html 38