Difference Matte

Prev Next

The Difference Matte operator compares the current frame against a "clean plate" (background image without the subject) to automatically generate a matte that isolates the foreground. This technique is ideal for locked-off camera shots where you need to extract a subject from a known background.

Image


Overview

Difference matting works by comparing each pixel in your footage to the corresponding pixel in the clean plate. Where the pixels differ significantly, that area is considered foreground; where they're similar, it's considered background.

Clean Plate     Current Frame     Difference      Matte
(empty room)  - (room + person) = (person shape) → (alpha channel)

Quick Start

  1. Add the Difference Matte operator to your composition (found in Chroma Keying)
  2. Click on Clean plate image and select your background image (a frame from your footage without the subject)
  3. Adjust Threshold until the subject is cleanly separated from the background
  4. Adjust Softness to smooth the matte edges

When to Use Difference Matte

Ideal scenarios:

  • Locked-off camera shots (camera doesn't move)
  • Consistent lighting between clean plate and footage
  • Subject doesn't cast strong shadows on the background
  • Quick extraction without setting up a green screen

Not ideal for:

  • Moving camera shots
  • Changing lighting conditions
  • Subjects that closely match the background color
  • Complex shadows that should be preserved

Settings

Clean Plate

Setting Description
Clean plate image Select the background image file. This should be a frame from your footage (or a separately captured image) showing the background without the subject.
Reload Button to reload the clean plate if the file has changed on disk.

Matte Generation

Setting Description
Threshold (%) Minimum difference to consider as foreground. Lower values = more sensitive, higher values = less sensitive. Start around 10% and adjust.
Softness (%) Edge softness / feather amount. Higher values create smoother transitions between foreground and background.
Pre-blur Blur the input before comparison to reduce noise sensitivity. Useful for noisy footage. 0 = no blur.
Difference mode How to calculate the difference. See Difference Modes below.

Difference Modes

Mode Description
RGB Average difference across all color channels. Best general-purpose option.
Luminance Difference in brightness only, ignoring color. Good when subject differs mainly in brightness.
Max Channel Uses the maximum difference from any single channel. More sensitive to small color shifts.

Color Tolerance (Advanced)

These settings allow you to ignore small differences in specific color channels, useful when there's slight color shift between clean plate and footage due to lighting variations.

Setting Description
Red tolerance (%) Ignore red channel differences below this amount.
Green tolerance (%) Ignore green channel differences below this amount.
Blue tolerance (%) Ignore blue channel differences below this amount.

Matte Refinement (Advanced)

Setting Description
Expand / Contract Positive values grow the matte outward, negative values shrink it inward. Use to include/exclude edge pixels.
Denoise Remove small isolated pixels that are likely noise. Higher values remove larger noise clusters.

Output

Setting Description
Output mode What the filter outputs. See Output Modes below.
Invert matte Swap foreground and background.

Output Modes

Mode Description
Composite Original image with matte in the alpha channel. Use this to composite over a new background.
Matte Only Grayscale image showing just the matte. White = foreground, black = background.
Foreground Only Premultiplied foreground (RGB multiplied by alpha).
Difference Raw difference visualization - useful for debugging and setting threshold.

Debug

Setting Description
Show clean plate Display the loaded clean plate image. Useful to verify it loaded correctly and matches the footage.

Keyboard Shortcuts

Key Function
F1 Cycle through output modes
F2 Cycle through difference modes
F3 Toggle invert matte
F4 Toggle show clean plate
F5 Reload clean plate

Creating a Clean Plate

From Your Footage

If you have a frame in your footage where the subject is not present:

  1. Navigate to that frame
  2. Export it as an image (PNG recommended)
  3. Load it as the clean plate

Shooting a Separate Clean Plate

For best results:

  1. After filming your shot, have the subject leave the frame
  2. Keep the camera in exactly the same position
  3. Keep lighting identical
  4. Capture a frame or short clip of the empty background
  5. Export and use as clean plate

Tips for Better Clean Plates

  • Same resolution - Clean plate must match footage resolution exactly
  • Same exposure - Any exposure differences will affect the matte
  • Same white balance - Color shifts will cause problems
  • No camera movement - Even tiny shifts will misalign the comparison

Workflow Tips

Setting Threshold

  1. Start with Output mode: Difference to see the raw difference
  2. Brighter areas in difference view = more difference from clean plate
  3. Adjust Threshold so your subject is bright and background is dark
  4. Switch to Output mode: Matte Only to see the resulting matte
  5. Fine-tune threshold until edges look clean

Dealing with Noise

If your footage is noisy:

  1. Increase Pre-blur to 1-3 to smooth out noise before comparison
  2. Use Denoise to remove isolated pixels in the matte
  3. Slightly increase Threshold to ignore noise-level differences

Dealing with Shadows

Shadows are challenging because they're "different" from the clean plate:

  1. If you want to include shadows: Lower threshold, but this may include noise
  2. If you want to exclude shadows: Use Luminance mode which is less sensitive to darkening
  3. Consider using Color tolerance to ignore the darkening effect of shadows

Edge Refinement

  1. Use Softness for natural-looking edges (20-40% typically)
  2. Use Expand/Contract to fine-tune edge position:
    • Positive values if you're losing edge detail
    • Negative values if background is bleeding through

Troubleshooting

Problem Solution
Matte is all white or all black Threshold is set too low or too high. Use Difference output mode to calibrate.
Clean plate doesn't load Check file path, ensure image exists and is a supported format.
Size mismatch error Clean plate resolution must exactly match input footage resolution.
Noisy/speckled matte Increase Pre-blur and/or Denoise. Slightly raise Threshold.
Edges are jagged Increase Softness.
Thin halo around subject Use negative Expand/Contract to shrink matte slightly.
Missing parts of subject Subject color is too similar to background in those areas. Try different Difference mode, or lower Threshold.
Shadows included in matte Switch to Luminance mode, or increase threshold, or add tolerance.

Technical Notes

  • The filter requires the clean plate and input to have identical dimensions
  • Processing is done entirely on GPU for real-time performance
  • Matte is generated per-frame; there is no temporal smoothing
  • For moving camera shots, consider using a different keying approach (Chroma Key, Roto, etc.)