Activity › Forums › Adobe After Effects › Expression linking camera position to object opacity
-
Expression linking camera position to object opacity
Posted by Pat Bray on January 14, 2009 at 5:37 pmHi
I was wondering if there was some way linking a layers opacity to the cameras distance from it, so basically the layer fades into the background the further the camera is to it? Any suggestions would be great!
Pat
Nelson Rayner replied 10 years, 3 months ago 6 Members · 7 Replies -
7 Replies
-
Kevin Camp
January 14, 2009 at 5:58 pmhere’s a link to an expression on motionscript.com that may help you out. it is for light fall off, but i think you could use it in the opacity property.
i’m in the middle of many renders that need to get done, so i can’t fiddle with this one right now… if it doesn’t work as expected, try posting questions in the ae expressions forum.
Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW -
Pat Bray
January 14, 2009 at 6:16 pmI’ll give it a go and will let you know how I get on.
Many thanks
P
-
Roland R. kahlenberg
January 14, 2009 at 6:40 pmThe following script is from Dan Ebberts. This works straight off the bat.
// Start of Script
minDist = 600;
maxDist = 800;
minOpacity = 30;
maxOpacity = 100;d = length(toWorld(anchorPoint),thisComp.activeCamera.position);
linear(d,minDist,maxDist,maxOpacity,minOpacity)// End of Script
Cheers
RoRKbroadcastGEMs – AEPro Volume 02 (Professional Adobe After Effects Project Files – Now Available)
-
Jeremy Allen
January 14, 2009 at 6:50 pmVideo Copilot recently came out with a preset that will do exactly what you are after…
https://www.videocopilot.net/tutorials/3d_falloff/
———————————————
8core MacPro, 3.0 GHZ, 10GB RAM, OSX 10.5.2
DualCore G5 2.0 GHZ, 2GB RAM, OSX 10.4.11AE CS3
-
Pat Bray
January 16, 2009 at 4:37 pmHi,
Thanks for your responses, I’ve tried the video co-pilot route, which works apart from the fact that the layer fades out as it gets too close to the camera, as I don’t want this how do I fix it?
I don’t know how to use the other code from Roland, any advice would be great.
Best
Pat
-
Bino Nicolas
August 26, 2014 at 11:04 am5 years later, but could be appreciate by other people :
// Start of Script
d = length(toWorld(anchorPoint),thisComp.activeCamera.position);
if (d>1400){
minDist = 2000;
maxDist = 1400;
maxOpacity = 100;
minOpacity = 0;
linear(d,minDist,maxDist,maxOpacity,minOpacity)
}else{
minDist = 600;
maxDist = 1400;
maxOpacity = 0;
minOpacity = 100;
linear(d,minDist,maxDist,maxOpacity,minOpacity)
};
// End of ScriptYou have to put it on the “opacity” of the object
-
Nelson Rayner
January 27, 2016 at 1:11 pmHi there!
Any idea how you’d do this with only the camera Z position relative to a layers anchor position?
I’m trying to create a zoom in through multiple grids of pre-composed images where the grids in the distance are more transparent.
Unfortunately the distance from anchor points to camera changes as i’m also panning in X & Y and presents me with a transparent image when moving from the centre of the layers.
Any idea how to modify the script so it works only on the z position?
Thanks 🙂
Reply to this Discussion! Login or Sign Up