Introduction:
This tutorial goes over the the different transformation matrices used in 3D graphics. Most of the time we use 4x4 matrices for 3D graphics because some transformation matrices require 4 columns,
and to compose all the transformations into a single matrix using matrix multiplication, 4x4 matrices are required. Composing transformation matrices into a single matrix and then applying that matrix to all vertices
is much more efficient than repeatedly multiplying matrices unnecessarily.
Transformation Matrices:
Translation matrix:
Translation matrices are used to move vectors around. A translation matrix has the form:
When applied to a vector, this has the following effect:
Scaling matrix:
Scaling matrices are used to change the sizes of vectors. A scaling matrix has the form:
When applied to a vector, this has the following effect:
Rotation matrix:
Rotation matrices are used to rotate vectors. In two dimensions, the following matrix can be used to rotate objects:
In 3D, rotation matrices can be created using Euler angles, which rotate on the seperate , ,
and . The problem with Euler angles is that it can create unexpected rotations (gimbal lock) if the programmer is not careful.
Quaternions are a more efficient way to create rotations and generate rotation matrices, and are explained more HERE.
Sources:
- Wikipedia - Rotation matrix: https://en.wikipedia.org/wiki/Rotation_matrix