ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

baking camera for export - trouble with 3D rotations!

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ryan Gilmore
baking camera for export - trouble with 3D rotations!
on Feb 24, 2008 at 10:50:14 am

baking the AE camera for export to 3D packages - trouble with 3D rotation

I'm trying to share my AE camera with a number of 3D packages. What often helps is having a free camera that does not use a POI (target) or parenting before you export. So I was trying to write an expression to convert all values to global values to "unparent" my camera. The position so far works fine. I used Dan Ebberts' 2D Auto Orientation script for the rotations as a starting point...which works fine one at a time, but not when the the axes are combined. Does it not work because of the rotation order? Anyone tackled this before?

The layer "c" is my keyframeless child camera layer controlled by a parent null. Below are the expressions applied to the new free camera.

Position

L=thisComp.layer("c");L.toWorld(L.anchorPoint)

X Rotation

L = thisComp.layer("c");
u = L.toWorldVec([0,0,1]);
-radiansToDegrees(Math.atan2(u[1],u[2]))

Y Rotation

L = thisComp.layer("c");
u = L.toWorldVec([1,0,0]);
-radiansToDegrees(Math.atan2(u[2],u[0]))

Z Rotation

L = thisComp.layer("c");
u = L.toWorldVec([1,0,0]);
radiansToDegrees(Math.atan2(u[1],u[0]))


Return to posts index

Ryan Gilmore
Re: baking camera for export - trouble with 3D rotations!
on Feb 25, 2008 at 1:47:52 am

Thanks to some direct help from Mr. Ebberts with the 3D rotations, I now have a script to share that will bake the AE camera. It shouldn't matter what rotation methods and parenting the original camera has, as it translates all of that into a free camera with only position, rotation, and zoom parameters.

All you have to do is set your work area, highlight your camera, and it will make a copy of it with all the keyframes baked.

There are a number of advantages. Sometimes there is a need to export an AE camera to a 3D app, and baking the camera usually helps you avoid certain problems before you export. Also, there is an advantage to seeing the camera motion path on a free camera that's invisible on a parented one. And, this script could easily be adapted to remove parenting or auto-orientation on any layer.

http://www.urbanspaceman.net/shared/AEscripts/AECameraBake.jsx

(ps. there is no error checking in the script, so if you don't highlight the camera it just quits at the moment)


Return to posts index

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