AE ENHANCERS

Expressions/Scripts/Presets
It is currently Mon May 20, 2013 1:30 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: expression connecting brightness/cont to camera position(z)
PostPosted: Wed Jan 09, 2008 4:07 pm 
Offline

Joined: Tue Jan 08, 2008 6:10 pm
Posts: 6
Hey everyone,
I need an expression that will allow a layer to be brighter or darker in relation to the distance it is away from the camera ie. it will darken the further from the camera it gets and vice versa. It only needs to relate to the z position, x and y aren't relevant.

If anyone can help it would be much appreciated.
Regards, Jase.........


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 10, 2008 4:28 am 
Offline

Joined: Wed Jul 20, 2005 12:07 am
Posts: 139
camSource=thisComp.layer("Camera").position;
footSource=thisComp.layer("Footage").position;
minDist=0;
maxDist=500;
minBright=0;
maxBright=100;

distance=length(footSource,CamSource);

darken=linear(distance,minDist,maxDist,maxBright,minBright);


Tie to whatever parameter you need (opacity, brightness effect etc.)

Mylenium

_________________
[Pour Mylène, ange sur terre]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 10, 2008 8:10 pm 
Offline

Joined: Tue Jan 08, 2008 6:10 pm
Posts: 6
Cheers buddy, that really did the trick...


Top
 Profile  
 
 Post subject: Re: expression connecting brightness/cont to camera position(z)
PostPosted: Tue Jul 29, 2008 5:12 am 
Offline

Joined: Tue Jul 15, 2008 5:25 am
Posts: 5
Location: Bergen, Norway
Hi!

Where and how to you apply this expression to get that effect?

-Cptzap


Top
 Profile  
 
 Post subject: Re: expression connecting brightness/cont to camera position(z)
PostPosted: Tue Jul 29, 2008 5:50 am 
Offline
User avatar

Joined: Mon Apr 30, 2007 5:55 am
Posts: 157
Location: United States, Ohio
I created a new comp and added a red solid and a camera.

I set the 3D checkbox on the red solid. (cube switch)

I selected the red solid and pressed the T-KEY to reveal the opacity value. for the red solid.

I ALT-Clicked on the stop watch.

I pasted this code into the expression box.
Code:
camSource=thisComp.layer("Camera 1").position;
footSource=thisComp.layer("Red Solid 2").position;
minDist=1000;
maxDist=2500;
minBright=0;
maxBright=100;

distance=length(footSource,camSource);
darken=linear(distance,minDist,maxDist,maxBright,minBright);


I pressed the numberpad enter key to lock the expression into place.

NOTE:If your red solid is named something other than "Red Solid 2" you will get an expression error message, simply correct the name of the solid and or camera as needed to match your comp.

Use the camera Track-Z tool to zoom the camera in and out. The red solid will fade in and out as the camera distance changes.

Because this expression returns a number between minBright and maxBright (in this case 0-100 i.e. a percentage) you can use this expression on any animatable parameter that requres a percentage range. Transition complete comes to mind, but I'm sure there are others as well.

Thanks for the code Mylenium!

_________________
"Up And Atom

No...No

Up And At Them!"


Top
 Profile  
 
 Post subject: Re: expression connecting brightness/cont to camera position(z)
PostPosted: Tue Jul 29, 2008 6:58 am 
Offline

Joined: Tue Jul 15, 2008 5:25 am
Posts: 5
Location: Bergen, Norway
Ah! Superb! This is really a handy expression..:)

Thanx!

- Cptzap


Top
 Profile  
 
 Post subject: Re: expression connecting brightness/cont to camera position(z)
PostPosted: Sun Aug 03, 2008 2:56 am 
Offline

Joined: Tue Dec 05, 2006 6:27 am
Posts: 2
Hi Atomic,

I tried to use this expression with filter, for example BLUR or any other filter, just for test, but i could not find the expression, because filter are not percentage , could you help me a bit for use a filter and connect with this expression :D

thanks


rolita


Top
 Profile  
 
 Post subject: Re: expression connecting brightness/cont to camera position(z)
PostPosted: Sun Aug 03, 2008 6:00 am 
Offline
User avatar

Joined: Mon Apr 30, 2007 5:55 am
Posts: 157
Location: United States, Ohio
rolita,

I applied the Lens Bur effect to a layer. I decided to control the parameter Blur Focal Distance. I scrubbed the parameter and discovered that is has a range of 0-255. I set minBright to 0 and maxBright to 255. I played around with different value for minDist and maxDist. You will have to do the same to tune the expression to your needs.

Code:
camSource=thisComp.layer("Camera 1").position;
footSource=thisComp.layer("Red Solid 2").position;
minDist=500;
maxDist=750;
minBright=0;
maxBright=255;

distance=length(footSource,camSource);
darken=linear(distance,minDist,maxDist,maxBright,minBright);


With the above expression applied, as I dolly my camera in z-space, my layer blurs and un-blurs as the camera approaches.

There are also other interpolation methods you can use instead of the linear function.

http://livedocs.adobe.com/en_US/AfterEf ... -7a06.html

_________________
"Up And Atom

No...No

Up And At Them!"


Top
 Profile  
 
 Post subject: Re: expression connecting brightness/cont to camera position(z)
PostPosted: Sun Aug 03, 2008 9:39 am 
Offline

Joined: Tue Dec 05, 2006 6:27 am
Posts: 2
UUAUU!! so fast answer, thanks a lot, i'm gonna try right now!!
thanks again :D

rolita


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group