3D Transformations Source & Courtesy: University of Wisconsin,

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
2D Geometric Transformations
Outline for Today More math… Finish linear algebra: Matrix composition
3-D Geometry.
3D orientation.
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
2D Transformations x y x y x y. 2D Transformation Given a 2D object, transformation is to change the object’s Position (translation) Size (scaling) Orientation.
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
CS 450: Computer Graphics 2D TRANSFORMATIONS
10/5/04© University of Wisconsin, CS559 Fall 2004 Last Time Compositing Painterly Rendering Intro to 3D Graphics Homework 3 due Oct 12 in class.
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
10/13/200© NTUST Last Time Compositing Painterly Rendering Intro to 3D Graphics Homework 2, 3 due Oct 13 in class.
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.
Transformations Dr. Amy Zhang.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
3D Computer Graphics An oh so brief introduction.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Geometric Objects and Transformation
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
CS559: Computer Graphics Lecture 8: 3D Transforms Li Zhang Spring 2008 Most Slides from Stephen Chenney.
CS559: Computer Graphics Lecture 8: Warping, Morphing, 3D Transformation Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
2/17/04© University of Wisconsin, CS559 Spring 2004 Last Time Resampling –Ideal reconstruction –You can only ideally reconstruct band-limited functions.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Math Review.
In the name of God Computer Graphics.
2/19/04© University of Wisconsin, CS559 Spring 2004 Last Time Painterly rendering 2D Transformations –Transformations as coordinate system changes –Transformations.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Affine Geometry.
3D Coordinate Systems o3D computer graphics involves the additional dimension of depth, allowing more realistic representations of 3D objects in the real.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
CS559: Computer Graphics Lecture 5: Color and Edge Li Zhang Spring 2008 Most Slides from Stephen Chenney.
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.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
CSE 167 [Win 17], Lecture 3: Transformations 1 Ravi Ramamoorthi
Math Fundamentals Maths revisit.
In the name of God Computer Graphics.
Transformations Objectives
Geometric Transformations Hearn & Baker Chapter 5
Computer Graphics CC416 Week 15 3D Graphics.
2D Transformations with Matrices
Review: Transformations
COMPUTER GRAPHICS CHAPTERS CS 482 – Fall 2017 TRANSFORMATIONS
Review: Transformations
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
CS451Real-time Rendering Pipeline
Lecture 8: Dynamic Range and Trichromacy Li Zhang Spring 2008
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Chapter IV Spaces and Transforms
COMP 175: Computer Graphics February 21, 2016
(c) 2002 University of Wisconsin, CS 559
(c) University of Wisconsin, CS559
Transformations Ed Angel
Geometric Objects and Transformations (II)
Transformations Ed Angel Professor Emeritus of Computer Science
CSCE441: Computer Graphics 2D/3D Transformations
Lecture 8: 3D Transforms Li Zhang Spring 2008
Chapter 2 Mathematical Analysis for Kinematics
Linear Algebra A gentle introduction
Presentation transcript:

3D Transformations Source & Courtesy: University of Wisconsin,

Object Composing transformations 3D Transformations Homogeneous coordinates Intro to Viewing

2D Rotation Rotate counter-clockwise about the origin by an angle  y x x

Rotating About An Arbitrary Point What happens when you apply a rotation transformation to an object that is not at the origin? y x x

How Do We Fix it? How do we rotate an about an arbitrary point? Hint: we know how to rotate about the origin of a coordinate system

Rotating About An Arbitrary Point x x y y x x

Rotate About Arbitrary Point Say you wish to rotate about the point (a,b) You know how to rotate about (0,0) Translate so that (a,b) is at (0,0) x’=x–a, y’=y–b Rotate X’=(x-a)cos-(y-b)sin, y’=(x-a)sin+(y-b)cos Translate back again xf=x’+a, yf=y’+b

Scaling an Object not at the Origin What happens if you apply the scaling transformation to an object not at the origin? Based on the rotating about a point composition, what should you do to resize an object about its own center?

Back to Rotation About a Pt Say R is the rotation matrix to apply, and p is the point about which to rotate Translation to Origin: Rotation: Translate back: The translation component of the composite transformation involves the rotation matrix. What a mess!

Homogeneous Coordinates Use three numbers to represent a point (x,y)=(wx,wy,w) for any constant w0 Typically, (x,y) becomes (x,y,1) To go backwards, divide by w Translation can now be done with matrix multiplication!

Basic Transformations Translation: Rotation: Scaling:

Homogeneous Transform Advantages Unified view of transformation as matrix multiplication Easier in hardware and software To compose transformations, simply multiply matrices Order matters: AB is generally not the same as BA Allows for non-affine transformations: Perspective projections! Bends, tapers, many others

Directions vs. Points We have been talking about transforming points Directions are also important in graphics Viewing directions Normal vectors Ray directions Directions are represented by vectors, like points, and can be transformed, but not like points (1,1) (-2,-1)

Transforming Directions Say I define a direction as the difference of two points: d=a–b This represents the direction of the line between two points Now I translate the points by the same amount: a’=a+t, b’=b+t How should I transform d?

Homogeneous Directions Translation does not affect directions! Homogeneous coordinates give us a very clean way of handling this The direction (x,y) becomes the homogeneous direction (x,y,0) The correct thing happens for rotation and scaling also Scaling changes the length of the vector, but not the direction Normal vectors are slightly different – we’ll see more later

3D Transformations Homogeneous coordinates: (x,y,z)=(wx,wy,wz,w) Transformations are now represented as 4x4 matrices Typical graphics packages allow for specification of translation, rotation, scaling and arbitrary matrices OpenGL: glTranslate[fd], glRotate[fd], glScale[fd], glMultMatrix[fd]

3D Translation

3D Rotation Rotation in 3D is about an axis in 3D space passing through the origin Using a matrix representation, any matrix with an orthonormal top-left 3x3 sub-matrix is a rotation Rows are mutually orthogonal (0 dot product) Determinant is 1 Implies columns are also orthogonal, and that the transpose is equal to the inverse

3D Rotation

Problems with Rotation Matrices Specifying a rotation really only requires 3 numbers Axis is a unit vector, so requires 2 numbers Angle to rotate is third number Rotation matrix has a large amount of redundancy Orthonormal constraints reduce degrees of freedom back down to 3 Keeping a matrix orthonormal is difficult when transformations are combined Rotations are a very complex subject, and a detailed discussion is way beyond the scope of this course

Alternative Representations Specify the axis and the angle (OpenGL method) Hard to compose multiple rotations Euler angles: Specify how much to rotate about X, then how much about Y, then how much about Z Hard to think about, and hard to compose Any three axes will do e.g. X,Y,X Specify the axis, scaled by the angle Only 3 numbers, called the exponential map Quaternions

Quaternion 4-vector related to axis and angle, unit magnitude Rotation about axis (nx,ny,nz) by angle  : Reasonably easy to compose Reasonably easy to go to/from rotation matrix Only normalized quaternions represent rotations, but you can normalize them just like vectors, so it isn’t a problem Easy to perform spherical interpolation

Other Rotation Issues Rotation is about an axis at the origin For rotation about an arbitrary axis, use the same trick as in 2D: Translate the axis to the origin, rotate, and translate back again Rotation is not commutative Rotation order matters Experiment to convince yourself of this

Transformation Leftovers Scale, shear etc extend naturally from 2D to 3D Rotation and Translation are the rigid-body transformations: Do not change lengths or angles, so a body does not deform when transformed

Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded by line segments Any face can be triangulated (broken into triangles)

Modeling and OpenGL In OpenGL, all geometry is specified by stating which type of object and then giving the vertices that define it glBegin(…) …glEnd() glVertex[34][fdv] Three or four components (regular or homogeneous) Float, double or vector (eg float[3]) Chapter 2 of the red book

Rendering Generate an image showing the contents of some region of space The region is called the view volume, and it is defined by the user Determine where each object should go in the image Viewing, Projection Determine which pixels should be filled Rasterization Determine which object is in front at each pixel Hidden surface elimination, Hidden surface removal, Visibility Determine what color it is Lighting, Shading

Graphics Pipeline Graphics hardware employs a sequence of coordinate systems The location of the geometry is expressed in each coordinate system in turn, and modified along the way The movement of geometry through these spaces is considered a pipeline Local Coordinate Space World Coordinate Space View Space Canonical View Volume Display Space

Thanks…