Activity › Forums › Adobe After Effects › How to create: Light decay or drop-off according to distance.
-
How to create: Light decay or drop-off according to distance.
Posted by Frank Weber on August 23, 2006 at 3:17 pmHow do you create 3D-light intensity decay, like in 3D packages?
IE: the further an object gets from the camera the less light it recieves.
I can’t work out how to do it in AE-3D.
Thanks.Mike Clasby replied 19 years, 8 months ago 4 Members · 13 Replies -
13 Replies
-
Mylenium
August 23, 2006 at 6:09 pmYou don’t, well, with plain AE that is. Buena Software’s Depth Cue plugin has this functionality (for a price, of course).
Mylenium
[Pour Myl
-
Mike Clasby
August 23, 2006 at 6:29 pmOthers can calculate the vector for distance from light to object, and tie it to intensity of the light to the vector length, I think,(hey I need to learn that vector stuff), but this ties the light intensity to the position, and when you set it up you pick the upper and lower limits of movement and the upper and lower limits of light intensity. The vector way would be better as then you could move the object being illuminated and the light, this way is more for a stationary Floor and a moving light, as it works off the lights change of position.
Set up you light, move it max and min, Alt Click the light’s Intensity Stop Watch:
position
linear(position[1], 400, -200, 0, 100)OK, it doesn’t look right, these are the numbers that worked on my test, so we’ll customize it for you, easy.
Here’s the interpolation expression:
linear(t, tMin, tMax, value1, value2)
“t” is the property being interpolated, the y axis here
“tMin” is the closest position you want for you light (400 on my y axis)
“tMax” is the farthest position of you light (-200 on my y axis)
“value 1” is lowest light Intensity you want (0 above, light fades to 0)
“value 2” is the max light (100 for mine)
So as my light changes its y position from 400 to -200 (the -200 is farther away in my setup) it goes from 100% to 0%
Now plug in your numbers.You can do it with the pickwhip to change the axis, but need to plug in numbers for the limits.
Leave it at “position [1]” (line 2 above) if you want to use the y axis, (for x axis use “position [0], and z axis use “position [2]). Any axis will work unless there is zero movement along that axis.
Now plug in your numbers for the limits.
With the camera at it closest position, see that y number and plug it in (or your defend x or z number), my 400
With the camera at it farthest position, see that y number and plug it in(or your defend x or z number), my -200
Now the min (0) and max (100) for light intensity. (You can go brighter, like 200% for that blown out look if you like)I hope this makes sense and helps, maybe someone in the know will do the vector thing so you can move the object being illuminated also.
-
Mike Clasby
August 23, 2006 at 6:32 pmOpps, I answered the wrong question, light decay from a moving light, not object distance from camera, yikes!
-
Mike Clasby
August 23, 2006 at 6:40 pmThese posts from earlier might help, Dan sets up an expression for Opacity as the camera changes Z. You need to choose an axis that works for you.
Name: Ryan Carter
Date: Jun 22, 2006 at 10:10:15 am
Subject: An Expression for OpacityI know a little about expressions, but have forgot just about everything from my 1 semester of Java script. Here is my dilemma;
I have a series of text layed out along the z axis. My camera is pulling through them and picks up speed. I want the text to fall off or fade out at a certain point as they fall off into the distance. I tried just linking the opacity to the cameras z position but they fade out too fast. Is there a way to control when to fall off and how slow this happens? Any tips would be appreciated. Thanks
Name: Dan Ebberts
Date: Jun 22, 2006 at 12:26:11 pm
Subject: Re: An Expression for OpacitySure. For reference, here’s the expression again
startFade = 1000;
endFade = 2000;d = position[2] – thisComp.layer(“Camera 1”).position[2];
linear(d,startFade,endFade,100,0)The first two lines just set the z distance from the camera for the fade to start and end. The third line calculates the z distance from the camera.
In English, the forth line just says “as d varies from 1000 to 2000, ramp opacity from 100 to 0”. At distances less than 1000 the opacity will be 100 at distances greater than 2000 the opacity will be 0.
Instead of linear() you could try easeIn() and easeOut()Hope that helps.
Dan
-
Frank Weber
August 23, 2006 at 6:47 pmThanks guys!
I did mean; Light decay, not camera – The further an boject is from the light source, the darker it gets. Sorry. It was a bit unclear.
I still however want to find a resonably simple solution(simpler than going into Maya.) -
Mylenium
August 23, 2006 at 7:00 pm[Frank Weber] “Thanks guys!
I did mean; Light decay, not camera – The further an boject is from the light source, the darker it gets. Sorry. It was a bit unclear.
I still however want to find a resonably simple solution(simpler than going into Maya.)”Depth Cue from Buena – just as I said.
Mylenium
[Pour Myl
-
Mike Clasby
August 23, 2006 at 7:16 pmOk, same principal as the first expression, only tying object distance from light to Light Intensity. This works if the lights don’t move. The first one worked if the object didn’t move.
This expression on Light Intensity:
thisComp.layer(“object”).position
linear(thisComp.layer(“object”).position[2], 0, 1000, 100, 0)With the layer being illuminated named “object”
Using the Z position (any axis will work unless change is 0)
The light fades fron 100% to 0% as it’s Z changes from 0 to 1000 (near to far, use numbers for Z that cover the range you want).Does this work that way you want?
-
Mike Clasby
August 23, 2006 at 7:21 pmMy next to last line should be:
The light fades fron 100% to 0% as the “object”‘s Z changes from 0 to 1000
My light was at the default position.
-
Mike Clasby
August 23, 2006 at 8:23 pmHey, my thing only works for one object and one light in the comp, so see Buena vista above…
-
Mike Clasby
August 23, 2006 at 10:31 pmOK, I promise I’ll stop after this.
Ok, one last shot at being a complete nuisance by trying to get AE to do what I can’t get it to do.
This controls the Opacity of the layer depending on the distance between the layer and the light (Vectors! yes).
Here’s the expression:// Pick 2 layers
point1=this_layer.position;
point2=thisComp.layer(“Light 1”).position;
delta=sub(point1, point2);// Find the vector between them
distance=length(delta);// Now find the length
linear(distance, 0,1000, 100, 0);//Use linear() to remap distance to range of 100 to 0, for OpacityI added a Null and a Slider Control to control the 1000 (via Pickwhip), then it easier to conrol the Distance spread (length of the vector between layers) where the linear Interpolation kicks in, so I could change the 1000 (to 500 or 1000 or whatever I want).
So the expression becomes this:
point1=this_layer.position;
point2=thisComp.layer(“Light 1”).position;
delta=sub(point1, point2);
distance=length(delta);
linear(distance, 0, thisComp.layer(“Null 1”).effect(“Slider Control”)(“Slider”), 100, 0);Put this on as many objects as you want, only one light though (the biggest drawback).
This works, giving the illusion of fading layers as they get distant from the light. Like i mentioned before you can move either the light or the layer(s).
BUT: The illusion breaks down when the layers overlap, you start to see through the layer infront, because of it’s reduced opacity.
SOLUTION: Back it up with a dup black layer. Dup the layer with the opacity expression, make it black (Fill), put it .5 pixel away from the light, and parent it to the orignal layer, turn off or delete it’s opacity expression, and now you can’t see through the original layer when it’s in front of another layer.
I locked and made shy the backup layer.This seems to work on as many objects as you want, the drawback being only one light, but use at our own risk, warranty void where prohibited by State Law.
This is a modification (stolen, really) from here:
https://jjgifford.com/expressions/geometry/length.html
Example: Interactive Blur
Reply to this Discussion! Login or Sign Up