ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Transfer scale of a 3D layer to a 2D layer

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Marc RühlTransfer scale of a 3D layer to a 2D layer
by on Jun 1, 2014 at 11:03:06 pm

I got a comp with a camera dollying out and a lot of 2D layers, which should get affected by this movement. I created a 3D null and linked the position of one of my 2D layers with toComp([0,0,0]).

But the really hard part is the scaling: I tried to get something out of the distance between the cam and my 3D null, but ignored the fact, that the scaling isn't linear and decreases slower away from the camera.

I don't need someone writing something for me, but I would be nice if someone could point me in the right direction or tell me if this simple isn't possible.

Oh by the way, to make things a bit more complicated, the movement of the camera is linear and space but increases in speed.

http://www.schwarzgrau.com


Return to posts index

Walter SoykaRe: Transfer scale of a 3D layer to a 2D layer
by on Jun 2, 2014 at 5:03:02 am

Can I ask why you can't just use 3D layers? Depending on what you're trying to do, there might be an easier way.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Marc RühlRe: Transfer scale of a 3D layer to a 2D layer
by on Jun 2, 2014 at 6:19:24 am

Sure, I just don't wanted to become to technical in my question.
First they shouldn't skew, I need them as flat as possible and they are a lot of layers ( since I need most of them only for about two frames ) which I would need to reposition and scale one by one. If I could get the absolute scale, out of this cam movement, I just needed to parent them to the null on their first frame.
I'm really not sure if my post here made it only a tiny bit clearer, cause it would be already hard for me to tell it someone in german and my limited english knowledge does it's job too.
Maybe I should mentioned that I already tried it with 3D layers .

http://www.schwarzgrau.com


Return to posts index


Darby EdelenRe: Transfer scale of a 3D layer to a 2D layer
by on Jun 2, 2014 at 5:32:08 am

You'll need a reference point for the scale but the basic idea is:

scale * camera's zoom property / distance to layer along camera's z-axis

Darby Edelen


Return to posts index

Marc RühlRe: Transfer scale of a 3D layer to a 2D layer
by on Jun 2, 2014 at 6:34:53 am
Last Edited By Marc Rühl on Jun 2, 2014 at 6:45:08 am

It seems to work. And it's a lot easier, than I expected it to be, but I never came up with the idea of using the zoom.
Thank you a lot Darby!

Here is my, probably not very well written, expression.
C = thisComp.activeCamera.toWorld([0,0,0]);
P = thisComp.layer("3D layer").toWorld(anchorPoint);
dis = length(C,P);

CZ = thisComp.layer("_Camera04").cameraOption.zoom;

S = thisComp.layer("3D layer").transform.scale[0];

temp = S*CZ/dis;
[temp,temp]


and of course this one for the position
l = thisComp.layer("3D layer");
l.toComp(l.anchorPoint);


http://www.schwarzgrau.com


Return to posts index

Darby EdelenRe: Transfer scale of a 3D layer to a 2D layer
by on Jun 3, 2014 at 3:40:12 am

Technically you'd want to use the distance along the camera's z axis. Something like this:


C = thisComp.activeCamera;
L = thisComp.layer("3D layer");
CP = C.toWorld([0,0,0]);
P = L.toWorld(L.anchorPoint);
CV = C.toWorldVec([0,0,1]);
dis = dot(CV, P - CP);

CZ = thisComp.layer("_Camera04").cameraOption.zoom;

S = thisComp.layer("3D layer").transform.scale;

S*CZ/dis;


This prevents the layer from scaling as it moves laterally relative to the camera. I may have reversed the subtraction order in the dot() function, writing from my phone and can't double check it.

Darby Edelen


Return to posts index


Marc RühlRe: Transfer scale of a 3D layer to a 2D layer
by on Jun 3, 2014 at 8:47:15 am

Im not at home for the next days, so I cant check it either, but Ill check it then. Again thank you a lot.

http://www.schwarzgrau.com


Return to posts index

Marc RühlRe: Transfer scale of a 3D layer to a 2D layer
by on Jun 10, 2014 at 1:41:04 am

Works exactly like it should. Thank you again Darby!

http://www.schwarzgrau.com


Return to posts index

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