Orthographic Projection

The view matrix delivered the world into camera space. Now we must flatten that 3-D camera space onto a 2-D screen — to project it. The simplest possible recipe is orthographic projection: drop the depth, keep the sizes. Rays travel parallel to the viewing axis, like sunlight, so a thing's apparent size never depends on how far away it is.

It is the projection of blueprints, isometric strategy games, and CAD packages: a wall ten metres back looks exactly as tall as the same wall up close, and parallel lines stay parallel. No vanishing point, no foreshortening — just honest, measurable sizes.

Mapping the view box onto the canonical cube

After the view transform, the slab of space the camera can see is an axis-aligned box: the horizontal extent [l, r], the vertical extent [b, t], and the depth extent [n, f] (near and far). The GPU wants every visible vertex remapped into the canonical cube — the homogeneous Normalised Device Coordinates (NDC) cube [-1, 1]^3. Each axis is handled independently by a scale then translate. Take x.

Step 1 — slide the box's left edge to zero. Subtract l so the range [l, r] becomes [0,\, r-l]:

x - l.

Step 2 — scale the width to 1. Divide by the width r - l, so the range becomes [0, 1]:

\frac{x - l}{r - l}.

Step 3 — stretch to width 2 and centre on zero. NDC runs from -1 to 1, a span of 2. Multiply by 2 and subtract 1:

x_{\text{ndc}} = \frac{2(x - l)}{r - l} - 1.

Step 4 — check the endpoints. At x = l this gives 2\cdot 0 - 1 = -1; at x = r it gives 2\cdot 1 - 1 = +1. The left edge maps to -1, the right edge to +1, exactly as required.

Step 5 — separate the scale from the translate. Expand and regroup so the affine shape (\text{scale})\,x + (\text{offset}) is plain:

x_{\text{ndc}} = \underbrace{\frac{2}{r-l}}_{\text{scale}}\,x \;-\; \underbrace{\frac{r+l}{r-l}}_{\text{offset}}.

Step 6 — repeat per axis. The y and z axes get the identical treatment with their own bounds:

y_{\text{ndc}} = \frac{2(y - b)}{t - b} - 1, \qquad z_{\text{ndc}} = \frac{2(z - n)}{f - n} - 1.

Step 7 — note the conspicuous absence. Nowhere does x_{\text{ndc}} divide by depth z. The horizontal result is the same whether a vertex is near or far — which is precisely why orthographic projection never shrinks anything with distance.

Orthographic projection flattens camera space with parallel rays.

An architect's elevation drawing would be useless with perspective: you measure a door off the page with a ruler, and that only works if a metre at the back of the wall is drawn the same length as a metre at the front. Orthographic projection guarantees it. The same property is why a top-down strategy game uses ortho (or its cousin, isometric) — two identical tanks must read as the same size whether they sit at the top of the map or the bottom, so you can compare your army at a glance without distance lying to you.

The trade is realism: with no foreshortening the scene looks flat, like a technical diagram rather than a photograph. When you want distance to shrink things — a first-person camera peering down a corridor — you need rays that converge to a point, which is the perspective frustum.

Same size, any depth

Two identical crates sit in camera space at different depths — one near, one far. Drag the depth gap slider to push the far crate further back. Under orthographic projection the parallel rays (the dashed guides) carry both crates straight onto the screen plane at the same width: the rendered outlines stay exactly equal no matter how far apart in depth they are. That is the whole personality of ortho — distance changes nothing about size.