University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Transformations III Week.

Slides:



Advertisements
Similar presentations
Computer Graphics 2D & 3D Transformation.
Advertisements

Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Transformations III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Transformations II Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Display Lists, Viewing.
University of British Columbia CPSC 314 Computer Graphics May-June 2005 Tamara Munzner Transformations I, II,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections I.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations Week 2,
Transformations II Week 2, Wed Jan 17
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Math Review Rendering.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
Transformations IV Week 3, Wed Jan 23
© Tamara Munzner University of British Columbia Hierarchical modelling recap: composing transforms recap: composing transforms finish: rendering pipeline.
Modeling Objects by Polygonal Approximations
Objectives Learn to build arbitrary transformation matrices from simple transformations Learn to build arbitrary transformation matrices from simple transformations.
1 Geometrical Transformation Tong-Yee Lee. 2 Modeling Transform Specify transformation for objects Allow definitions of objects in own coordinate systems.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Math Review Week 1, Wed.
University of British Columbia CPSC 414 Computer Graphics Week 3, Monday 15 Oct 03 © Tamara Munzner 1 Hierarchies, Display Lists recap: matrix hierarchies,
University of British Columbia © MIchiel van de Panne An Introduction to Computer Animation Michiel van de Panne.
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
Graphics Graphics Korea University kucg.korea.ac.kr Transformations 고려대학교 컴퓨터 그래픽스 연구실.
Transforms Hierarchical Modeling Scene Graphs Using hierarchical modeling techniques in 3D software design Transforms Local basis Matrix math review Matrices.
Week 4 Lecture 1: Hierarchical Modeling Part 1 Based on Interactive Computer Graphics (Angel) - Chapter 10 1 Angel: Interactive Computer Graphics 5E ©
Hierarchical Modeling. Instance Transformation Start with a prototype object (a symbol) Each appearance of the object in the model is an instance – Must.
Hierarchical Modeling CS418 Computer Graphics John C. Hart.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Transformations Tutorial
1/50 CS148: Introduction to Computer Graphics and Imaging Transforms CS148: Introduction to Computer Graphics and Imaging Transforms.
2 COEN Computer Graphics I Evening’s Goals n Discuss viewing and modeling transformations n Describe matrix stacks and their uses n Show basic geometric.
3D Transformations. Translation x’ = x + tx y’ = y + ty z’ = z + tz P = P’ = T = P’ = T. P tx ty tz xyz1xyz1 x’ y’ z’ 1 x y.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 OpenGL Transformations.
Computer Graphics I, Fall 2008 Hierarchical Modeling II.
Transformations
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Hierarchical Modeling.
CS552: Computer Graphics Lecture 4: 2D Graphics. Recap 2D Graphics Coordinate systems 2D Transformations o Translation o Scaling o Rotation Combining.
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
CS559: Computer Graphics Lecture 13: Hierarchical Modeling and Curves Li Zhang Spring 2010.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
CSCE 441: Computer Graphics: Hierarchical Models Jinxiang Chai.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
The Modelview Stack Lecture 9 Wed, Sep 12, The Modelview Stack OpenGL maintains a stack of matrices. The matrix on top of the stack is the current.
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
Final Review I University of British Columbia
Transformations 5 University of British Columbia
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Transformations V, Viewing I Week 3, Fri Jan 22
Computer Graphics - Hierarchical Models-
Transformations 6 University of British Columbia
Geometric Transformations
CSCE 441: Computer Graphics: Hierarchical Models
Transformations 3 University of British Columbia
Transformations IV Week 3, Wed Jan 20
Geometric Transformations
Transformations 4 University of British Columbia
The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.
Transformations in OpenGL
Transformations IV Week 3, Mon Jan 22
Transformations III Week 3, Mon Jan 21
Transformations II Week 2, Fri Jan 18
Viewing/Projections I Week 3, Fri Jan 25
Transformations IV Week 3, Wed Jan 23
Transformations 2 University of British Columbia
Geometric Transformations
Dr. Chih-Kuo Yeh 葉智國 Computer Graphics Dr. Chih-Kuo Yeh 葉智國
Hierarchical Modeling
CSCE 441: Computer Graphics: Hierarchical Models
Presentation transcript:

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Transformations III Week 3, Mon Jan 21

2 Readings for Jan FCG Chap 6 Transformation Matrices except 6.1.6, FCG Sect 13.3 Scene Graphs RB Chap Viewing Viewing and Modeling Transforms until Viewing Transformations Examples of Composing Several Transformations through Building an Articulated Robot Arm RB Appendix Homogeneous Coordinates and Transformation Matrices until Perspective Projection RB Chap Display Lists

3 News Homework 1 out today

4 Review: 3D Transformationstranslate(a,b,c) scale(a,b,c)shear(hxy,hxz,hyx,hyz,hzx,hzy)

5 Review: Composing Transformations Ta Rb != Rb Ta

6 Review: Composing Transformations which direction to read? right to left interpret operations wrt fixed coordinates moving object left to right interpret operations wrt local coordinates changing coordinate system OpenGL updates current matrix with postmultiply glTranslatef(2,3,0); glRotatef(-90,0,0,1); glVertexf(1,1,1); OpenGL pipeline ordering!

7 Matrix Composition matrices are convenient, efficient way to represent series of transformations general purpose representation hardware matrix multiply matrix multiplication is associative p′ = (T*(R*(S*p))) p′ = (T*R*S)*p procedure correctly order your matrices! multiply matrices together result is one matrix, multiply vertices by this matrix all vertices easily transformed with one matrix multiply

8 Rotation About a Point: Moving Object FWFWFWFW translate p to origin rotate about p by : p by : rotate about origin translate p back

9 Rotation: Changing Coordinate Systems same example: rotation around arbitrary center

10 Rotation: Changing Coordinate Systems rotation around arbitrary center step 1: translate coordinate system to rotation center

11 Rotation: Changing Coordinate Systems rotation around arbitrary center step 2: perform rotation

12 Rotation: Changing Coordinate Systems rotation around arbitrary center step 3: back to original coordinate system

13 General Transform Composition transformation of geometry into coordinate system where operation becomes simpler typically translate to origin perform operation transform geometry back to original coordinate system

14 Rotation About an Arbitrary Axis axis defined by two points translate point to the origin rotate to align axis with z-axis (or x or y) perform rotation undo aligning rotations undo translation

Arbitrary Rotation arbitrary rotation: change of basis given two orthonormal coordinate systems XYZ and ABC A ’ s location in the XYZ coordinate system is (a x, a y, a z, 1),... transformation from one to the other is matrix R whose columns are A,B,C: Y Z X B C A Y Z X B C A (c x, c y, c z, 1) (a x, a y, a z, 1) (b x, b y, b z, 1)

16 Transformation Hierarchies

17 Transformation Hierarchies scene may have a hierarchy of coordinate systems stores matrix at each level with incremental transform from parent’s coordinate system scene graphroadstripe1 stripe2... car1car2... w1w3w2w4

18 Transformation Hierarchy Example 1 torso head RUarm RLarm Rhand RUleg RLleg Rfoot LUarm LLarm Lhand LUleg LLleg Lfootworld trans(0.30,0,0) rot(z, )

19 Transformation Hierarchy Example 2 draw same 3D data with different transformations: instancing

20 Transformation Hierarchies Demo transforms apply to graph nodes beneath scenegraphs.html

21 Transformation Hierarchies Demo transforms apply to graph nodes beneath scenegraphs.html

22 Matrix Stacks challenge of avoiding unnecessary computation using inverse to return to origin computing incremental T 1 -> T 2 Object coordinates World coordinates T 1 (x) T 2 (x) T 3 (x)

23 Matrix Stacks glPushMatrix() glPopMatrix() A B C A B C A B C C glScale3f(2,2,2) D = C scale(2,2,2) trans(1,0,0) A B C D DrawSquare() glTranslate3f(1,0,0) DrawSquare() glPushMatrix() glPopMatrix()

24 Modularization drawing a scaled square push/pop ensures no coord system change void drawBlock(float k) { glPushMatrix(); glPushMatrix(); glScalef(k,k,k); glScalef(k,k,k); glBegin(GL_LINE_LOOP); glBegin(GL_LINE_LOOP); glVertex3f(0,0,0); glVertex3f(0,0,0); glVertex3f(1,0,0); glVertex3f(1,0,0); glVertex3f(1,1,0); glVertex3f(1,1,0); glVertex3f(0,1,0); glVertex3f(0,1,0); glEnd(); glEnd(); glPopMatrix(); glPopMatrix();}

25 Matrix Stacks advantages no need to compute inverse matrices all the time modularize changes to pipeline state avoids incremental changes to coordinate systems accumulation of numerical errors practical issues in graphics hardware, depth of matrix stacks is limited (typically 16 for model/view and about 4 for projective matrix)

26 Transformation Hierarchy Example 3 FWFWFWFW FhFhFhFh FhFhFhFh glLoadIdentity();glTranslatef(4,1,0);glPushMatrix();glRotatef(45,0,0,1);glTranslatef(0,2,0);glScalef(2,1,1);glTranslate(1,0,0);glPopMatrix(); F1F1F1F1 FhFhFhFh FhFhFhFh FhFhFhFh FhFhFhFh FhFhFhFh

27 Transformation Hierarchy Example 4 x y glTranslate3f(x,y,0); glRotatef(,0,0,1); DrawBody();glPushMatrix(); glTranslate3f(0,7,0); glTranslate3f(0,7,0); DrawHead(); DrawHead();glPopMatrix();glPushMatrix(); glTranslate(2.5,5.5,0); glTranslate(2.5,5.5,0); glRotatef(,0,0,1); glRotatef(,0,0,1); DrawUArm(); DrawUArm(); glTranslate(0,-3.5,0); glTranslate(0,-3.5,0); glRotatef(,0,0,1); glRotatef(,0,0,1); DrawLArm(); DrawLArm();glPopMatrix();... (draw other arm)

28 Hierarchical Modelling advantages define object once, instantiate multiple copies transformation parameters often good control knobs maintain structural constraints if well-designed limitations expressivity: not always 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