Aller au contenu

Difference Keyer Node

By Kriss Norde

The Difference Keyer produces an alpha by analyzing the difference between two images (a plate with the subject + a clean plate without it), not by color. Perfect in theory, but in practice tiny camera movements often ruin the result. Use it with a perfectly locked-off camera.

Overview

The Difference Keyer does not use a color reference like the other keyers. It compares two images pixel by pixel:

  • Foreground - the plate with the subject
  • Background - a clean plate of the same set without the subject

Result: everything that differs between the two images is the subject → becomes opaque. Everything that is identical = the set → becomes transparent.

Elegant in theory, but it depends on a perfectly stable camera. The slightest camera move between the two shots breaks the key.

Where to find this node

  • Effects Library: Tools > Matte > Difference Keyer
  • Quick add: right-click in the Node Editor → Add Tool > Matte > Difference Keyer

Principle: difference keying

Mathematically: |foreground − background| per pixel → alpha.

  • A pixel identical between FG and BG → difference = 0 → transparent.
  • A very different pixel → high difference → opaque.
  • A slightly different pixel → semi-transparent.

The Threshold parameter sets how much difference it takes for a pixel to become opaque.

An absolute prerequisite: the camera and the lighting must be identical between the shot with the subject and the clean plate shot. A tiny shift (1 pixel) already produces dirty edges.

Inputs

  • Foreground - required. The plate containing the subject and the set.
  • Background - required. The clean plate: the same set without the subject, shot under the same conditions (same camera, same position, same lighting).
  • Garbage Matte - optional. Areas made transparent (removing rigs, floors, etc.).
  • Solid Matte - optional. Areas forced to opaque.
  • Effect Mask (blue) - optional. Limits the keying to an area.

Setup

MediaIn (plate with subject) → Foreground ┐
                                           ↓
MediaIn (clean plate without subject) → Background
                                           ↓
                                Difference Keyer → Merge 2D → Saver

The clean plate must be a real plate shot without the subject, not an image generated by the Clean Plate node (which is meant for green/blue screens).

Controls tab

Threshold (range)
Sets the difference range:
  • Below the low threshold → transparent.
  • Above the high threshold → opaque.
  • In between → semi-transparent (grayscale gradation).
Blur & Filter
Softens the edges of the matte. Available algorithms: Box, Bartlett, Multi-box, Gaussian.
Contract / Expand
Shrinks or grows the semi-transparent areas of the matte. Combined with Blur, it reduces fringing.
Gamma
Adjusts the opacity in the gray areas of the matte, without touching the fully black or white areas.
Post-Multiply Image
Sets whether the RGB channels are multiplied by the alpha created by the keyer. Tick it to output a premultiplied image ready for compositing.

Limitations

The official documentation explicitly notes that subtle variations in camera position between shots usually make it hard to get a clean result.

  • Camera movement = broken pixel-to-pixel alignment → dirty edges, fringing everywhere.
  • Lighting variation between the two shots (a passing cloud, neon flicker) → differences everywhere, even where there is no subject.
  • The subject's shadows - they count as differences, so they may be keyed incorrectly.
  • Camera white changes (auto exposure, auto white balance) between takes → disaster.

As a result, the Difference Keyer is rarely used on its own. It usually serves as one part of a multi-keyer chain, or for cases where the camera is absolutely fixed (lockoff on a tripod).

Use cases

  • Locked-off camera on a tripod - a setup where you shoot with the subject first, then without it, without touching the camera. Ideal for timelapses, conference sets, fixed studio setups.
  • Isolated element on a complex background - extract a subject from a non-colored set (too complex for color keyers).
  • Pre-matte for another keyer - use the Difference Keyer output as a Garbage or Solid Matte for a Delta Keyer that does the fine work.
  • Stop-motion / timelapse - both shots are by definition from a fixed camera. The Difference Keyer works perfectly.
  • Isolation for an effect - extract the subject to apply a glow, slow motion, etc., then put it back over the original background with a Merge.

Tips

  • A locked-off camera is mandatory - tripod + rigid camera + turn off any optical stabilization. A sub-pixel shift = a ruined key.
  • Identical lighting between shots - no auto exposure, same white balance, same ISO settings. The clean plate shot should come right before or right after the shot with the subject.
  • Stabilize upstream if there is movement - if the camera moved slightly, use a tracker to align the clean plate with the Foreground before the Difference Keyer. It can rescue a mediocre shot.
  • Blur + Contract - the usual combo to soften dirty edges.
  • Use it as a garbage/pre-matte - less common but powerful: use the Difference Keyer to roughly isolate the subject, then a fine keyer (Delta, Ultra) for the final work.
  • For most green/blue cases, stick with the Delta Keyer or Ultra Keyer. The Difference Keyer is a niche tool for specific situations.