Skip to content
Part IA Michaelmas Term

Perspective-Correct Interpolation

The Problem

Linear interpolation in screen space is only correct for parallel (orthographic) projection.

Under perspective projection, 3D properties are projected non-linearly onto 2D screen. Simply interpolating in screen space causes attributes like texture coordinates to distort.

The Solution

Interpolate quantities that are linear in screen space:

  • Perspective-divided attribute Q/zQ/z
  • Reciprocal depth 1/z1/z

The Formula

For pixel with barycentric coordinates (α,β,γ)(\alpha, \beta, \gamma) and depths zA,zB,zCz_A, z_B, z_C:

  1. Interpolate Q/zQ/z: (Qz)interp=αQAzA+βQBzB+γQCzC\left(\frac{Q}{z}\right)_{\text{interp}} = \alpha \frac{Q_A}{z_A} + \beta \frac{Q_B}{z_B} + \gamma \frac{Q_C}{z_C}

  2. Interpolate 1/z1/z: (1z)interp=α1zA+β1zB+γ1zC\left(\frac{1}{z}\right)_{\text{interp}} = \alpha \frac{1}{z_A} + \beta \frac{1}{z_B} + \gamma \frac{1}{z_C}

  3. Reconstruct: Q(x,y)=(Q/z)interp(1/z)interpQ(x, y) = \frac{(Q/z)_{\text{interp}}}{(1/z)_{\text{interp}}}

Why This Works

After perspective projection, 1/z1/z varies linearly in screen space. Dividing attributes by zz before interpolation, then dividing by 1/z1/z after, gives correct results.

Summary

  • Screen-space linear interpolation is wrong for perspective
  • Interpolate Q/zQ/z and 1/z1/z in screen space
  • Divide the results to recover perspective-correct QQ

Past Paper Questions

2022 Paper 3 Question 4: How does perspective-correct interpolation differ from linear interpolation on the screen? Why is it needed for texture mapping?