Chroma Keying technique with a material

I did not attempt to blend it outside the simple color, but you could blend it using any method.

If you want to do the blend elsewhere, you could instead divide the original texture by the alpha (the clamped node) * the original color. This step is call unpremultiplying. may require doing min with 1 to clamp. And you can optionally “lerp” this value to not do it at all.

Then pass the same alpha (clamp node) and use that to blend using one of the translucent modes.

doing things like unpremultiply really depends on usage cases.

Doing pure black is actually easier, you just need the “alpha offset” node, a scalar for the offset amount, then the multiply and clamp (basically the 4 bottom nodes in the above image). This will have issues with black pixels anywhere in the actual image though. To fix black pixels that you want to keep from being rejected (say a pupil), you may need to do some kind of blurring step.

When using black as the keycolor, thats basically what the above setup will do, since subtracting 0 doesn’t yield any difference.

I just messed with Keylight in Nuke which is considered the film industry standard and they do all kinds of blurring and dilation to get a better effect. All that is possible but starts to get expensive when you are doing multiple texture lookups per rendered pixel. The version above doesn’t have any of that cost so far.