Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 4: Transformations 2

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Today Composing transformations 3D Transformations
Lecture 3: Transformations and Viewing. General Idea Object in model coordinates Transform into world coordinates Represent points on object as vectors.
02/17/05CISC640/440 OpenGL Tutorial1 OpenGL Tutorial CISC 640/440 Computer Graphics TA: Qi Li/Mani Thomas
Computer Graphics Lecture 4 Geometry & Transformations.
Transformations II Week 2, Wed Jan 17
2D Geometric Transformations
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
Ch. 2: Rigid Body Motions and Homogeneous Transforms
Outline for Today More math… Finish linear algebra: Matrix composition
3-D Geometry.
1 Geometrical Transformation Tong-Yee Lee. 2 Modeling Transform Specify transformation for objects Allow definitions of objects in own coordinate systems.
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
Representation CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Computer Graphics (Fall 2008) COMS 4160, Lecture 4: Transformations 2
OpenGL (II). How to Draw a 3-D object on Screen?
Computer Graphics (Fall 2004) COMS 4160, Lecture 3: Transformations 1
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 2: Basic Ray Tracing Ravi Ramamoorthi Some slides courtesy.
Computer Graphics (Fall 2005) COMS 4160, Lecture 2: Review of Basic Math
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
Computer Graphics 3D Transformations. 3D Translation Remembering 2D transformations -> 3x3 matrices, take a wild guess what happens to 3D transformations.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
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.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1
COMP 175: Computer Graphics March 10, 2015
COMP 175: Computer Graphics March 24, 2015
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Geometric transformations The Pipeline
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Stages of Vertex Transformation To specify viewing, modeling, and projection transformations, you construct a 4 × 4 matrix M, which is then multiplied.
Computer Graphics I, Fall 2010 Computer Viewing.
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.
OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
The Camera Analogy ► Set up your tripod and point the camera at the scene (viewing transformation) ► Arrange the scene to be photographed into the desired.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
Honours Graphics 2008 Session 3. Today’s focus Perspective and orthogonal projection Quaternions Graphics camera.
Computer Graphics Matrices
1 Representation. 2 Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames.
CS 4731: Computer Graphics Lecture 12: More 3D Viewing Emmanuel Agu.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Computer Graphics I, Fall 2010 Transformations.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS5500 Computer Graphics March 20, Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts.
OpenGL LAB III.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
Advanced Computer Graphics
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Viewing.
CSE 167 [Win 17], Lecture 3: Transformations 1 Ravi Ramamoorthi
Computer Viewing.
Isaac Gang University of Mary Hardin-Baylor
3D Transformations Source & Courtesy: University of Wisconsin,
(c) University of Wisconsin, CS559
Rigid Body Transformations
University of New Mexico
Viewing/Projections I Week 3, Fri Jan 25
Lecture 8: 3D Transforms Li Zhang Spring 2008
Transformations 2 University of British Columbia
Rigid Body Transformations
Presentation transcript:

Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 4: Transformations 2

To Do  Start doing HW 1  Time is short, but needs only little code [Due Wed Sep 12]  Ask questions or clear misunderstandings by next lecture  Specifics of HW 1  Last lecture covered basic material on transformations in 2D Likely need this lecture to understand full 3D transformations  Last lecture had full derivation of 3D rotations. You only need final formula  gluLookAt derivation this lecture helps clarifying some ideas  Read and post on Piazza re questions

Outline  Translation: Homogeneous Coordinates  Combining Transforms: Scene Graphs  Transforming Normals  Rotations revisited: coordinate frames  gluLookAt (quickly)

Translation  E.g. move x by +5 units, leave y, z unchanged  We need appropriate matrix. What is it? Transformations game demo

Homogeneous Coordinates  Add a fourth homogeneous coordinate (w=1)  4x4 matrices very common in graphics, hardware  Last row always (until next lecture)

Representation of Points (4-Vectors) Homogeneous coordinates  Divide by 4 th coord (w) to get (inhomogeneous) point  Multiplication by w > 0, no effect  Assume w ≥ 0. For w > 0, normal finite point. For w = 0, point at infinity (used for vectors to stop translation)

Advantages of Homogeneous Coords  Unified framework for translation, viewing, rot…  Can concatenate any set of transforms to 4x4 matrix  No division (as for perspective viewing) till end  Simpler formulas, no special cases  Standard in graphics software, hardware

General Translation Matrix

Combining Translations, Rotations  Order matters!! TR is not the same as RT (demo)  General form for rigid body transforms  We show rotation first, then translation (commonly used to position objects) on next slide. Slide after that works it out the other way  Demos with applet, homework 1

Combining Translations, Rotations Transformations game demo

Combining Translations, Rotations Transformations game demo

Outline  Translation: Homogeneous Coordinates  Combining Transforms: Scene Graphs  Transforming Normals  Rotations revisited: coordinate frames  gluLookAt (quickly) Slides for this part courtesy Prof. O’Brien

Hierarchical Scene Graph

Drawing a Scene Graph  Draw scene with pre-and-post-order traversal  Apply node, draw children, undo node if applicable  Nodes can carry out any function  Geometry, transforms, groups, color, …  Requires stack to “undo” post children  Transform stacks in OpenGL  Caching and instancing possible  Instances make it a DAG, not strictly a tree

Example Scene-Graphs

Outline  Translation: Homogeneous Coordinates  Combining Transforms: Scene Graphs  Transforming Normals  Rotations revisited: coordinate frames  gluLookAt (quickly)

Normals  Important for many tasks in graphics like lighting  Do not transform like points e.g. shear  Algebra tricks to derive correct transform Incorrect to transform like points

Finding Normal Transformation

Outline  Translation: Homogeneous Coordinates  Combining Transforms: Scene Graphs  Transforming Normals  Rotations revisited: coordinate frames  gluLookAt (quickly)

Coordinate Frames  All of discussion in terms of operating on points  But can also change coordinate system  Example, motion means either point moves backward, or coordinate system moves forward

Coordinate Frames: In general  Can differ both origin and orientation (e.g. 2 people)  One good example: World, camera coord frames (H1) World Camera World Camera

Coordinate Frames: Rotations

Outline  Translation: Homogeneous Coordinates  Combining Transforms: Scene Graphs  Transforming Normals  Rotations revisited: coordinate frames  gluLookAt (quickly)

Geometric Interpretation 3D Rotations  Rows of matrix are 3 unit vectors of new coord frame  Can construct rotation matrix from 3 orthonormal vectors

Axis-Angle formula (summary)

Outline  Translation: Homogeneous Coordinates  Combining Transforms: Scene Graphs  Transforming Normals  Rotations revisited: coordinate frames  gluLookAt (quickly)

Case Study: Derive gluLookAt Defines camera, fundamental to how we view images  gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz)  Camera is at eye, looking at center, with the up direction being up  May be important for HW1  Combines many concepts discussed in lecture  Core function in OpenGL for later assignments Eye Up vector Center

Steps  gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz)  Camera is at eye, looking at center, with the up direction being up  First, create a coordinate frame for the camera  Define a rotation matrix  Apply appropriate translation for camera (eye) location

Constructing a coordinate frame? We want to associate w with a, and v with b  But a and b are neither orthogonal nor unit norm  And we also need to find u from lecture 2

Constructing a coordinate frame  We want to position camera at origin, looking down –Z dirn  Hence, vector a is given by eye – center  The vector b is simply the up vector Eye Up vector Center

Steps  gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz)  Camera is at eye, looking at center, with the up direction being up  First, create a coordinate frame for the camera  Define a rotation matrix  Apply appropriate translation for camera (eye) location

Geometric Interpretation 3D Rotations  Rows of matrix are 3 unit vectors of new coord frame  Can construct rotation matrix from 3 orthonormal vectors

Steps  gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz)  Camera is at eye, looking at center, with the up direction being up  First, create a coordinate frame for the camera  Define a rotation matrix  Apply appropriate translation for camera (eye) location

Translation  gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz)  Camera is at eye, looking at center, with the up direction being up  Cannot apply translation after rotation  The translation must come first (to bring camera to origin) before the rotation is applied

Combining Translations, Rotations

gluLookAt final form