week 5 monday what did we talk about last time lines and
play

Week 5 - Monday What did we talk about last time? Lines and planes - PowerPoint PPT Presentation

Week 5 - Monday What did we talk about last time? Lines and planes Trigonometry Transforms A transform is an operation that changes points, vectors, or colors We can use them to position and animate objects, lights, and


  1. Week 5 - Monday

  2.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms

  3.  A transform is an operation that changes points, vectors, or colors  We can use them to position and animate objects, lights, and cameras  A linear transform is one that holds over vector addition and scalar multiplication  Rotation  Scaling  Can be represented by a 3 x 3 matrix

  4.  Adding a vector after a linear transform makes an affine transform  Affine transforms can be stored in a 4 x 4 matrix using homogeneous notation  Affine transforms:  Translation  Rotation  Scaling  Reflection  Shearing

  5. Notation Name Characteristics T ( t ) Translation matrix Moves a point (affine) R Rotation matrix Rotates points (orthogonal and affine) S ( s ) Scaling matrix Scales along x , y , and z axes according to s (affine) H ij ( s ) Shear matrix Shears component i by factor s with respect to component j E ( h , p , r ) Euler transform Orients by Euler angles head (yaw), pitch, and roll (orthogonal and affine) P o ( s ) Orthographic Parallel projects onto a plane or volume (affine) projection P p ( s ) Perspective projection Project with perspective onto a plane or a volume slerp( q , r , t ) Slerp transform Interpolates quaternions q and r with parameter t

  6.  Move a point from one place to another by vector t = ( t x , t y , t z )  We can represent this with translation matrix T   1 0 0 t   x   0 1 0 t = = y T ( t ) T ( t , t , t )   x y z 0 0 1 t   z    0 0 0 1 

  7.  Rotation, like translation, is a rigid-body transform (points don't change distance from each other and handedness doesn't change)  An orientation matrix is used to define up and forward (usually for a camera)  We often express rotation in terms of 3 separate x , y , and z rotation matrices

  8.   1 0 0 0   −   0 cos φ sin φ 0 = R ( φ )   x 0 sin φ cos φ 0      0 0 0 1  φ φ −     cos 0 sin 0 cos φ sin φ 0 0         0 1 0 0 sin φ cos φ 0 0 φ = = R ( ) R ( φ )     − φ φ y z sin 0 cos 0 0 0 1 0          0 0 0 1   0 0 0 1 

  9.  Usually all the rotations are multiplied together before translations  But if you want to rotate around a point  Translate so that that point lies at the origin  Perform rotations  Translate back

  10.  Scaling is easy and can be done for all axes at the same time with matrix S  If s x = s y = s z , the scaling is called uniform or isotropic and nonuniform or anisotropic otherwise   s 0 0 0   x   0 s 0 0 = y S ( s )   0 0 s 0   z   0 0 0 1  

  11.  A shearing transform distorts one dimension in terms of another with parameter s  Thus, there are six shearing matrices H xy ( s ), H xz ( s ), H yx ( s ), H yz ( s ), H zx ( s ), and H zy ( s )  Here's an example of H xz ( s ):   1 0 s 0     0 1 0 0 = H ( s )   xz 0 0 1 0     0 0 0 1  

  12.  To make H ij ( s ), start with the identity matrix and put s in row i , column j  See how the only the affected dimension changes

  13.  Because matrix multiplications are not commutative, order of transforms matters  Still, parts (or the entirety) of the transform can be precomputed and stored as a single matrix  In math world, matrices are applied from right to left, thus TRSp scales point p , rotates it, then translates it  In the MonoGame world, it's the opposite!  How does that work?!

  14.  This example from the book shows how the same sets of transforms, applied in different orders, can have different outcomes

  15.  A rigid-body transform preserves lengths, angles, and handedness  We can write any rigid-body transform X as a rotation matrix R multiplied by translation matrix T ( t )   r r r t   00 01 02 x   r r r t = = 10 11 12 y X T ( t ) R   r r r t   20 21 22 z    0 0 0 1 

  16.  Because R is orthogonal, its inverse is its transpose  Because of the nature of a translation, its inverse is just its negative  Thus, the inverse of X is  X -1 = ( T ( t ) R ) -1 = R -1 T ( t ) -1 = R T T (- t )

  17.  The matrix used to transform points will not always work on surface normals  Rotation is fine  Uniform scaling can stretch the normal (which should be unit)  Non-uniform scaling distorts the normal  Transforming by the transpose of the adjoint always gives the correct answer  In practice, the transpose of the inverse is usually used

  18.  Because of the singular value theorem, we can write any square, real- valued matrix M with positive determinant as:  M = R 1 SR 2  where R 1 and R 2 are rotation matrices and S is a scaling matrix  ( M -1 ) T = (( R 1 SR 2 ) -1 ) T -1 S -1 R 1 -1 ) T = ( R 2 -1 ) T ( S -1 ) T ( R 2 -1 ) T = ( R 1 = R 1 S -1 R 2  Rotations are fine for the normals, but non-uniform scaling will distort them  The transpose of the inverse distorts the scale in the opposite direction

  19. 1. With homogeneous notation, translations do not affect normals at all 2. If only using rotations, you can use the regular world transform for normals 3. If using rotations and uniform scaling, you can use the world transform for normals  However, you'll need to normalize your normals so they are unit 4. If using rotations and non-uniform scaling, use the transpose of the inverse or the transpose of the adjoint  They only differ by a factor of the determinant, and you'll have to normalize your normals anyway

  20.  Euler angles  Quaternions  Vertex blending  Morphing  Projections

  21.  Keep reading Chapter 4  Project 1 due Friday  Assignment 2 due next Friday

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend