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
allright…
that worked well…
I also tried out this expression:
( (thisComp.layer(“nullobject”).position.key(2)[2]-thisComp.layer(“nullobject”).position[2]) /
(thisComp.layer(“nullobject”).position.key(2)[2]-thisComp.layer(“nullobject”).position.key(1)[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) 😉