Master the fundamental concepts of modern graphics apis (low level) through this focused micro-challenge.
A 3D vertex starts in model space (local to the object). Before rendering, it passes through several spaces, each with a transformation matrix:
The combined transform is v_clip = P * V * M * v_model. Column vectors apply right-to-left: M first, then V, then P.
Clip space coordinates have a homogeneous w component. The GPU divides by w to reach normalized device coordinates in [-1, 1]. Projection matrices encode field of view, aspect ratio, and near/far planes. Distant objects appear smaller because w grows with depth.
glslLoading…
For example, a vertex at model-space (1, 0, 0) transformed by translation +45 on X lands at world (46, 0, 0) before view and projection compress it into clip space.
You will implement 4x4 matrix-vector multiplication and the full MVP chain for a single vertex. This task requires you to print coordinates at each space. Getting multiplication order wrong (PVM vs MVP) is the most common bug on graphics forums, and this exercise forces you to trace the correct sequence.
Write a C program that implements a vertex shader transformation pipeline.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github