Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Making a object fade as it gets farther away from 3d camera

  • Making a object fade as it gets farther away from 3d camera

    Posted by Walkinginspace on May 12, 2005 at 4:53 am

    Is there a way for a object to fade as it gets farther away from a 3d camera, in effect causing it to look like it’s passing into fog. I know this can be done the z-depth, but I want to do it with non 3d imported object, like a solid or piece of text. I’m sure it’ll probaly easy with an expression, but i’m not expert at those yet:) Thanks!


    Mike Clasby replied 18 years, 4 months ago 3 Members · 2 Replies
  • 2 Replies
  • Barend Onneweer

    May 12, 2005 at 5:56 am
  • Mike Clasby

    May 12, 2005 at 6:44 am

    This for an old post might help. I couldn’t get search to give me the link, so here’s all of it:

    Name: dina saleem
    Date: Sep 21, 2004 at 1:37 am
    Subject: z-depth matte

    Hey there,

    is there a possibility of applying a z-depth matte to a layer or a group of layers?
    or is there a way of writing an expression, so that layers that respond to a null object loose transparency the further ‘z’ they move?

    Reply To This Post
    Post 2 of 3

    Name: Filip Vandueren
    Date: Sep 21, 2004 at 2:53 am
    Subject: Re: z-depth matte

    min_distance=100; // closer than this, opacity will be 100%
    max_distance=10000; // from this distance, opacity will be 0%

    n=this_comp.layer(“Null”); // name of your reference null (or the camera)
    d=length(to_world(anchor_point), n.to_world(anchor_point));

    ease(d, min_distance, max_distance, 100, 0)

    Warning: this works in all dimensions, not just Z, so if your Null is quite far away from the camera, layers will also fade if they’re moving forward in Z, but away from the null. I would suggest putting the null close to the camera and increasing the min_distance

    You could also apply a “Tint”-filter with both colors set to black, and copy this expression to “Amount”.
    Change the last line to ease(d, min_distance, max_distance, 0, 100) This way, the layer will become black instead of transparant.

    Reply To This Post View Parent Post

    Post 3 of 3

    Name: dina saleem
    Date: Sep 21, 2004 at 6:20 am
    Subject: Re: z-depth matte


    that worked well…

    I also tried out this expression:

    ( (thisComp.layer(“nullobject”).position.key(2)[2]-thisComp.layer(“nullobject”).position[2]) /
    ) * 100

    applied to the transparency of my layer, so it will fade between the two position keyframes I set on my null object….
    in that way I could still edit my keyframes and the null could be positioned wherever I want it to…
    (a friend of mine figured that out) 😉

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