ADOBE AFTER EFFECTS: Forum Expressions Tutorials Podcasts Creative Cloud

Turning Corner Pin into 3d coordinates

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nicolas PlaireTurning Corner Pin into 3d coordinates
by on Feb 26, 2012 at 5:32:03 am

Hi!

Probably a long shot, but I was wondering if there would be a way to turn the corner pin effect into 3d coordinates to have a solid moving in z space exactly the same way a solid is moving in the fake 3d space of corner pin?

Thanks



Return to posts index

Dan EbbertsRe: Turning Corner Pin into 3d coordinates
by on Feb 26, 2012 at 4:43:58 pm

Theoretically, you should be able to do it with just three corners. You know that one side is the solid's width and the other is the height and that the actual angle between the sides is 90 degrees. Given that, and the coordinates of the three corners projected onto the comp view should be enough (I think) to calculate the position and orientation of the solid. I don't have the 3D transform chops to do it though.

Dan



Return to posts index

Nicolas PlaireRe: Turning Corner Pin into 3d coordinates
by on Feb 26, 2012 at 7:58:07 pm

Thanks!

I'll look into it, but I don't think it's worth the pain of having to find out the trigonometry for an idea that could have been cool, but next time...



Return to posts index


Chris WrightRe: Turning Corner Pin into 3d coordinates
by on Feb 27, 2012 at 3:12:53 am

Create 3D depth from 2D planar tracking using corner pin into quatra points in 3d space. bam?

http://www.videocopilot.net/tutorials/magic_tracking/


Return to posts index

anil kumarRe: Turning Corner Pin into 3d coordinates
by on May 11, 2016 at 5:54:58 am

Hi Nicolas

did find anyway for that ( corner pin to 3d null or 3d cordinate)

cornerpin to null plug-ins work with only 2d null not to 3d. by using we got only 2d coordinate of cornerpin not exact 3d data.

i trying on the Internet and i found here that u also need that method since 4 year and maybe u succeeded so if u have any idea to how to convert it.

i found some script which done that work but not accurate but move and scale 100% matched.

so please help me out i have same problem .

thanks

**************************************************
Hey Guys,

didn't see this thread originally.
May I propose a different solution, one that does offer Zoom, Position and Rotation Motion blur:

I start out with a Corner Pinned layer, let's call it 'trackedPin'. I'm assuming it's position, rotation, scale are not animated, only the corner pin points are.

Duplicate that layer, disable the corner-pin effect, and rename it ("motion blur pin"). Enable Motion Blur. Hide the original.
Now add these expressions:

Position:

l=thisComp.layer("trackedPin");

ul=l.effect("Corner Pin")(1);
ur=l.effect("Corner Pin")(2);
ll=l.effect("Corner Pin")(3);
lr=l.effect("Corner Pin")(4);

center=(ul+ur+ll+lr)/4;

l.toComp(center);


Scale:

l=thisComp.layer("trackedPin");

ul=l.effect("Corner Pin")(1);
ur=l.effect("Corner Pin")(2);
ll=l.effect("Corner Pin")(3);
lr=l.effect("Corner Pin")(4);

w=Math.max(length(ul,ur),length(ll,lr));
h=Math.max(length(ul,ll),length(ur,lr));

[w/width,h/height]*100


Rotation:

l=thisComp.layer("trackedPin");

ul=l.effect("Corner Pin")(1);
ur=l.effect("Corner Pin")(2);
ll=l.effect("Corner Pin")(3);
lr=l.effect("Corner Pin")(4);

l=(ul+ll)/2;
r=(ur+lr)/2;

x=r[0]-l[0];
y=r[1]-l[1];

ang=radiansToDegrees(Math.atan2(y,x));


by averaging out the cornerpins, and doing some extra math, we get position, rotation and scale that roughly tracks the layer. So we get motion blur for free.
Now we need the corner-pin effect again, but only to do some minor adjustment of the corners. In other words, add back the perspective
Add these expressions to the corner-pins of the motion blurred layer:

Upper Left:

l=thisComp.layer("trackedPin");
p=l.effect("Corner Pin")(1);
fromComp(l.toComp(p));


Repeat for each Pin, just change the numbers on the second line to (2), (3), (4)

That's it. The expressions for position, rotation, scale, could be a bit better, because now, the corner pins sometimes still have to scale up the layer. But I'll leave that for another day.


offset = effect("Slider Control")("Slider");
cam = thisComp.activeCamera;
p = toWorld(anchorPoint);
v = normalize(cam.toWorld([0,0,0]) - p); // unit vector from layer to cam
value + fromWorldVec(offset*v);

************************************************************


Return to posts index

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