Reference: “3D Math Primer for Graphics and Game Development, 2 nd ed.” Chapter 5 Chapter 6.x MATRIX.

Slides:



Advertisements
Similar presentations
Transformations We want to be able to make changes to the image larger/smaller rotate move This can be efficiently achieved through mathematical operations.
Advertisements

Links and Joints.
Kinematics Pose (position and orientation) of a Rigid Body
1 Computer Graphics Chapter 6 2D Transformations.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
2D Geometric Transformations
Linear Algebra and SVD (Some slides adapted from Octavia Camps)
Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of coordinate systems Translation Scaling Rotation.
2D/3D Geometric Transformations CS485/685 Computer Vision Dr. George Bebis.
2.1 si SI31 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
3-D Geometry.
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
Computer Graphics (Fall 2004) 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.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
CS 450: Computer Graphics 2D TRANSFORMATIONS
An Introduction to Robot Kinematics
3D Transformation. In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. 3D Transformation glVertex3f(x, y,z);
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Mathematical Fundamentals
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
Patrick Nichols Thursday, September 18, Linear Algebra Review.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
2.2 Linear Transformations in Geometry For an animation of this topic visit
5.2 Three-Dimensional Geometric and Modeling Transformations 2D3D Consideration for the z coordinate.
Lecture Notes: Computer Graphics.
Dx = 2 dy = 3 Y X D Translation A translation is applied to an object by repositioning it along a straight-line path.
Transformations Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Magnitude of a Vector The magnitude of a vector, denoted as |a|, is defined as the square root of the sum of the squares of its components: |a| = (x 2.
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.
Transformations of Objects – 3D
1 Computer Graphics Week9 -3D Geometric Transformation.
Graphics Matrices. Today’s Lecture Brought to you by the integer 6 and letter ‘K’; 2D and 3D points Matrices Rotations Translation Putting it all together.
What is Kinematics. Kinematics studies the motion of bodies.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Affine Transformations.
Computer Graphics 3D Transformations. Translation.
Geometric Transformations Hearn & Baker Chapter 5 Some slides are taken from Robert Thomsons notes.
GEOMETRIC TRANFORMATIONS Presented By -Lakshmi Sahithi.
Multimedia Programming 07: Image Warping Keyframe Animation Departments of Digital Contents Sang Il Park.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
Computer Graphics Matrices
3D Coordinate Systems o3D computer graphics involves the additional dimension of depth, allowing more realistic representations of 3D objects in the real.
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.
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
Composite 3D Transformations. Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position.
1 By Dr. HANY ELSALAMONY.  We have seen how to create models in the 3D world. We discussed transforms in lecture 3, and we have used some transformations.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
Matrix Transformations Reference: “3D Math Primer for Graphics and Game Development” – , , , , 9.4
Computer Graphics Lecture 11 2D Transformations I Taqdees A. Siddiqi
2D Transformations What is transformations? The geometrical changes of an object from a current state to modified state. Why the transformations is needed?
Modeling Transformation
Reference: “3D Math Primer for Graphics and Game Development, 2 nd ed.” Chapter 5 Chapter 6.x MATRIX.
Lecture 10 Geometric Transformations In 3D(Three- Dimensional)
Review: Transformations
3D Geometric Transformations
Introduction to Computer Graphics CS 445 / 645
Review: Transformations
Lecture 7 Geometric Transformations (Continued)
Three-Dimensional Graphics
COMP 175: Computer Graphics February 9, 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
2D Geometric Transformations
Three-Dimensional Graphics
TWO DIMENSIONAL TRANSFORMATION
Presentation transcript:

Reference: “3D Math Primer for Graphics and Game Development, 2 nd ed.” Chapter 5 Chapter 6.x MATRIX TRANSFORMATIONS

TRANSFORM MATRICES ( )

 Big deal, right?  Yes…but…what if we express that point relative to a “non-standard” coordinate system?  In other words, use *non-standard* basis vectors.  Example:  Let’s assume +y and +z are [0,1,0] and [0,0,1], respectively (as before)  But…let’s make +x be [-1,0,0]  Now the matrix is: TRANSFORM MATRICES, CONT.

 Let’s watch what happens as we “transform” a few points with this matrix… TRANSFORM MATRICES, CONT. p3 P3’ p2 P2’ p1 P1’ MysteryMat does a x-axis “Mirror”.

 Let’s try to apply this idea of basis vectors and local coordinate systems to a new matrix (4.2 in the book)  What does this matrix do?  Method1: Try to plot a few points…OK, but not the best solution ( we might not pick points that show the transform in action. Also, it takes a lot of time! )  Method2: Look at the local coordinate system defined by M…(see the next slide) TRANSFORM MATRICES, CONT.

worldX worldY b0 = localX b1 = localY The localX and localY axes are rotated (~27 degrees) and scaled from their worldX and worldY counter-parts. localZ = worldZ, so this transformation leaves the z-values alone. Imagine “deforming” worldX into b0, worldY into b1, worldZ into b2. This is the same “deformation” the matrix will apply to all points that we transform using this matrix.

TRANSFORM MATRICES, CONT. worldX worldY b0 = localX b1 = localY worldX worldY p0 p1 p2 p3 p4 Let’s say these are defined in world space. When we multiply (transform) them by M (just as we did on the last slide), these points are transformed in the same way the world axes are transformed into the basis vectors of M.

 Now the problem of defining new transforms just boils down to defining the (transformed) basis vectors.  Let’s apply this to the problem of creating a matrix which rotates θ degrees around the z axis. ROTATION TRANSFORM (5.1)

 We’re looking in the +z direction: ROTATION TRANSFORM (5.1), CONT. worldX worldY localX localY θ θ Now, let’s define the basis vectors… Sin(θ) Cos(θ) -Sin(θ) Cos(θ)

 So, if we collect the 3 local vectors (basis vectors into a matrix), we have…  We can similarly come up with matrices for x-axis and y-axis rotations… ROTATION TRANSFORMATION (5.1), CONT. Note: These matrices are for Left-Handed Systems. A Right-handed system would use the transpose.

 The scale transform matrix is even simpler: SCALE TRANSFORM (5.2) worldX worldY worldZ Let’s say we want to scale: 2x in the x-direction 1x in the y-direction ½ in the z-direction localX localY localZ In general: sx in the x-direction sy in the y-direction sz in the z-direction If sx = sy = sz, the operation is called a universal scale.

 [Do it on the board] SHEAR (5.5)

 Let’s say we want to develop a matrix for translation (let’s say by amounts tx, ty, and tz).  Seems simple, right?  Wrong!  Try it TRANSLATION (6.4)

 Try it another way:  Try to come up with values for a-i such that all points transformed by the matrix are moved by +4(x), +5(y), +6(z):  You can’t do it! TRANSLATION (6.4) and

 Up to this point we've been looking at linear transformations (you can do these with a 3x3 (for 3d) matrix).  These only transform points about the origin.  Translation is an example of an affine transformation (a linear transform followed by a translation).  You need to look at the problem in a higher dimension…  …enter homogeneous space! TRANSLATION

TRANSLATION, CONT.

 Represent 2d points in 3d space, with w as 1.0 TRANSLATIONS, CONT. x y x y w 2D 3D

 Now transform by a 3d shear in the x direction by 2.0 units TRANSLATIONS, CONT. x y x y w 2D 3D

 So…a shear in 3d, produces a translation in 2d.  We can do a translation in 3d by shearing in 4d.  We can't really visualize it – you just have to trust the math TANSLATIONS, CONT.

 Note, if you put a w of 0, the translation doesn't affect the vector  Useful for vectors.  W should be:  1 if this is a point.  0 if this is a vector (direction + magnitude).  We'll see another application of this in perspective projections.  In this case we'll end up with w values after the transformation that are not 0 nor 1.  In this case we'll have to do a w-divide (homogeneous divide) TRANSLATION, CONT.

 Now, we can do translation, by using a 4x4 translation matrix like this:  Take our problem cases from before: TRANSLATION, CONT. Because it’s a point It’s still a point

 An extra bonus: TRANSLATION, CONT. This one’s a vector It’s still a vector Note how the vector is unchanged. Remember that you can re-draw a vector anywhere and it still has the same length and magnitude – here’s proof!

 OK, so now that we’re using 4x4 matrices for translation, what about all the other matrices?  You can use 4x4 matrix, with the “old” 3x3 (linear) matrix embedded in the upper-left.  Or…think of it this affine transformation as a linear transform (the 3x3 upper-left part) and a 0-vector translation afterwards.  Example: RotZ now becomes: 4X4 TRANSFORMATION MATRICES

 Suppose you want to apply the following transforms to an object (in this order):  Translate (10,0,0)  Scales (2, 2, 2)  Rotate 15 degrees around the z-axis. TRANSFORM MATRIX CONCATENATION (5.6) p0 p1 p2 p3 p4 P0’ P1’ P2’ P3’ P4’ P0’’ P1’’ P2’’ P3’’ P4’’ P0’’’ P1’’’ P2’’’ P3’’’ P4’’’

 Numerically:  After Multiplying by the translation (10,0,0) matrix:  After multiplying by the scale (2,2,2) matrix:  After multiplying by the rotation of 15 degrees around the z axis: TRANSFORM MATRIX CONCATENATION (8.7)

 You can get the same net effect by concatenating these 3 transforms. TRANSFORM MATRIX CONCATENATION, CONT. VERY IMPORTANT: In a right-handed system, multiply in the reverse order you want to apply the transform (In a left-handed system, you do it in the forward order). You won’t get the same composite matrix if you don’t follow this rule.

 Let’s test it. TRANSFORM MATRIX CONCATENATION, CONT. Transform each of the points by C, and we get… Which is the same points we got by transforming by the individual matrices! Big Deal, right? No! To see why, we’ll need to analyze the costs…[enough time?]