1 The idea
A checkerboard is all straight lines, ideal for seeing what distortion does. k1 sets the main bend; k2 adds more only far from the centre (the corners). Some wide lenses need both.
In real work these values come from shooting a lens grid on set and solving them in the tracking software, not from eyeballing.
2 Hands-on in the mini compositor
3 Deep dive
Reading the checkerboard
In the lab model, a source point at distance r from the centre (corner = 1) lands at r × (1 + k1 r² + k2 r⁴). Lines through the exact centre stay straight, because their points only slide along the same line. Lines away from the centre bend, and bend more towards the edges.
Negative k1 pulls points towards the centre and lines bulge outwards (barrel). Positive k1 pushes points out and lines pinch inwards (pincushion).
| k1 | k2 | Move at r = 0.5 | Move at r = 1 (corner) |
|---|---|---|---|
| −0.1 | 0 | −2.5% | −10% |
| +0.1 | 0 | +2.5% | +10% |
| 0 | +0.1 | +0.63% | +10% |
| −0.1 | +0.1 | −1.9% | 0% |
k2 and wavy lines
k2 multiplies r⁴. Halfway out (r = 0.5), r⁴ is only 0.0625, but at the corner it is 1. So k2 barely touches the middle of the frame and acts fully at the corners. See row three of the table: under 1% halfway, 10% at the corner.
When k1 and k2 have opposite signs, say −0.1 and +0.1, the middle still bulges like barrel but the corners are pulled back until they don’t move at all. Straight lines turn wavy. Some wide-angle lenses do this, which a single k1 can’t follow.
Wavy lines = you need k2 as well
Black corners and lost edges
With strong barrel, the corner pixels of the output must fetch data from outside the source frame, where there is nothing, so you see black corners. It is the same reason CG is rendered with overscan before a redistort.
Pincushion does the opposite: image at the edges is pushed out of frame and lost. Undistorting a barrel plate behaves like pincushion, so some of the plate’s edge leaves the frame; if you need to keep it, work in a larger format.
Using a checkerboard to check real work
Before trusting a lens node in a shot, send a checkerboard through undistort then redistort and compare with the original using Merge difference. Inside the frame, only faint lines along the square edges should remain, from resampling. Thick lines or a shift there mean the two directions are not true inverses. The outer border can still differ, because edges may have been pushed out of frame, as described above.
Every warp is a resample and softens the image. So the real plate should never go through a round trip: warp only the copy used for tracking, and only the CG.
- 1CheckerBoard
- 2Undistort
- 3Redistort
- 4Difference vs original
4 In real work
In Nuke
- A CheckerBoard at plate size, to see what a lens node does to straight lines
- LensDistortion (NukeX): solve from the lens grid shot on set, not by eye
- Round-trip test: CheckerBoard → LensDistortion (undistort) → LensDistortion (redistort) → Merge difference against the original
- Hand it on as an STMap and warp with the STMap node so everyone gets the same result (recap from L4)
Common mistakes → the fix
- ✗ Using only k1 on a lens whose lines go wavy✓ Let the solver find k2 too, then check the corners on the checkerboard
- ✗ Seeing black corners after a redistort and scaling the image up to hide them✓ Render the CG with overscan; scaling breaks size and position against the track (recap from L4)
- ✗ Undistorting and redistorting the real plate before the merge✓ Leave the real plate alone; warp only the tracking copy and the CG
- ✗ Trusting a lens node without a round-trip test✓ Send a checkerboard through and back and look at the difference
Before you send the shot
- Lens values come from a lens grid or straight lines in the plate, not a guess
- Checkerboard corners are straight, not wavy
- The round trip leaves only faint resampling lines
- The CG has enough overscan for the redistort; no black corners
- The real plate never goes through a round trip
5 Check yourself
Where should real distortion values come from?
🔒 Answer the question above and this card opens
1. k1 = 0, k2 = +0.1 in our model. How far do a halfway point (r = 0.5) and a corner point move?
2. On the checkerboard, lines bulge out in the middle but come back straight at the corners. What does that mean?
Where the numbers come from: Computed in your browser. Saturation, Multiply, Clamp, Invert, Keymix, Copy and Grade match Nuke 17.0v2 (checked). Blur, Defocus, Glow, Sharpen, ChromaticAberration, Vignette, LensDistort, Grain, Erode, Toe, the Keyer and Despill are teaching versions, not identical to Nuke’s nodes. Transform here is also a teaching version: bilinear filtering, no concatenation, cropped at the frame edge. Images are our own Blender renders (the green screen is fully code-built; the desert scene uses Gaea 2.3 hills, a Poly Haven CC0 HDRI sky, Poly Haven CC0 rocks and grass, Quixel sand and cliff textures and a Mixamo rig for the robot, with Quixel and Mixamo used in the renders only).