1 The idea
Erode shrinks the matte (negative) or grows it (positive). Leftover green edges disappear because they are cut out of the matte, not because their colour is fixed (that is despill’s job, K3). It eats hair and thin lines too, so it belongs at the end of edge fixing.
Suggested order: despill first, then adjust the alpha (gamma, covered in K5), then edge extend, then erode only if still needed.
2 Hands-on in the mini compositor
3 Deep dive
How the lab’s Erode works
Our Erode is a square min filter: every alpha pixel takes the smallest value within radius r around it. A positive size does the reverse (takes the largest value): a dilate that grows the matte.
The result: any detail 2r pixels wide or less disappears completely, it doesn’t just get thinner. The robot’s antennas are 1–2 pixels wide, so an erode of −1 deletes them entirely.
| size | Window | Fully removed |
|---|---|---|
| −1 | 3 × 3 | Up to 2 px wide |
| −2 | 5 × 5 | Up to 4 px wide |
| −3 | 7 × 7 | Up to 6 px wide |
It doesn’t fix the edge, it cuts it off
The green edge vanishes after an erode because the green-tinted edge pixels are cut out of the matte, not because their colour was fixed. So the whole robot gets thinner, its shape changes, and where it touches the ground it can lift off its shadow.
Dilating afterwards doesn’t bring the antennas back: a line that is gone has nothing left to grow. So erode-then-dilate removes small things, while dilate-then-erode closes small holes in the matte.
- 1Erode −1
- 2Antennas gone
- 3Dilate +1
- 4Still gone
Where erode belongs
Erode suits the core matte, the solid inside that should sit a few pixels in from the edge anyway, and garbage mattes. It doesn’t suit the edge matte that holds hair, wires and motion blur.
If you really must erode the edge, limit it with a roto to the problem spot, such as the robot’s shoulder, not the whole body, and make it the last step after despill, alpha gamma and edge extend.
- 1Despill
- 2Alpha gamma
- 3Edge extend
- 4Erode (if still needed)
Nuke has several erodes
Nuke has several erode nodes. They share the idea of shrinking or growing a matte, but compute it differently from our lab. Dilate grows or shrinks in whole-pixel amounts; FilterErode adds a choice of filter kernel, but with a box filter its edges are still stepped. So the results won’t match ours exactly.
A box erode leaves stepped edges and square corners; follow it with a small blur so the edge is soft again and fits the plate.
The sign of size differs between nodes; test it on the alpha first
4 In real work
In Nuke
- FilterErode (filter box) on the core matte, followed by a small Blur
- Dilate for whole-pixel shrink or grow, e.g. on a garbage matte
- Combine the eroded core with the untouched edge matte using Merge max
- If the real edge must be eroded, plug a roto into the mask input so only the problem spot is hit
Common mistakes → the fix
- ✗ Eroding the whole matte to remove a green edge✓ Despill and adjust the alpha gamma first; erode is the last resort
- ✗ Dilating back to recover the antennas✓ Lost lines don’t come back; erode only the core and keep the edge matte
- ✗ Eroding without checking where the robot meets the ground✓ Check the feet against the shadow; if they float, limit the erode with a roto
- ✗ Box-eroding without a blur✓ Add a small blur after the erode so the edge is as soft as the plate
Before you send the shot
- Thin detail (antennas, hair, wires) is still in the alpha
- Erode is on the core or garbage matte, or limited by a roto
- The robot’s silhouette isn’t thinner than in the original plate
- Edges aren’t stepped or squared
5 Check yourself
A thin green edge is left. What do you try before eroding?
🔒 Answer the question above and this card opens
1. In the lab, an erode of −2 completely removes detail up to what width?
2. An erode of −1 removed the antennas. What happens if you add a dilate of +1?
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).