Explains how simple depth division underlies perspective in 3D graphics and how that idea scales into the full camera pipeline. It starts from the elementary projection x' = x / z, y' = y / z and shows shader examples that place and scale points and line geometry by dividing XY by Z, which causes distant points to converge toward the vanishing point. Those demos are useful but limited; full camera behavior also needs orientation, position, field of view, aspect ratio and near/far clipping. The practical solution is the 4x4 perspective projection matrix, which encodes a focal scale f = 1/tan(fov/2), aspect a = width/height, and depth mapping coefficients A = (F+n)/(F-n), B = -2Fn/(F-n). That matrix produces clip-space coordinates ready for perspective division.
Describes how homogeneous coordinates and the matrix produce clip-space (fx/a, fy, Az+B, z), after which dividing by w (here z) yields normalized device coordinates: x_ndc = (f/a)x / z, y_ndc = fy / z. Setting f=1 and a=1 recovers the simple x/z trick, so depth division is just a special case of the projection matrix. Lays out the pipeline: world → view → clip → /w → NDC → pixels → rasterization, and argues that understanding each transform lets you choose which pieces to implement, optimize, and reason about visibility, culling and rendering.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.