Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Move 3D layer to match 2D point position

  • Move 3D layer to match 2D point position

    Posted by Jason Reinhardt on December 10, 2013 at 12:04 am

    Long time lurker, first time poster… if I get Dan or another one of the big names in a reply to this thread it’ll be a checkmark off my bucket list 😉

    So I have a scene 3D tracked using After Effects’ built-in camera tracker. The scene is a 180 degree rotation around a fidgeting actor holding a tablet with tracking markers.

    I’m creating a simulated UI that exists in 3D space around the tablet, and I want it to react to the subtle movements of the tablet in the actor’s hand, as though it was tethered to the tablet. I’m not worried about this being a true 1:1 3D match, just as long as it’s sufficiently faked without having to hand key it (50sec shot).

    Now, I’m all ears if you have a better suggestion about how to approach this, but here’s my current method:

    I performed a 2D track on a tracking marker on the tablet. I additionally placed a 3D reference null in 3D space that lines up fairly closely with that tracking marker across the comp duration – this represents where the tablet would theoretically stay if the actor was holding it completely still.

    I am then using the following code to get the 2D screen space offset between the 2D track point and the 3D reference null:

    delta = thisComp.layer("3D_ReferencePoint").toComp([0,0,0]) - thisComp.layer("Trackpoint").transform.position;

    I am looking for the correct syntax to move my 3D layer in 3D space, perpendicular to the View Axis, to match the 2D offset I’ve calculated above. I understand that a single 2D point could overlap an infinite number of 3D points in depth; I imagine that by confining movement to the View Axis I can achieve the most realistic faked result.

    I’ve attached some photos to help explain. In the images below, the magenta star is my stationary 3D reference point, and the cyan pixel is my track point that follows the white tracking marker. The line between them is a separate layer with the Beam effect that I am using to debug my layer space transform code (above).

    I am looking for code to move that magenta star, perpendicular to the View Axis, to overlap the cyan pixel.

    Please let me know if I can further clarify anything I’ve written above! I would link to the project but it’s NDA, I can certainly try to reduce it down to relevant parts if necessary.

    Thank you!

    Jason Reinhardt replied 12 years, 8 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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