Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using footage luma value to drive opacity of effect

  • Using footage luma value to drive opacity of effect

    Posted by Katya Austin on May 16, 2012 at 2:59 pm

    I’m not really sure if i’m using right terminology here, but this is what i’m trying to achieve:

    i have a shot of a flickering candle which i’m adding lens bokeh to on a separate level. It would make sense that effect’s opacity/intensity changes with amount of light candle is giving off.
    Right now i have effect’s opacity animated manually, i keyframed opacity value for each frame, but there has to be a smarter approach to that…i’m just not sure how to get an overall luminosity value of the whole frame.

    thank you,
    -Katya

    Robert Paynter replied 13 years, 11 months ago 4 Members · 4 Replies
  • 4 Replies
  • Kevin Camp

    May 16, 2012 at 3:40 pm

    try something like this:

    target = thisComp.layer("Candle"); // this would be your footage layer
    maxO = 100; // set the max opacity value
    minO = 0; // set the min opacity value
    lum = rgbToHsl(target.sampleImage(anchorPoint, radius = [target.width/2, target.height/2], postEffect = true, t = time))[2];
    linear(lum, minO, maxO)

    you’ll need to change the first line so that your candle footage layer name is in the quotes and then use the maxO and minO values to adjust the range of opacity that you want per luminance of the frame.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Robert Paynter

    June 21, 2012 at 12:20 am

    This expression is crashing my CS6. Everytime I apply it.
    Is anyone else having this problem? Is there a difference in language for CS6? or alternative expression I could use?


    target = thisComp.layer("Candle"); // this would be your footage layer
    maxO = 100; // set the max opacity value
    minO = 0; // set the min opacity value
    lum = rgbToHsl(target.sampleImage(anchorPoint, radius = [target.width/2, target.height/2], postEffect = true, t = time))[2];
    linear(lum, minO, maxO)

  • Dan Ebberts

    June 21, 2012 at 2:16 am

    I can’t get it to crash with that expression. Are you running Version 11.0.1.12?

    Dan

  • Robert Paynter

    June 21, 2012 at 4:06 am

    I am running 11.1.. I’m getting a few errors at the moment perhaps these are symptoms of a larger issue.

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