ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Maintain Scale of object with Z camera move

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Naoko Hara
Maintain Scale of object with Z camera move
on Mar 23, 2018 at 1:20:29 pm

I have a camera parented to a 3D null doing all the position moves. I need to keep the scale of my shapes constant as the camera pulls back.
I've found expressions what work when all the positioning is done on the camera layer, but not when it's attached to a 3D null.

Help. Thanks!


Return to posts index

Steve Bentley
Re: Maintain Scale of object with Z camera move
on Mar 23, 2018 at 2:24:17 pm

I take it you don't want to parent the shapes to the camera (or the null) - this would keep them the same size as you pull back but they would also travel with the camera so they wouldn't move relative to the camera. (although you could animate them)

In the expressions the only difference should be that a null will have an anchor point and the camera wouldn't.
You didn't include any expressions but in things like a=nullLayer.toWorld(nullLayer.anchorPoint); you have to reference the anchor point of the null. But in your original camera code you probably had a=camera.toWorld([0,0,0]); Since cameras (and lights) don't have anchorpoints you just use their origins.

I imagine using vectors would be the easiest. You could normalize the distance the camera is going to travel (or the distance to the shapes) and then you can use that as a scalar function on the shapes (or at least a multiplier) because that vector would go from zero to one. That way if all the shapes are at different scales or sizes they would all scale the same amount to keep up with the camera's distance.

I don't think there is a "width" transform where you could tell the shapes to stay at a constant width relative to the 2D viewport.



Return to posts index

Naoko Hara
Re: Maintain Scale of object with Z camera move
on Mar 23, 2018 at 3:30:52 pm

I ended up figuring it out moments after, but thanks for your response.
Used this expression:

nominalDist = 400;

C = thisComp.activeCamera;
v1 = toWorld(anchorPoint) - C.toWorld([0,0,0]);
v2 = C.toWorldVec([0,0,1]);
d = dot(v1,v2);

value*(d/nominalDist)


Return to posts index

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