Computer Graphics

From games to film effects, every 3D scene on the screen is a product of linear algebra. The linear transformations, matrix multiplication, the cross product and the determinant that you have studied in this course are the everyday tools of computer graphics.

I. 3D Transformations: Everything Is a Matrix

The scaling, rotation and translation of an object are all represented by matrices:

p′=Mprojection⋅Mrotation⋅Mtranslation⋅p\mathbf{p}' = M_{\text{projection}} \cdot M_{\text{rotation}} \cdot M_{\text{translation}} \cdot \mathbf{p}
  • matrix multiplication = the composition of transformations: first translate, then rotate, and finally project
  • several transformations can be pre-multiplied into a single matrix, so that one multiplication performs all of them

II. Homogeneous Coordinates: Unifying All Transforms with a 4×4 Matrix

Homogeneous coordinates: append a component ww (usually w=1w = 1) to the three-dimensional coordinates, so that all the transformations (including translation) can be represented uniformly by a 4×4 matrix.

Why is this necessary? Because the translation p+t\mathbf{p} + \mathbf{t} is not a linear transformation (it moves the origin), and so it cannot be written as a 3×3 matrix. With homogeneous coordinates, a translation can also be written as a matrix multiplication:

(p′1)=(I3t01)(p1)\begin{pmatrix} \mathbf{p}' \\ 1 \end{pmatrix} = \begin{pmatrix} I_3 & \mathbf{t} \\ 0 & 1 \end{pmatrix} \begin{pmatrix} \mathbf{p} \\ 1 \end{pmatrix}
  • rotation, scaling, translation and shearing are all unified as 4×4 matrices
  • composing several transformations = multiplying 4×4 matrices, still done with a single multiplication

III. Normal Vectors and the Camera Transform

  • Computing a normal vector: the cross product of two non-collinear vectors gives the normal to the plane they lie in (recall the geometric meaning of the cross product: the result is perpendicular to the two input vectors, and its length is the area of the parallelogram)
  • The camera transform: converting world coordinates into camera coordinates — in essence a change of basis (a change of coordinate system)

IV. The Rendering Pipeline: A Whole String of Matrix Multiplications

Every step of the rendering pipeline is a matrix operation:

StageThe linear algebra operation
The model transformtakes the object from model coordinates to world coordinates
The view transformtakes world coordinates to camera coordinates
The projection transformprojects the 3D coordinates onto the 2D screen (perspective or orthographic)
Clippingdecides whether a vertex lies inside the view frustum

A GPU processes these matrix multiplications in parallel — a single frame of a game executes millions of them.

Summary

Symbols Used in This Article

SymbolTypePronunciation/ExplanationMeaning in This Article
p\mathbf{p}Mathematical symbolpThe position vector of a vertex
p′\mathbf{p}'Mathematical symbolp primeThe position of the vertex after the transformation
MprojectionM_{\text{projection}}Mathematical symbolM projectionThe projection transformation matrix
MrotationM_{\text{rotation}}Mathematical symbolM rotationThe rotation transformation matrix
MtranslationM_{\text{translation}}Mathematical symbolM translationThe translation transformation matrix
I3I_3Mathematical symbolI 3The 3×3 identity matrix
t\mathbf{t}Mathematical symboltThe translation vector
wwMathematical symbolwThe additional component of the homogeneous coordinates (usually 1)
×\timesMathematical symbolcrossThe cross product, used to compute normal vectors

Found an issue with this content?

Tell us what could be improved.