Copy link to clipboard
Copied
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?
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])
Copy link to clipboard
Copied
It's a cosine transform based on the distance and zoom level.
Mylenium
Copy link to clipboard
Copied
Can you please show me an example. How can I make it work for a single corner?
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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])
Copy link to clipboard
Copied
Thank you so much.