Skip to main content
Adirai Maji
Inspiring
February 15, 2020
Answered

How can I move CornerPins to the exact points when a layer moved into Z space to align it with comp?

  • February 15, 2020
  • 3 replies
  • 1037 views

I want to calculate the distance between the 4-corner of CornerPin effect with respective composition corners to move them exact point instead of eyeballing it?

This topic has been closed for replies.
Correct answer Mike_Abbott

In that case it's even easier.
For the top left point just use the expression:

 

fromCompToSurface([0,0,0])

 

EDITED: for the other points, use:

Top right:

 

fromCompToSurface([thisComp.width,0,0])

 

Bottom left:

 

fromCompToSurface([0,thisComp.height,0])

 

Bottom right:

 

fromCompToSurface([thisComp.width,thisComp.height,0])

 

 

3 replies

Mike_Abbott
Mike_AbbottCorrect answer
Legend
February 16, 2020

In that case it's even easier.
For the top left point just use the expression:

 

fromCompToSurface([0,0,0])

 

EDITED: for the other points, use:

Top right:

 

fromCompToSurface([thisComp.width,0,0])

 

Bottom left:

 

fromCompToSurface([0,thisComp.height,0])

 

Bottom right:

 

fromCompToSurface([thisComp.width,thisComp.height,0])

 

 

Adirai Maji
Inspiring
February 16, 2020

Thank you so much.

Mike_Abbott
Legend
February 15, 2020

If I'm reading your post correctly - you want to match the corner pins of a layer in 3D space with the corners of another 2D layer? The best way to do this is with layer space transform expressions - but this is a complex area.

Lets's call your layer: "solid2D".  On your upper left corner property paste this expression:

 

S2D = thisComp.layer("solid2D"); //get the name of the layer.
S2DP = S2D.toComp([0,0,0]);      // get the layer's upper left position in Comp space.
fromCompToSurface(S2DP)          // project that Comp position onto the surface of the 3D layer.

 

You will need to adjust the layer name: "solid2d", to your own layer name.

That should give you a matching position for the upper left corner pin.

For the other corner pins replace the second line of the expression as follows:

for upper right:

 

S2DP = S2D.toComp([S2D.width,0,0]);

 

for lower left:

 

S2DP = S2D.toComp([0,S2D.height,0]);

 

lower right:

 

S2DP = S2D.toComp([S2D.width,S2D.height,0]);

 

 

I hope the above helps! 

Adirai Maji
Inspiring
February 16, 2020

Thank you so much. It helped. But I don't want match the corners of 3D Layers to the corners of  2D layer. I need to match the corners of 3D layers with composition. By this method I had to create a guide 2D layer to get information of each corners.  Is there a way that you can directly feed composition corner information to this expression without using a 2D layer??? If there's no way other than this. Just let me know I can mark it as Correct Answer. Thank you again sir...

Mylenium
Legend
February 15, 2020

It's a cosine transform based on the distance and zoom level.

 

Mylenium

Adirai Maji
Inspiring
February 15, 2020

Can you please show me an example. How can I make it work for a single corner?