Keying Window Reflections, Smoke and Explosions

This post is about a keying technique that saved my ass on a couple of difficult shots recently.

Most keyers are all about pulling a matte from a green or blue screen plate which is then used to merge a despilled image onto the desired background. This technique has its limitations though and who doesn’t know the tedious task of combining and layering several keyers in different parts of an image until the result looks right.

There are, however, keying issues that are hard to get right even by combining multiple keyers: things like glass or glow. Both phenomena are additive in nature – they add light on top of what’s reflected from the green screen into the camera lens – which makes them different from semi-transparent things like smoke or motion blur. In compositing terms this means that there is no proper alpha value for them but since they change the color of the green screen behind them (reflections on a glass window are a good example) traditional keying algorithms will calculate an alpha value > 0 anyways.

click to enlarge

The technique I’d like to demonstrate is simple. I didn’t invent it, by the way. I first came across it in a post from the Shake mailing list years ago but didn’t fully understand it. A compositing artist on “Vanilla Sky” (if I remember correctly) said that he pulled a soft matte and used it to push the color-corrected background through the foreground, preserving grain and fine hair.

These are the steps you need to take:

  • Use a color difference formula to pull a soft matte, which is similar to despilling: use the difference between green and the average of blue and red, or the difference between green and the maximum of blue and red.
  • Instead of manipulating that matte until it’s fully black and white, use it as it is to add the background image onto the (despilled) foreground image. This will lead to a strange low-contrast mix of foreground an background. But here’s the trick:
  • Crank up the contrast of the background image until the result looks right. This of course only works in floating point since it requires pixel values outside the 0..1 range.

This technique will preserve edges perfectly as well as glow, reflections or smoke up to a degree where the greenscreen is but a tiny green tint in the background. On the other hand, it will also “imprint” any imperfections of your green screen into the result: folds, shadows, tracking markers, uneven lighting. This means that you either need to do some serious cleanup work and degraining beforehand or combine this technique with traditional keyers (e.g. just for fine hair, or inside a window pane).

I’ve turned all of this into a handy Fusion macro. For Nuke, you can use the “Despill” gizmo from Luma Pictures, which served as an inspiration for the UI of my macro.

I’ve called the tool “SpillMerge” since it performs a despill first, then merges a background image into the despilled area (it basically treats the screen as a giant spill-affected area instead of trying to pull a solid black/white matte).

Download SpillMerge here or read the manual at vfxpedia.com.

Tags: ,

Comments are closed.