ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression linking camera position to object opacity

COW Forums : Video Copilot

VIEW ALL   •   PRINT
Patrick Brazier
Expression linking camera position to object opacity
on Jan 14, 2009 at 5:37:16 pm

Hi

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


Return to posts index

Kevin Camp
Re: Expression linking camera position to object opacity
on Jan 14, 2009 at 5:58:10 pm

here'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


Return to posts index

Patrick Brazier
Re: Expression linking camera position to object opacity
on Jan 14, 2009 at 6:16:56 pm

I'll give it a go and will let you know how I get on.

Many thanks

P



Return to posts index


Roland R. Kahlenberg
Re: Expression linking camera position to object opacity
on Jan 14, 2009 at 6:40:51 pm

The 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
RoRK

broadcastGEMs - AEPro Volume 02 (Professional Adobe After Effects Project Files - Now Available)


Return to posts index

Jeremy Allen
Re: Expression linking camera position to object opacity
on Jan 14, 2009 at 6:50:32 pm

Video Copilot recently came out with a preset that will do exactly what you are after...

http://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.11

AE CS3


Return to posts index

Patrick Brazier
Re: Expression linking camera position to object opacity
on Jan 16, 2009 at 4:37:04 pm

Hi,

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



Return to posts index


bino nicolas
Re: Expression linking camera position to object opacity
on Aug 26, 2014 at 11:04:58 am

5 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 Script

You have to put it on the "opacity" of the object


Return to posts index

Nelson Rayner
Re: Expression linking camera position to object opacity
on Jan 27, 2016 at 1:11:44 pm

Hi 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 :)


Return to posts index

VIEW ALL   •   PRINT
© 2020 CreativeCOW.net All Rights Reserved
[TOP]