FORUMS TUTORIALS FEATURES VIDEOS PODCASTS EVENTS SERVICES NEWSLETTER NEWS BLOGS
 ADOBE AFTER EFFECTS: Home Forum Basics Expressions Tutorials Podcasts AE Techniques Creative Cloud Debate FAQ

# 3D scale formula for 2D layers

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
 3D scale formula for 2D layers by Jerzy Drozda Jr on Jan 5, 2008 at 3:35:29 am

Hey

I've been trying to do this for two hours and i'm close, but I must be doing something wrong.

What I want to achieve is to been able to calculate the what the scale of a object placed in 3D space would be, if it was a 2D layer. I hope I made myself clear.

For example. Assume we have two layers and a camera in the composition. One of the layers is 3D. when we move camera closer or further away from the 3D layer it gets bigger or smaller. Now I'd like to calculate the scale so I could apply it to a 2D layer so they both look the same.

I tried to follow popular 3D camera formula that I know from my flash experiments:

scaleFactor = focalLength/(z+focalLength)
[scale*100,scale*100,scale*100]

and it almost works, but not really.

Please someone help me out on this. I'd like it also to react to changes of Zoom and Focus distance parameters of the camera, since I want to use it with different cameras.

Any ideas?

 Re: 3D scale formula for 2D layersby Jerzy Drozda Jr on Jan 5, 2008 at 4:48:25 am

Nevermind. Finally got it figured out.

Did it ever happened to you that you were fighting with a problem for hours trying to solve it, but ended up with nothing. Than in desperation ask a question on a forum, and than almost instantly found an answer? :) I'm just courieous because it happend to me a lot when developing flash applications. This is the first time in AE :)

anyway... i whould have used:
scaleFactor = focalLength/z
[scale*100,scale*100,scale*100]