ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

distance from camera?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Joe Moledistance from camera?
by on Mar 14, 2011 at 10:09:37 pm

How do you figure out the distance of a 3d layer from the camera? I'm using the depth of field so I'd like to know what to set my focus to to focus on things as the camera moves...


Return to posts index

Tom MastersRe: distance from camera?
by on Mar 15, 2011 at 5:23:33 am

Turn ON depth of field for your camera to enable.
View your comp in the TOP view.
select the camera and you should see a plane for the focal point.
(scrub "Focal Distance" value and you can see which plane this is)


Return to posts index

Michael SzalapskiRe: distance from camera?
by on Mar 15, 2011 at 1:14:08 pm

You could also use the length expression to find the distance, but Tom's answer is less complicated.

- The Great Szalam
(The 'Great' stands for 'Not So Great, in fact, Extremely Humble')

No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced.


Return to posts index


Darby EdelenRe: distance from camera?
by on Mar 15, 2011 at 8:28:04 pm

[Michael Szalapski] "You could also use the length expression to find the distance, but Tom's answer is less complicated."

Also, while this gives you an accurate distance to the camera, it doesn't work well for setting the focus distance.

I was going to try and explain why here, but it's been done before so I'll just link to Dan's site :)

http://motionscript.com/design-guide/auto-focus.html

Darby Edelen


Return to posts index

Roland R. KahlenbergRe: distance from camera?
by on Mar 16, 2011 at 4:16:06 am

A layer is in perfect focus if its position minus the camera's position is equal to the Focus Distance value.

The formula reads as such -
LayerPos-CameraPos=FocusDistance

You can take advantage of this formula to ensure that a layer is in focus by linking the camera's Focus Distance to a layer's position regardless of where the layer is positioned (static or animating).

For example, say you have a layer, let's call it HeroLayer, that you always want to be in focus. You would apply the following Expression to the Focus Distance property.

//Start Script
LayerPosZ = thisComp.layer("heroLayer").transform.position[2];
CameraPosZ = transform.position[2];
LayerPosZ-CameraPosZ
//End Script

Now if you move either the camera or the heroLayer, the layer will always be in focus. You can also create a Null Layer that will allow you to easily change the 'perfect focus' from one layer onto another.

HTH
RoRK

AE Training in South East Asia. AE templates for sale and rental. Click here for more


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]