Activity › Forums › Adobe After Effects › 2D position coordinates of a 3D layer
-
2D position coordinates of a 3D layer
Posted by Christian Tanner on January 29, 2009 at 8:50 pmhey guys!
this one is too tricky for me – so i need your help:
i created a 3D layer and animated it in 3D space turning, moving up and down, away from and towards the camera. now…
i’d like to somehow link a 2D layer to that 3D layer so it follows the 3D layer around on screen. i could motion track the 3D layer of course – but there should be a more elegant way to approach that shouldn’t it?
many thanx in advance!
tannerTommy Dimmel replied 11 years, 2 months ago 9 Members · 14 Replies -
14 Replies
-
Steve Roberts
January 29, 2009 at 9:37 pmI think it’s like this: it’s like tying a lens flare’s position to an object’s 3D position. The lens flare has to be in 2D, but its X and Y values wouldn’t numerically match those of the 3D object.
Maybe this would help. It allows you to make a lens flare follow a 3D light, but hey, position is position.
-
Mike Park
January 29, 2009 at 9:37 pmIf I understand you correctly, you want a 2d layer to appear to be either on top or below the 3d layer, but not have it in 3d space. Basically, mirror the x,y movement of the 3d layer with no z translation. It is really not that easy. The problem is perspective. You cannot simply take the x,y position of the 3d layer as the change in z value will change the perception of x,y position of the center of the 3d layer on a flat plane. You could do some unit vector calculations, but that would only move the 2d layer on the same vector from the viewing point to the 3d layer, not match the screen coordinates of the 3d layer. To do what you want will require a calculation of the change in xyz space of the 3d layer and build in an offset in 2d space of the 2d layer for the change in z space of the 3d layer. Basically, you must compensate for the change in perspective of the 3d layer.
Somewhat easy to conceptualize, a little more difficult to pull off. However, if anyone can, it will be the prior poster, the expression master, Mr. LaRonde.
Wish I could be more help. Sorry if I made your head hurt. Actually, I am sorry I made my head hurt.
Best of luck
PS, you may be better off precomposing the 3d layer and motion tracking to a null, then parenting your 2d layer.
-
Jan Sherlink
January 29, 2009 at 11:56 pmpaste this in you 2D layers position:
this_comp.layer(“your3Dlayername”).to_comp([0,0])
cya,
Jan
-
Darby Edelen
January 30, 2009 at 6:29 am[mike park] “Basically, you must compensate for the change in perspective of the 3d layer.”
There are Layer Space Transform methods in AE that allow you to do this very easily using expressions:
l = thisComp.layer("My3DLayer");
l.toComp(l.anchorPoint);
If you apply the above to the 2D layer’s position property then its anchor point will follow the 3D layer’s anchor point exactly in 2D.
Darby Edelen
-
Christian Tanner
January 30, 2009 at 12:39 pmhope this is compliant with the forums curse policy – but HOLY CRAP – thanx for all the help guys. i’m overwhelmed.
the expression was exactly what i was looking for. that piece of code was simply too sophisticated for my level of education on expressions…
i wasn’t kidding – i’m seriously overwhelmed…
tanner
-
Jan Sherlink
January 30, 2009 at 2:07 pmGlad to help,
if you’re interested in learning expressions;
jjgifford.com is a good place to start.have fun !
cya,
Jan
-
Tim Parsons
January 30, 2013 at 6:43 pmZombie thread! What if the object isn’t what’s moving, but the camera is?what if I have a 3D object just sitting there, and the camera is the thing moving around, and I want a 2D position (like a lens flare or something) to follow it??
-
Jan Sherlink
January 31, 2013 at 10:06 amThat would result in the same,
paste this_comp.layer(“your3Dlayername”).to_comp([0,0]) in the 2D position of your lens-flare.cya,
Jan
Reply to this Discussion! Login or Sign Up