Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects distance from camera?

  • distance from camera?

    Posted by Joe Mole on March 14, 2011 at 10:09 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…

    Roland R. kahlenberg replied 15 years, 2 months ago 5 Members · 4 Replies
  • 4 Replies
  • Tom Ma

    March 15, 2011 at 5:23 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)

  • Michael Szalapski

    March 15, 2011 at 1:14 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.

  • Darby Edelen

    March 15, 2011 at 8:28 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 🙂

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

    Darby Edelen

  • Roland R. kahlenberg

    March 16, 2011 at 4:16 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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy