Skip to main content

From Camera to Clip Space - Derivation of the Projection Matrices

· One min read

From Camera to Clip Space

Derivation of the Projection Matrices

My latest article examines the transformation from camera space to clip space and ultimately to Normalized Device Coordinates (NDC). In the article, we derive the complete orthographic and perspective projection matrices, with a special emphasis on OpenGL conventions.

We begin with the orthographic projection and derive a projection matrix that maps an arbitrary view volume onto the so-called unit cube. Along the way, we use figures to show how an orthographic projection affects objects we usually perceive in a perspective manner.

We then derive the perspective projection and show how choosing a near and a far viewing plane, as well as a height and a width encoded in the aspect ratio, creates a view frustum that contains the objects visible to the observer, while any geometry outside of it is clipped and discarded from the rendering process.

Continue reading...