ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

FAQ   •   VIEW ALL
 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!

 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

 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?

 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]);