Page 1 of 1

Layer Opacity based on Distance from camera

Posted: January 12th, 2006, 10:52 am
by Anim8ir
I have a comp with 100's a 3d layers staggered about through 3d space. The camera trucks backwards through them. I am trying to mimic a LOD methodology, and have the layers opacity drive of it's distance from the camera.

I am able to drive the opacity off the position of the camera, (thisComp.layer("Camera 1").position[0]/10) but I can't figure out how to access the measurement of distance from each layer to the camera.
Any thoughts? Thanks in advance for your help.

Posted: January 12th, 2006, 12:32 pm
by davestewart
This will get you started

var maxDist=1000
var p1=thisComp.layer("Camera 1").position;
var p2=position;
var d=(length(p1,p2)/maxDist)

100-(100*d)

Cheers,
Dave