Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sampling the pixel below, or same pixel

  • sampling the pixel below, or same pixel

    Posted by Jonas Espinoza on May 9, 2011 at 5:46 pm

    I have some AE 2D rose precomps over a 3D render of a bush – in moonlight, with varied lighting

    I have one master CC controller controlling Tritone on each rose to help sell them being part of the atmosphere

    im wondering if theres a way to sample the value of the pixel of the base render, or underlying layers to then have a value that varies from rose to rose… and then get a value of the luminance

    then i could add or multiply that to the black value of the Tritone?

    thanks – this forum is so great

    Dan Ebberts
    replied 15 years ago
    2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    May 9, 2011 at 8:05 pm

    Probably.

    You can have an expression that samples the background at the position of the rose. You’ll get RGBA values in the range of 0 to 1.0 which you can convert to HSLA if you need to. I think you need to define your algorithm a little better to take it much farther though. (Like what’s the relationship between one or more of the sampled channels and the Tritone parameters?)

    Dan

  • Jonas Espinoza

    May 10, 2011 at 4:28 pm

    psuedocode wise it would be something like

    im not fully up on array math – but would it be multiplying the luminance of the BG/source layer against the shadow value of the tint for the FG layer?

    with that be math.mul()?

    i guess it could be sampling R,G or B, and then evenly apply that [x,x,x] to the tint color

  • Dan Ebberts

    May 10, 2011 at 5:09 pm

    OK, if you have a background layer named “Background” and you want your Tritone colors to be affected by the background luminance level at that layer’s position, you could apply something like this to any of your Tritone colors that you want to be affected (not tested, but it should be close):

    L = thisComp.layer(“Background”);
    p = L.fromComp(toComp(anchorPoint));
    rgba = L.sampleImage(p,[0.5,0.5],true,time);
    hsla = rgbToHsl(rgba);
    value*hsla[2]

    Dan

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