FORUMS: list search recent posts

Convert corner pin to 3D rotation of a 3D layer?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Simon Björk
Convert corner pin to 3D rotation of a 3D layer?
on Aug 26, 2011 at 2:09:05 pm

Hi all,

I'm no master with expressions, but do you think it would be possible to convert the corner pin data of a 2d layer to be used as 3d rotation data on another layer? Would be pretty cool!


Return to posts index

Dan Ebberts
Re: Convert corner pin to 3D rotation of a 3D layer?
on Aug 26, 2011 at 4:39:08 pm

I don't know the math to go from points projected onto the comp view to the rotation of a 3D layer whose corners would generate those points. I suspect the math is out there, but I doubt that it's easy. For one thing, it would be easy for your 4 corner pin points to not represent a 3D rectangle. I would think you'd only need three corners to define the rotation of the equivalent 3D rectangle. So I don't know what you'd do with the other corner if it turned out not to be where it should be if the shape were rectangular. It might be too much to ask of an expression.

It would be cool though.

Dan



Return to posts index

Simon Björk
Re: Convert corner pin to 3D rotation of a 3D layer?
on Aug 29, 2011 at 8:10:20 am

Hi Dan, thanks for your reply. After thinking about it a bit more I understand that it might not even be possible (the corner pin not being a rectangle for example).

However, there might be other ways to get to the effect I'm looking for. I'm having a shot with a ballon wobbling in the air and I need to attach graphics to it. I can just track the tracking marks on the ballon and attach the graphics, but that doesn't rotate correctly as the ballon rotates. A corner pin is close, but not perfect.

Take a look at the "Comparing Transform to Rotation and starting our track" (free video) at http://www.digitaltutors.com/11/training.php?cid=203&vid=15417.

It shows the difference between having a simple 2d transform track to having 3d rotation. Note that no 3d tracking is used.

I'm pretty sure you can create the same setup in AE (no spheres, but with a couple of layers rotated you would have pretty much the same thing). I guess it works by converting the 2d position data to camera rotation and then using that somehow.

A script that converts 2d tracking data to a rotating camera can be found at: http://www.3dmation.com.

Do you think this could be done? Hard, but possible?


Return to posts index


Alberto Brancolini
Re: Convert corner pin to 3D rotation of a 3D layer?
on Aug 2, 2017 at 12:18:28 pm

I stumbled into a situation that forced me to convert corner pin data to a 3D layer rotation, so I update this old thread.
Nobody is gonna get even a Razzie Award for this, but it helped me drawing a little more blood from stones (as usual).

UpLeft = thisComp.layer("Corner Pin Data Bank").effect("Corner Pin")("Upper Left");
UpRight = thisComp.layer("Corner Pin Data Bank").effect("Corner Pin")("Upper Right");
DnLeft = thisComp.layer("Corner Pin Data Bank").effect("Corner Pin")("Lower Left");
DnRight = thisComp.layer("Corner Pin Data Bank").effect("Corner Pin")("Lower Right");
deltaA = sub(UpLeft,UpRight);
a = Math.atan(deltaA[1],deltaA[0]);
aDeg = radiansToDegrees(a);
deltaB = sub(DnLeft,DnRight);
b = Math.atan(deltaB[1],deltaB[0]);
bDeg = radiansToDegrees(b);
90+(aDeg+bDeg)/2

I applied this bunch to the Z rotation (after orienting the layer). I did the same with the X rotation (but with accordingly shifted corner). By averaging the angles from the two lines, I tried to achieve a more consistent result.
I hope it may help. Should it not, take your boss by the horns and get him (or her) learning to place markers as they ought to. 😇


Return to posts index

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