Apex › Storage & databases

How 3D becomes 2D (perspective & the texture warp)

Projecting 3D to a screen divides each point by its depth (w), so the frustum maps to the NDC cube and parallel lines meet at a vanishing point. But texturing a receding surface can’t interpolate texture coordinates linearly across the screen — it warps (the PlayStation-1 wobble), because equal screen steps are unequal 3D steps. The fix: 1/w is the linear-in-screen quantity, so interpolate u/w, v/w, 1/w then divide. Verified in node: frustum corners → NDC cube exactly, and perspective-correct interpolation equals the true 3D value to 1e-15 while affine is off by a third of the range. Toggle the warp on a receding checkerboard floor.

More in Storage & databases