1 / 15

UW Extension Certificate Program in Game Development 2 nd quarter: Advanced Graphics

UW Extension Certificate Program in Game Development 2 nd quarter: Advanced Graphics. Math Review. Goals. Review the basic math operations used in graphics Learn other, more advanced operations Learn/review how to reason with matrix algebra. Vectors.

yuki
Download Presentation

UW Extension Certificate Program in Game Development 2 nd quarter: Advanced Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UW ExtensionCertificate Program inGame Development 2nd quarter:Advanced Graphics Math Review

  2. Goals • Review the basic math operations used in graphics • Learn other, more advanced operations • 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 P’ Q’ P Y Q Box Box X O

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

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

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

  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 Frame F={O, X, Y} Y’ O’ X’ Frame F’={O’, X’, Y’} P Y X O

  13. Reference frames Y’ O’ X’ P Y X 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 • Va= V0*(1-a) + V1*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

More Related