Aftereffects Keying in ACEScg


although it’s far from comfortable, I am using an ACES workflow in Aftereffects for at least one year. With the OCIO plugin.

Again and again I face the same question: Is Keying in ACEScg a good idea? Or is Keying in Linear-Space a good idea at all? It’s always a little unpredictable what happens. I got a feeling, that the Keylight plugin is not really prepared for linear greenscreen footage. Or at least optimized for a Rec709 workflow.

So can someone help me with:

  • Can Keylight handle 32Bit linear data at all? Does it see values above 1?
  • Is ACEScg a good workingspace for such work?

Thanks for any ideas!


1 Like

I have been searching the depths of the internet for the answer to this question; to no avail.


create a shape with a soft fall off with a green value of RGB 0/5/0 for example. And a second one overlapping with a RED shape of 1/0/0. Then key this with key light. In Nuke you get a valid result and I don’t know why AE should behave in any way different in a 32-bit project.

Oh wow, this is an important question that deserves an answer.

In my experience, you don’t want to key in a linear space like ACES/ACEScg. Keying is all about managing imperfections, but if you key in a linear space the imperfections in darker areas will get amplified when the view LUT is applied.

So what you want to do is key in a video space instead, or maybe a log space like ACEScc. Anything but linear. Probably the closer to your final display, the better. This way the imperfections of the key are evenly distributed across perceptual space, which will look a lot better.

So you convert from ACES/ACEScg to ACEScc or whatever, do the key, and then convert back, right? Not so fast! You also have to do the actual A-over-B composite in non-linear space as well or you’ll get the same problem with the artifacts being more harsh in the dark areas. In After Effects you might sandwich your keyed footage between adjustment layers that go ACES->ACEScc below and then ACEScc->ACES above. Keylight should retain all your 32-bit values.

I came across this on my first linear show in the new AE 7.0 at The Orphanage way back when. The 30 second Keylight demo worked great before we started introducing linear into the equation. The answer was to bounce back to video space for the keying and then back to linear right after.

When you use OCIO to do your colour management in After Effect, it no longer “knows” what the current colour space of the image is. I suspect the version of Keylight for After Effects is different from the one for Nuke. Since Nuke always linearises, well designed Nuke ops are written with that in mind. After Effects plugins are probably written with an assumption of “video” image data. Even if they can adapt intelligently to the image state based on After Effects built in ICC colour management, OCIO will hide that from them. Or in fact any information they are passed about the image state is likely to be wrong.

Using the OCIO plugin means you need to take manual control of your colour pipeline, and that may include sandwiching ops between colour transforms to ensure the image data is in an appropriate state.

I think that is indeed true for most of their plugins. I have no idea what their Keylight expects but I know that if you use ACES to go to linear you have to flip these switches to prevent a double convert.

If you have a hybrid ACES setup in AE with color management enabled and linearize working space checked you don’t have to do those switches and maybe other plugins will behave differently too but I’ve never tested that.

These are the only effects that I know of that give you that option though. In general all 32bit plugins should somewhat support what you’re trying to do but the parameter ranges might be made for “video” making it possibly difficult to finetune in linear space.
In those cases I would indeed create a sandwich for those effects.

Yeah, in general all AE filters are made with video space in mind. Or in many cases, like Levels or Add transfer mode, the math is the same either way but the result is different in linear, some would say better. Exposure is a special beast where it actually detects if you’re in linear and does the straight forward exposure math in that case, inserts linear conversions otherwise. Camera Lens Blur may do the same. The API they use to figure out if you’re in linear isn’t publicly available.

Maybe Keylight in Nuke does all that color space conversion internally? It doesn’t let you specify which color space is coming in, but it does let you give it a background to handle the composite.

Has anybody found a solution to keying in ACES in After Effects? Seems like a pretty essential thing.

I think it’s most common for keying to create the matte separate from the despill and other corrections you want to apply to the material itself. So what’s stopping you from keying the log footage or convert it to rec.709? As long as it works for the matte the source material can just stay in whatever color space you want.

I usually pre-comp the footage for denoise. Then place it two comps, one is the matte generation and the other the full comp where I apply that key matte and do color grading. For an ACES workflow the same principles would apply.

I highly recommend using a LUT for converting to rec.709 for your keying comp before Keylight because doing it with OCIO is very taxing and not necessary to create a good matte.