Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions layer opacity = layers distance from camera

  • layer opacity = layers distance from camera

    Posted by Jonas Espinoza on January 15, 2007 at 7:05 pm

    have some 2.5d layers spaced out in z space, am moving the layers as a group with a null past a stationary camera. is it possible to like these layers opacity to their distance from the camera?

    thanks

    Mike Clasby replied 19 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Mike Clasby

    January 15, 2007 at 8:29 pm

    This eperession from Dan works, but not if the layers are the children of your null. Dan probably has a fix for that, but if you want to keyframe position of the layers (or move with an expression) this will work.

    startFade = 1000;
    endFade = 2000;

    d = position[2] – thisComp.layer(“Camera 1”).position[2];
    linear(d,startFade,endFade,100,0)

    Explaination here:

    https://forums.creativecow.net/cgi-bin/new_read_post.cgi?forumid=2&postid=881321

  • Mike Clasby

    January 15, 2007 at 8:59 pm

    Here’s another one from Dan, better I think as it avoids that seeing through one layer as it’s opacity changes. You’d need to add a light as it works off the layers Specular and Diffuse 3D properties and the distance from the light. Again, not for children of the parent Null.

    Name: Dan Ebberts
    Date: Aug 24, 2006 at 2:36:30 pm
    Subject: Re: Wow. That’s intense. Ok, Thanks! errr…I think I’ll go with Buena-Plugin.

    A little late to the party, but here’s a fun thing to try. Add this expression to the diffuse and specular material options of your 3D layer:

    decay = .001; // speed of falloff
    d100pct = 200; // distance from light where falloff begins

    L = thisComp.layer(“Light 1”);

    d = length(L.position,position);
    if (d < d100pct){ value; }else{ value/Math.exp((d-d100pct)*decay); } The first parameter has the most effect on how fast layers get dark as they move away from the light. The advantages of this approach are that the layers don't become transparent and the effect is independent for each layer since the intensity of the light itself is not affected. Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy