ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Grab average color of layer to determine the color for another effect?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nils HooverGrab average color of layer to determine the color for another effect?
by on May 22, 2012 at 4:08:21 am

Basically I want to create some false lighting for a keyed layer I am working on. I have a window in a house keyed and have multiple clips playing behind the window, but I want the highlights on the edge of the window to change color with the footage outside of the window.

I guess I am imagining I would somehow average the colors from the footage on the bottom layer, then add an effect (For example using something as simple as "photo filter" or "tint") which is grabbing that color information and using it to color the top layer.

If there is no easy way of averaging the colors through expressions, I know I could always just blur it on a hidden layer or something.

I am a beginner with expressions, but I am sure you could do this with one right?

What might be the best way to do something like this?


Return to posts index

Roland R. KahlenbergRe: Grab average color of layer to determine the color for another effect?
by on May 22, 2012 at 4:47:44 am

The sampleImage Expression method should do the trick for you. More info here in the doc here->
http://help.adobe.com/en_US/AfterEffects/9.0/WS3878526689cb91655866c1103906....

There are links to examples which will guide you further.

Instead of using Fill or Tint, see if Tritone will get you a more believable look. Let us know if you have specific Qs.

Good Luck
RoRK

Intensive AE & Mocha Training in Singapore and Malaysia
Adobe ACE/ACI (version 7) & Imagineer Systems Inc Approved Mocha Trainer


Return to posts index

Kevin CampRe: Grab average color of layer to determine the color for another effect?
by on May 22, 2012 at 2:33:05 pm

a really easy way is to just use the mosaic effect with the blocks set to 1. that should give you a pretty good 'average' color for a frame.

then you could try using that layer with blending modes to blend it with the layers below.

but a fairly simple sampleImage() expression to drive any color chip setting in an effect would be something like this:

target = thisComp.layer("MyLayer"); // this would be the layer that you want to sample the color from
h = target.height / 2;
w = target.width / 2;
target.sampleImage(anchorPoint, radius = [w, h], postEffect = true, t = time);


Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index


Kevin CampRe: Grab average color of layer to determine the color for another effect?
by on May 22, 2012 at 2:36:47 pm

actually, i'll make one slight change to the expression.

target = thisComp.layer("Royal Blue Solid 2"); // this would be the layer that you want to sample the color from
h = target.height / 2;
w = target.width / 2;
target.sampleImage(target.anchorPoint, radius = [w, h], postEffect = true, t = time);


the change was to the last line, rather than using the anchorPoint of the layer with the effect for the 'sample point', it's probably better to use the target layer's anchor point.

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index

Nils HooverRe: Grab average color of layer to determine the color for another effect?
by on May 22, 2012 at 3:02:26 pm

Thank you! that has really gotten me on the right track, and does exactly what I needed.


Return to posts index

Nils HooverRe: Grab average color of layer to determine the color for another effect?
by on May 22, 2012 at 3:07:03 pm

Thank you, tricolor definitely is a better option, and works quite nicely with out any hassle.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]