Day 10 - Matrices in 3D Graphics

Matrix Overview

5 different martices for 3D graphics

  • Identity
  • Scale
    • Multiply the identity diagonal by the scale factor
  • Translation
    • Move to 4x4, the last coumn is the trasnlation amount.
  • Rotation
    • 3 different matrices, look them up, not because you are lazy, but because you are precise
    • Never track rotation as a sum of roations, store local x, y, and z axes in world space.
  • Projection
    • Divide x and y by z
    • The way this is implemented is by breaking the w rule. Put 1 in the 3,4 matrix location. This will result in a non-1 w value. Divide by w. Away we go.
  • Change of basis matrix

Scale Matrix

ScaleMatrix

Rotation Matrices

3DRotationMatrix

Translation Matrix

TranslationMatrix

Projection Matrix

ProjectionMatrix