Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Keying with math expressions?

  • Keying with math expressions?

    Posted by Mike Watts on May 21, 2014 at 8:05 am

    I just learned a bunch of great keying techniques in nuke, and one of them involved using expressions to create an alpha channel. Example would be having the alpha= r*1.5/g*.8 I can’t seem to find a way to input an expression like that in AE though. Nothing will allow me to use math on individual color channels or alpha that I know of. Is it even possible to do a heavy handed expression like that in AE?

    Darby Edelen replied 12 years, 3 months ago 2 Members · 1 Reply
  • 1 Reply
  • Darby Edelen

    May 22, 2014 at 3:31 am

    I’m assuming you’re using the Expression node in Nuke to do that. That’s an entirely different beast than AE expressions and is used for a different purpose.

    However, the example you posted can be done by clever use of effects, blend modes and pre-composing.

    In the specific case you mentioned you could use Shift Channels to bring the Red into each of the RGB channels, use Levels to multiply the values by 1.5 (set the output white to 1.5), use Shift Channels on a duplicate to bring the Green into the RGB channels, put that duplicate above the Red and set it’s blend mode to Divide, create a new solid at the top of the timeline with RGB values of [0.8,0.8,0.8] and set it to the Multiply blend mode. You now have your alpha value, you just need to pre-compose it and use it as a matte.

    Some of the details in the above method can be altered but the basic idea is the same as the expression node in Nuke. As far as computers are concerned the colors are just numbers. You can modify them with effects and blend modes the same way you would with mathematical operators. Several of the blend modes are named after mathematical operators (Add, Subtract, Multiply, Divide) for a reason!

    Of course this should all be done in 32bpc (as Nuke does) to preserve values. It’s not as easy and certainly not as flexible as the Expression node (good luck finding “Square Root” or trigonometric blend modes) but the basics are definitely achievable.

    Darby Edelen

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy