Key

Remove a colour background with a chroma key.

What it does

Key pulls a transparency matte by comparing every pixel against a reference, a key colour, a brightness level, or a clean background plate, and turning matching pixels transparent. It covers green-screen and blue-screen work, brightness keys, and difference keys against a locked-off empty background.

Five modes: Chroma and Chroma (Video) key out a specific hue, Luma keys out shadows or highlights, Color keys out an exact colour by distance, and Difference compares against a Clean Plate to key out anything that has not changed. Tolerance and Softness set how tight the key is and how soft its edge falls off. Despill cleans colour spill from the screen onto the subject's edges.

When to use it

ParameterTypeDefaultWhat it does
content_inRaster——
clean_plateRaster—Clean plate for difference keying (empty background plate)
depth_inRaster—Depth buffer (R channel = [0,1] depth, 0 = near, 1 = far). Connect from a 3D render's depth output.
object_id_inRaster—Object ID buffer (R channel = per-object integer id). Connect from a 3D render's Object ID output.
modeString"Chroma"Chroma: HSL hue-based, Chroma (Video): optimized for video footage, Luma: brightness, Color: RGB distance, Difference: plate comparison, Depth: keep a depth range from the wired Depth AOV, Object ID: keep one object by its render id. One of: Chroma, Chroma (Video), Luma, Color, Difference, Depth, Object ID.
target_objectString""The object to keep — pixels belonging to it stay, everything else keys out
antialiasedBooleanfalseSoft, anti-aliased object matte (summed coverage) instead of hard-edged id equality
key_colorColorrgba(0.00, 1.00, 0.00, 1.00)The color to key out (green for green screen, etc.)
toleranceNumber0.200Core tolerance - colors within this distance are fully keyed
softnessNumber0.100Soft edge width - colors in falloff zone get partial alpha
depth_nearNumber0Near depth bound — pixels closer than this are rejected (matte 0)
depth_farNumber1Far depth bound — pixels farther than this are rejected (matte 0)
clip_blackNumber0Clip matte black point - pixels below this become fully transparent
clip_whiteNumber1Clip matte white point - pixels above this become fully opaque
invertBooleanfalseInvert the matte (swap opaque and transparent)
despillNumber0.500Strength of color spill removal from foreground
despill_methodString"Average"Average: (R+B)/2, Double: max(R,B), Limit: min(R,B). One of: Average, Double, Limit.
luma_targetString"Dark"Dark: key out shadows, Light: key out highlights. One of: Dark, Light.
edge_refineBooleanfalseEnable morphological operations for matte cleanup
erodeNumber0Shrink matte edges (removes fringe)
dilateNumber0Expand matte edges (fills holes)
edge_blurNumber0Soften matte edges
output_modeString"Keyed"Keyed: RGB with alpha, Matte: grayscale matte preview. One of: Keyed, Matte.
spatial_strengthField—Spatial field controlling where the effect applies (0=bypass, 1=full)
strengthNumber1Effect strength / wet-dry (0 = no effect, 1 = full). Editable, wirable, keyframable.

Gotchas

Despill acts only when Key Color is a green or blue hue. With a red, yellow or other off-hue key colour the Despill slider stays visible and has no visible effect: spill suppression is built around the green and blue screen case.

Difference mode needs a Clean Plate wired in, an empty background plate shot from the same locked-off camera position. Without one there is nothing to compare against and the key does not work.

Edge Refinement (Erode, Dilate, Blur) affects the alpha edge only, so it does nothing when Output Mode is set to Matte, which is fixed fully opaque for preview. Switch back to Keyed to see refinement take effect.

Worked example

  1. Add a Key node and wire green-screen footage into Content In.

  2. Leave Mode on Chroma and set Key Color by sampling the screen colour.

  3. Raise Tolerance until the background disappears, then raise Softness slightly to smooth the cutout edge.

  4. If a green fringe shows around the subject, raise Despill.

  5. If the matte has small holes or ragged edges, enable Edge Refinement and adjust Erode, Dilate and Blur to clean it up.

See also

Matte Refine · Blur · Color Space · Rasters (images)