In Computer Graphics, under Perspective Projection use a 4D vector to represent 3D points.

The point of using homogenous coordinates is so that a single transformation can be represented by a single matrix multiplication.

Video explanation.

Homogenous coordinates are not Quaternions, even though both are 4D objects.

OpenGL and Vulkan force you to use homogenous coordinates.

If we were to use 3D vectors, rotation and scaling would use matrix multiplication, but translation use matrix addition. By adding a fourth coordinate, w, all transformations can be done exclusively with matrix multiplication. GPUs excel at matrix multiplication and Graphics Pipelines with fewer steps. Therefore, to have a single Model Matrix to represent a single transformation is ideal.

The coordinate system is called “Homogenous” precisely because it enables all compositions transformations to be described in a single model matrix.

Homogenous 3D

Converting a regular 3D transformation matrix to homogenous:

A homogenous shift matrix in 2D

A homogenous shift matrix in 3D

  • If , do not render (Clip)
  • Let
  • When , translations are possible.
  • When , translations are not possible.
  • Else, scale all coordinates such that again