Layer Opacity based on Distance from camera

Moderators: Disciple, zlovatt

Post Reply
Anim8ir
Posts: 1
Joined: March 4th, 2005, 1:09 pm
Location: Kansas City
Contact:

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.
-----------------------------------------------------
s t e v e s t o n e

D X D ( P O S T / D E S I G N / F X )

http://www.d-x-d.com
-----------------------------------------------------
davestewart
Posts: 114
Joined: March 10th, 2005, 5:50 am
Location: London, UK
Contact:

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
Post Reply