GAM 325/425: Applied 3D Geometry

Slides:



Advertisements
Similar presentations
Announcements. Structure-from-Motion Determining the 3-D structure of the world, and/or the motion of a camera using a sequence of images taken by a moving.
Advertisements

Computer Graphics Lecture 4 Geometry & Transformations.
Camera Models A camera is a mapping between the 3D world and a 2D image The principal camera of interest is central projection.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
Motion Kinematics – Lecture Series 3 ME 4135 – Fall 2011 R. Lindeke.
Multiple View Geometry Marc Pollefeys University of North Carolina at Chapel Hill Modified by Philippos Mordohai.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
Epipolar geometry. (i)Correspondence geometry: Given an image point x in the first view, how does this constrain the position of the corresponding point.
3-D Geometry.
© 2003 by Davi GeigerComputer Vision October 2003 L1.1 Structure-from-EgoMotion (based on notes from David Jacobs, CS-Maryland) Determining the 3-D structure.
Previously Two view geometry: epipolar geometry Stereo vision: 3D reconstruction epipolar lines Baseline O O’ epipolar plane.
Computer Graphics (Fall 2008) COMS 4160, Lecture 4: Transformations 2
2D Transformations Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
Mathematical Fundamentals
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Digital Image Processing CCS331
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
Shadows via Projection Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 5, 2003.
Computer Graphics, KKU. Lecture 51 Transformations Given two frames in an affine space of dimension n, we can find a ( n+1 ) x ( n +1) matrix that.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 4: Transformations 2
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Geometrical Transformations 2 Adapted from Fundamentals of Interactive Computer Graphics, Foley and van Dam, pp , by Geb Thomas.
The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Affine Geometry.
Computer Graphics Matrices
Honours Graphics 2008 Session 2. Today’s focus Vectors, matrices and associated math Transformations and concatenation 3D space.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
III- 1 III 3D Transformation Homogeneous Coordinates The three dimensional point (x, y, z) is represented by the homogeneous coordinate (x, y, z, 1) In.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may.
Homogeneous Coordinates They work, but where do they come from? Jonathan Senning
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
Geometric Transformations
Ch. 2: Rigid Body Motions and Homogeneous Transforms
3D Geometric Transformation
2D Transformations By: KanwarjeetSingh
Computer Graphics CC416 Week 15 3D Graphics.
Review: Transformations
3D Transformation.
Vectors and the Geometry
Computer Graphics 3D Transformations
Introduction to Computer Graphics CS 445 / 645
Review: Transformations
Basic Coordinate Systems & VR
3D Transformation Pipeline
Copyright © Cengage Learning. All rights reserved.
Lecture 2 Transformations
Space Vectors Problem 3.19 Determine the moment about the origin of the coordinate system, given a force vector and its distance from the origin. This.
Epipolar geometry.
Three Dimensional Viewing
Vectors and the Geometry
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
2-D Geometry.
Transformations 3 University of British Columbia
Chapter IV Spaces and Transforms
GAM 325/425: Applied 3D Geometry
COMP 175: Computer Graphics February 21, 2016
Robot Kinematics We know that a set of “joint angles” can be used to locate and orientate the hand in 3-D space We know that the joint angles can be combined.
Geometric Objects and Transformations (II)
Transformation Operators
CSCE441: Computer Graphics 2D/3D Transformations
CS1550 Fundamentals For Computer Graphics Transformations-2
Translation in Homogeneous Coordinates
Presentation transcript:

GAM 325/425: Applied 3D Geometry Lecture 3B: Using Affine Transformations

Coordinate Frames There are 3 important coordinate frames: World Space: Fixed origin & axes Reference for relative position and orientation between objects Object (Model) Space: Origin sets for the ‘center’ of the model geometry Sets the up/forward orientation of the model Camera Space: More on this in a future lecture Problem: There are no conventions or standards for any of these spaces. Which is the up axis? Which is the forward one? World space axis are often determined by the graphics library but object space is influenced by the 3D modelling software Getting artists and programmers to stick to specific conventions is crucial! If the origin for the 3D model isn’t right, turning or positioning in game will be incorrect If the ‘forward’ and ‘up’ alignment of the model is wrong, game motion will be incorrect

Object Space Sidebar: We’ll keep our example in the xz-plane for simplicity, but the principle applies to the full 3D space In general, objects will be composed of a collection of point appropriately centered at the origin (defining the object’s Local Space). We will always observe the following conventions: Up along the y axis Forward along the z axis The object’s placement relative to the origin depends on the needs of the application Placing an object in World Space means applying some transform W to scale/rotate/translate the object Example: If 𝐖= 𝐓 (0,0,7) then applying W to each point of the object will translate it 7 unit along the z axis x 𝐓 (0,0,7) 𝑃 1 𝑃 2 𝑃 3 𝑃 1 𝑃 2 𝑃 3 z

World Space: Order of Operation In most cases (for us!), W will be a combination of scale, rotation and translation. But the order of operation is important. Example: Compare 𝐖 1 = 𝐓 (0,0,7) 𝐑 𝐲, 𝝅 𝟐 versus 𝐖 2 = 𝐑 𝐲, 𝝅 𝟐 𝐓 (0,0,7) 𝐖 1 works as expected, but 𝐖 2 induces an unexpected translation In general, some order of operations have unwanted side effects… z x 𝑃 1 𝑃 2 𝑃 3 z x 𝑃 1 𝑃 2 𝑃 3 𝑃 1 𝑃 2 𝑃 3 𝑃 1 𝑃 2 𝑃 3

World Space: Order of Operation To avoid unwanted side effect, world matrices are usually constructed as follow: 𝐖=𝐓𝐑𝐒 Remember: these matrices are applied in right to left order First scale the object, then apply rotation and finally translate In terms of applications: for fixed/unmoving objects in a scene, keeping the combined W form would work fine. However, for more dynamic objects that need to have their position/rotation (and maybe scale) continually modified, the combined form gets unwieldy: Given W, how do we move forward? How do we rotate relative to the local space? Two solutions: Use Matrix Decomposition to extract T, R and S. (Section 4.4.2 or my document) Avoid the costly decomposition by keeping all three transform type separately Warning: When using row vectors, we reverse the order as W = SRT. See LASR page

Avoiding Matrix Decomposition Assume any scaling done is uniform: same amount of scaling across all three axis. This covers the vast majority of the situations we will encounter But 𝐒 𝑎,𝑎,𝑎 =𝑎𝐈 This means uniform scaling are commutative with rotations 𝐑 𝑛 𝐒 𝑛 𝐑 𝑛−1 𝐒 𝑛−1 … 𝐑 0 𝐒 0 = (𝐒 𝑛 𝐒 𝑛−1 … 𝐒 0 ) 𝐑 𝑛 𝐑 𝑛−1 … 𝐑 0 = 𝑎 𝑛 𝑎 𝑛−1 … 𝑎 0 𝐑 𝑛 𝐑 𝑛−1 … 𝐑 0 =𝑎𝐑 Therefore, for objects that need to be updated frequently, keep track of: Changes to the (uniform) scale factor s Current rotation matrix R Current translation vector t Update the above values as necessary When the world matrix W is needed, reconstruct it in TRS form using the following transforms: 𝐖= 𝐈 𝐭 𝟎 𝑇 𝟏 𝐑 𝟎 𝟎 𝑇 1 𝑠𝐈 𝟎 𝟎 𝑇 1 = 𝑠𝐑 𝐭 𝟎 𝑇 1

Avoiding Matrix Decomposition: Example z x 𝑃 1 𝑃 2 𝑃 3 Step 0: initial placement: 𝑠 0 =1 𝐑 0 = 𝐑 𝐲, 𝝅 𝟐 𝐭 0 =(−6,0,6) Step 1: Moving fwd by 12 then rotate by 𝐑 𝐲, 𝝅 𝟐 : 𝑠 1 = 𝑠 0 , 𝐑 1 = 𝐑 𝐲, 𝝅 𝟐 𝐑 0 = 𝐑 𝐲,𝝅 What about 𝐭 𝟏 ? 𝐖 0 𝑃 1 = 𝑠 𝐑 0 𝐭 0 𝟎 𝑇 1 0 0 2 1 = 𝑠 𝐑 0 0 0 2 + −6 0 6 1 = 2 0 0 + −6 0 6 1 = −4 0 6 1 And similarly for the other two points z x 𝑃 1 𝑃 2 𝑃 3 𝐭 1 = 𝐭 0 + 𝐑 0 0 0 12 = −6 0 6 + 12 0 0 = 6 0 6 𝐖 1 𝑃 1 = 𝑠 𝐑 1 𝐭 1 𝟎 𝑇 1 0 0 2 1 = 𝑠 𝐑 1 0 0 2 + 6 0 6 1 = 0 0 −2 + 6 0 6 1 = 6 0 4 1 And similarly for the other two points

Avoiding Matrix Decomposition: Example 8 z x 𝑃 1 𝑃 2 𝑃 3 Step 2: Again fwd by 12 then rotate by 𝐑 𝐲, 𝝅 𝟐 : 𝑠 2 = 𝑠 1 , 𝐑 2 = 𝐑 𝐲, 𝝅 𝟐 𝐑 𝟏 = 𝐑 𝐲, 𝟑𝝅 𝟐 Step 3: Again fwd by 12 then rotate by 𝐑 𝐲, 𝝅 𝟐 : 𝑠 3 = 𝑠 2 , 𝐑 3 = 𝐑 𝐲, 𝝅 𝟐 𝐑 𝟐 = 𝐑 𝐲,𝟐𝝅 𝐭 2 = 𝐭 1 + 𝐑 𝟏 0 0 12 = 6 0 6 + 0 0 −12 = 6 0 −6 𝐖 2 𝑃 1 = 𝑠 𝐑 𝟐 𝐭 𝟐 𝟎 𝑇 1 0 0 2 1 = 𝑠 𝐑 𝟐 0 0 2 + 6 0 −6 1 = −2 0 0 + 6 0 −6 1 = 4 0 −6 1 And similarly for the other two points z x 𝑃 1 𝑃 2 𝑃 3 𝐭 3 = 𝐭 𝟐 + 𝐑 𝟐 0 0 12 = 6 0 −6 + −12 0 0 = −6 0 −6 𝐖 𝟑 𝑃 1 = 𝑠 𝐑 3 −6 0 −6 𝟎 𝑇 1 0 0 2 1 = 𝑠 𝐑 3 0 0 2 + −6 0 −6 1 = 0 0 2 + −6 0 −6 1 = −6 0 −4 1 And similarly for the other two points