Presentation is loading. Please wait.

Presentation is loading. Please wait.

UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Math Review.

Similar presentations


Presentation on theme: "UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Math Review."— Presentation transcript:

1 UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Math Review

2 Goals 1. Review the basic math operations used in graphics 2. Learn other, more advanced operations 3. Learn/review how to reason with matrix algebra

3 Vectors  Represent entities like colors, points and directions  Addition, subtraction: per-component  Scalar product: same direction, and magnitude multiplied by the scalar  Dot product: product of magnitudes and cosine of the angle between the vectors (scalar)  Cross product (3D only): Orthogonal to both operands. Magnitude is product of magnitudes and sine of the angle between the vectors  Not commutative!

4 Matrices  Represent entities like orientations, transformations and reference frame transfers  Addition, subtraction: per-component  Scalar product: multiply all components with scalar  Matrix product: dot product per component of result  Not commutative! Not all matrices have inverse!  Transposed, determinant, eigenvalues, eigenvectors  Convention: Direct3D multiplies vectors on the left (uses row vectors). OpenGL does it the other way

5 Translation vector X Y O P P’ Q Q’ Box

6 Rotation matrix X Y O P P’ Q Q’ Box

7 Scale matrix X Y O P P’ Q Q’ Box

8 Shear matrix X Y O P P’ Q Q’ Box

9 Transforms

10 Algebra  Standard real-number algebra:  ABx + C = D  Find x:  Matrix algebra:  ABx + C = D  Find x:  It’s different – you need to be careful

11 Reference frames  Vectors must be expressed on a reference frame  Gives meaning to the coordinate values  Reference frame specifies  Where the origin is  Where each axis is  What scale each axis is  Defined by as many vectors as dimensions, plus one (for the origin)  Again, vectors normally expressed in some reference frame

12 Reference frames X Y O P X’ Y’ O’ Frame F={O, X, Y} Frame F’={O’, X’, Y’}

13 Reference frames X Y O P X’ Y’ O’

14 Transform “sandwich”  Use to transform the transforms  Or to apply a transform defined in a different reference frame  Apply shear H along orientation defined by R:  H’ = R -1 * H * R  Apply transformation M, defined in reference frame F  M’ = F * M * F -1  Think like this: v * M’ = v * F * M * F -1

15 lerp (Linear intERPolation)  Very common operation, appears everywhere  V a = V 0 *(1-a) + V 1 *a  More complex interpolations often expressed using lerps  For example, Bezier curves are composition of lerps  The problem: lerp doesn’t work with matrices  Resulting matrix is not a rotation  It works, sort of, with quaternions  Need to renormalize afterwards  Speed is not constant


Download ppt "UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Math Review."

Similar presentations


Ads by Google