1 The idea
Real lenses bend straight lines. Wide lenses usually bow outwards (barrel, negative k1 in this model); some long lenses bow inwards (pincushion, positive k1). CG always renders perfectly straight, so without distortion it slides near the frame edges.
The right way: undistort the plate only for tracking, then redistort just the CG so it bends like the lens. Never touch the hero plate.
x_d = x · (1 + k1·r² + k2·r⁴)2 Hands-on
Straight in the world, curved in the plate
Adjust k1 until the CG grid (cyan) sits on the plate’s lines (orange)
Where the numbers come from: Lens maths is the standard thin-lens model (FOV, CoC, hyperfocal), using CoC = sensor diagonal ÷ 1500, a common convention rather than a fixed rule. Distortion uses the Brown–Conrady model (k1, k2). The real DOF images are Blender Cycles renders.