Computer Graphics 3D Transformations. 3D Translation Remembering 2D transformations -> 3x3 matrices, take a wild guess what happens to 3D transformations.

Slides:



Advertisements
Similar presentations
1 Geometrical Transformation 2 Outline General Transform 3D Objects Quaternion & 3D Track Ball.
Advertisements

Based on slides created by Edward Angel
Viewing and Transformation
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
3D Coordinate Systems and Transformations Revision 1
3-D Geometry.
CSCE 689: Computer Animation Rotation Representation and Interpolation
CSCE 441: Computer Graphics Rotation Representation and Interpolation
CSCE 641: Computer Graphics Rotation Representation and Interpolation Jinxiang Chai.
Rotation representation and Interpolation
Computer Graphics (Fall 2008) COMS 4160, Lecture 4: Transformations 2
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Technical Background.
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Introduction to 3D viewing 3D is just like taking a photograph!
Computer Vision Group Prof. Daniel Cremers Autonomous Navigation for Flying Robots Lecture 3.1: 3D Geometry Jürgen Sturm Technische Universität München.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Computer Graphics Bing-Yu Chen National Taiwan University.
Geometric transformations The Pipeline
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
Rick Parent - CIS681 ORIENTATION Use Quaternions Interpolating rotations is difficult.
Maths and Technologies for Games Quaternions CO3303 Week 1.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
1 CS 430/536 Computer Graphics I 3D Transformations World Window to Viewport Transformation Week 2, Lecture 4 David Breen, William Regli and Maxim Peysakhov.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 4: Transformations 2
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
Computer Graphics I, Fall 2010 Computer Viewing.
Animating Rotations and Using Quaternions. What We’ll Talk About Animating Translation Animating 2D Rotation Euler Angle representation 3D Angle problems.
Viewing CS418 Computer Graphics John C. Hart. Graphics Pipeline Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords.
SE 313 – Computer Graphics Lecture 8: Transformations and Projections Lecturer: Gazihan Alankuş 1.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
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.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Math Review.
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.
3-D Transformational Geometry CS418 Computer Graphics John C. Hart.
Introduction to Computer Graphics: Viewing Transformations Rama C
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Lecture 5: Introduction to 3D
Affine Geometry.
Honours Graphics 2008 Session 3. Today’s focus Perspective and orthogonal projection Quaternions Graphics camera.
CS5500 Computer Graphics April 23, Today’s Topic Details of the front-end of the 3D pipeline: –How to construct the viewing matrix? –How to construct.
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.
Euler Angles This means, that we can represent an orientation with 3 numbers Assuming we limit ourselves to 3 rotations without successive rotations about.
Week 5 - Monday.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms  Affine transforms  Rotation  Scaling  Shearing.
3D GRAPHICS RENDERING PIPELINE CS / TECHNICAL BACKGROUND PAGE 11.
CS5500 Computer Graphics March 20, Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Computer Viewing Isaac Gang University of Mary Hardin-Baylor.
OpenGL LAB III.
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
What you will learn about today
- Introduction - Graphics Pipeline
Viewing.
Computer Animation Algorithms and Techniques
Computer Viewing.
COMPUTER GRAPHICS CHAPTERS CS 482 – Fall 2017 TRANSFORMATIONS
Isaac Gang University of Mary Hardin-Baylor
CSCE 441 Computer Graphics 3-D Viewing
Rotation representation and Interpolation
Computer Graphics (Spring 2003)
What you will learn about today
UMBC Graphics for Games
University of New Mexico
Computer Graphics 3Practical Lesson
Presentation transcript:

Computer Graphics 3D Transformations

3D Translation Remembering 2D transformations -> 3x3 matrices, take a wild guess what happens to 3D transformations. T=(t x, t y, t z )

3D Scale S=(s x, s y, s z )

3D Rotations R=(r x, r y, r z,  ) What does a rotation in 3D mean? Q: How do we specify a rotation? A: We give a vector to rotate about, and a theta that describes how much we rotate.  Q: Since 2D is sort of like a special case of 3D, what is the vector we’ve been rotating about in 2D?

Rotations about the Z axis R=(0,0,1,  ) What do you think the rotation matrix is for rotations about the z axis? 

Rotations about the X axis R=(1,0,0,  ) Let’s look at the other axis rotations 

Rotations about the Y axis R=(0,1,0,  ) 

Rotations around a principle axis

Rotations for an arbitrary axis    Steps: 1. Normalize vector u 2. Compute  3. Compute  4. Create rotation matrix u

Vector Normalization Given a vector v, we want to create a unit vector that has a magnitude of 1 and has the same direction as v. Let’s do an example.

Computing the Rotation Matrix 1. Normalize u ( the vector we are rotating around ) 2. Compute R x (  x ) 3. Compute R y (  y ) 4. Generate Rotation Matrix

Unit vectors are made of direction cosines: Rotations for an arbitrary axis

Rotation Matrix

Axis-Angle Rotations in OpenGL glRotatef( angle, x, y, z);

Euler Angles More intuitive: represent rotations by 3 angles, one for each axis glRotatef(anglex,1,0,0); glRotatef(angley,0,1,0); glRotatef(anglez,0,0,1); Think: if we have a torus unstranformed at the origin, what will the torus look like if you have anglex=90, angley=90, and anglez=90 Transformed

Gimbal Lock Rotate around these How can we gain altitude here? Initial orientation (x=blue, y=green, z = red)

Gimbal Lock in OpenGL What is the problem here? glRotatef(anglex,1,0,0); glRotatef(angley,0,1,0); glRotatef(anglez,0,0,1);

Avoiding Gimbal Lock: Quaternions Quaternions represent 3D rotations in 4D using imaginary numbers – a 4-tuple Q = (w,x,y,z) Convert Angle-axis -> Quaternion ( ,x,y,z) -> ( cos(  /2), xsin(  /2), ysin(  /2), zsin(  /2) ) Why quaternions? No gimbal lock Smooth interpolation between rotations (for animation)

Quaternions Quaternions have rules for multiplication, inversion, etc See: Typical usage: Convert from euler, matrix, or angle-axis Do rotations Convert to angle-axis or matrix

What is going on here? frame1 frame2 frame3

gluLookAt Orients and positions the “camera” gluLookat( eyex, eyey, eyez, centerx, centery, centerz, upx,upy, upz); eye – the position of the camera in world coordinates center – the camera is pointed at this point up – the direction defined to be up for the camera

gluLookAt – in matrix form

Cross Products Given two vectors, the cross product returns a vector that is perpendicular to the plane of the two vectors and with magnitude equal to the area of the parallelogram formed by the two vectors.  u

Different Phases: Model Definition

Different Phases: Transformations

Different Phases: Projection

Different Phases: Rasterization

Different Phases: Scan Conversion

What are the steps needed?

Let’s Examine the Camera If I gave you a world, and said I want to “render” it from another viewpoint, what information do I have to give you? –Position –Which way we are looking –Which way is “up” –Aspect Ratio –Field of View –Near and Far

Camera View Direction View Up View Right View Normal

Camera View Up View Right What are the vectors?

Graphics Pipeline So Far Object Object Coordinates Transformation Object -> World World World Coordinates Projection Xform World -> Projection Camera Projection Coordinates Screen Device Coordinates Normalize Xform & Clipping Projection -> Normalized Viewport Normalized Coordinates Viewport Transform Normalized -> Device

Transformation World->Camera View Direction View Up View Right View Normal

Transformation World->Camera View Up = V View Right = u View Direction = -N