Homogeneous coordinates
Related terms: w component, 4D vector, perspective divide
3D positions are stored with a fourth number, w. That extra slot is what lets a single 4x4 matrix move things as well as rotate and scale them.
A w of 1 marks a position. A w of 0 marks a direction, which moving must not change. After projection, w holds the depth. Dividing x, y and z by it is the perspective divide, the step that makes far things small.
- Further reading
- LearnOpenGL: Transformations: homogeneous coordinates