distance from camera expression issues...
Posted: July 25th, 2007, 12:17 pm
i posted this originaly on creative cow.
i'm trying to measure z space distance between the camera and an object layer, converting that distance into a percentage, then applying that percentage to an effect.
first method i used was toWorld and linear;
C = thisComp.activeCamera.toWorld([0,0,0]); // Cam position
x = thisComp.activeCamera.position[0]; // Cam x position
y = thisComp.activeCamera.position[1]; // Cam y position
z = position[2]; // Object z position
P = toWorld([x,y,z]); // Object relative position on the z-axis from Cam
d = length(C,P); // Distance Calculation
linear(d,startFade,endFade,1,Q.effect("Levels (Individual Controls)")("Input White"))
problem is that for some reason scale effects this inversely, i.e. scaling down increases the effect, scaling up the effect decreases. i'm assuming that it's toWorld that's taking scale into effect.
so next i tried using position.value;
c = thisComp.activeCamera.position.value[2];
P = position.value[2];
d = length(c,P);
easeOut(d,startFade,endFade,Q.effect("Levels (Individual Controls)")("Output Black"),0)
great it works,
except for parented layers.
parented layers take on the position relative to the parent layer. the postition.value[2] is not absolute to the world.
no good, can't animate without parenting.
so is there some other position interpolation method or some way to stabilize scale to not effect toWorld?
driving me crazy,
hope you can help,
chris d-_-b
i'm trying to measure z space distance between the camera and an object layer, converting that distance into a percentage, then applying that percentage to an effect.
first method i used was toWorld and linear;
C = thisComp.activeCamera.toWorld([0,0,0]); // Cam position
x = thisComp.activeCamera.position[0]; // Cam x position
y = thisComp.activeCamera.position[1]; // Cam y position
z = position[2]; // Object z position
P = toWorld([x,y,z]); // Object relative position on the z-axis from Cam
d = length(C,P); // Distance Calculation
linear(d,startFade,endFade,1,Q.effect("Levels (Individual Controls)")("Input White"))
problem is that for some reason scale effects this inversely, i.e. scaling down increases the effect, scaling up the effect decreases. i'm assuming that it's toWorld that's taking scale into effect.
so next i tried using position.value;
c = thisComp.activeCamera.position.value[2];
P = position.value[2];
d = length(c,P);
easeOut(d,startFade,endFade,Q.effect("Levels (Individual Controls)")("Output Black"),0)
great it works,
except for parented layers.
parented layers take on the position relative to the parent layer. the postition.value[2] is not absolute to the world.
no good, can't animate without parenting.
so is there some other position interpolation method or some way to stabilize scale to not effect toWorld?
driving me crazy,
hope you can help,
chris d-_-b