Hey there, I'm very new to expressions in After Effects CC and am struggling with this.
I have a feeling it's really simple.
I am using an ambient light in a 3D room to simulate a TV's glow on the room walls.
I have already created a target comp, "TvContent," that represents the video playing on the tv. To do this, I used the mosaic effect on a .mov file at 1x1. So, each frame of "TvContent" is a different solid color created from that frame of the .mov file. I have successfully paired the COLOR of the ambient light with the color of the "TvContent" comp, but need an expression that targets the BRIGHTNESS value of "TvContent" to determine the Intensity of the ambient light.
Moreover, I would like the intensity value to be HALF that of the brightness value. That is..... when the Brightness of "TvContent" is 40%, I would like the ambient light's intensity to be 20%
Hopefully I explained that alright.
Any help would be much much appreciated.
Thanks in advance!
Answering my own question here, but in case anyone else needed a hand this is what I was able to find/adapt (...five hours later):
target = thisComp.layer("TvContent"); //TvContent is the footage layer
samplepoint= [20,20]; //an arbitrary point since my entire target comp is the same color
samplesize= [1,1]; //all pixels are the same color so I only needed a one pixel sample
lum = rgbToHsl(.5*target.sampleImage(samplepoint,samplesize));
linear(lum, 0, 1, 20, 80)
Special thanks to Kevin and this 8-year-old forum on CreativeCOW
Thank you for sharing your solution. Who knows, it might help someone else eight years from now!