Page 1 of 1

Removing parenting & targetting -- baking the AE camera

Posted: February 24th, 2008, 6:45 pm
by urbanspaceman
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. ... raBake.jsx

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

Re: Removing parenting & targetting -- baking the AE camera

Posted: April 8th, 2008, 11:24 am
by redforty

Thank you!!! <333

Re: Removing parenting & targetting -- baking the AE camera

Posted: April 12th, 2008, 11:13 am
by sneather
I couldn't have found this script at a more important time! However, I'm having difficulties making it work correctly. I'm using AE 6.5, and trying to get my camera data ported into Electric Image 5.5. I need this bake script because my AE camera is the child of an animated null, and the 3DMation MoCon script doesn't handle that properly into EIAS. But if I use the bake script first, and follow the prompt to remove the camera auto orientation, EIAS says there's no data to import, at all. When I leave the orientation on, I get better results, but still not accurate to the original AE move. Something is getting lost in the translation.

Can anyone please lend some advice???


Re: Removing parenting & targetting -- baking the AE camera

Posted: April 13th, 2008, 8:54 am
by urbanspaceman
Because I'm not familiar with EI, I'm not completely clear. Are you saying you are using my script, and then MoCon to go to EI? Does switching from Orientation to Reference camera in MoCon make a difference?

All I did in this script was to put the point of interest in the same spot as the camera position, and this nullifies auto-orientation, basically. In AE 6.5 there is no command for switching the POI off, so that's the next best thing. I only put a prompt in there to instruct you to turn it off because it will probably be best to get rid of it, as it's not needed. But it's probably okay to leave it on, as long as you don't make further changes to the camera.

Re: Removing parenting & targetting -- baking the AE camera

Posted: April 14th, 2008, 12:23 pm
by sneather
Yes. MoCon isn't able to handle child cameras (or objects) when exporting data (.obm) to EIAS. So, your script seemed to be the perfect solution, and from inside AE, it looks like it is. My baked camera moves juts like it did when it was attached to a null. But, there is something with the orientation which I can't figure out. I've tried exporting with MoCon in both orientation, and reference, and I've also tried it with the auto orientation on and off. Still, once in EIAS, the camera seems to move fine, but the reference is not aligned. Strange.

Thanks so much for the reply, though, and I hope this thread might lead to someone else who is more familiar with AE to EIAS possibly helping out.


Re: Removing parenting & targetting -- baking the AE camera

Posted: April 14th, 2008, 3:16 pm
by urbanspaceman
Part of the reason to bake the camera is to dispense with a reference (target, Point of Interest, etc) all together. So if you ran my script, the idea would be to not use a reference in EI. If you had reference camera selected in MoCon, my guess (not knowing EI specifically) is that it would introduce a target, which might screw up the baked camera which is supposed to be a "free" camera not pointing at any reference. You certainly wouldn't want MoCon to read the POI from After Effects and bring it into EI after running my could cause havoc because I placed the POI in the same spot as the focal point of the camera...if moved slightly the camera could rotate wildly in unpredictable directions. That's the reason for the prompt to turn it off and get rid of it.

In most cases, you want to stick with one method for rotating the camera. My bake script is for the orientation method, not to be mixed with the reference method.

Re: Removing parenting & targetting -- baking the AE camera

Posted: April 14th, 2008, 5:08 pm
by sneather
Thanks. I'll try it again, with the orientation method. I also just installed AE CS3, and the newest 3DMation script. Perhaps, that will take care of the issue (fingers crossed).

Re: Removing parenting & targetting -- baking the AE camera

Posted: August 11th, 2009, 1:09 pm
by dflamholc
Hi all,

I'm really pleased to find this thread and the script, but I'm having some trouble with it at the same time.

When using it with Andrew Kramer's SureTarget 1.5.1, the parented camera seems to have a problem with 180 degrees rotation and sometimes caps the rotation at 43.3 degrees. Has anyone had similar issues?

Just keen to see if there are any updated tips on this...

Thanks to all above!

cheers/ david

Re: Removing parenting & targetting -- baking the AE camera

Posted: August 13th, 2009, 9:59 am
by macattack
Is this script complete?

from above: ... raBake.jsx

I can't seem to find values for some things (v, u, w) and the for loop seems incomplete. Maybe just because I'm new to JavaScript. But I could really use a script to bake animation.

I reformatted it and removed a rogue double-quotation mark:

Code: Select all

//****************************** SUBROUTINES 
function Bake(theComp, propBeingCopied, propBeingWritten) 
	for (var i=StartBake; i .0005)
	{c = -Math.atan2(v[0],u[0]);
		a = -Math.atan2(w[1],w[2]);
	else{a = Math.atan2(u[1],v[1]);c = 0;
	theComp.layers.addCamera("CameraCopy 2",[0,0]).startTime=0; 
	CamCopy02.position.expression="thisComp.layer('CameraCopy 1').position"; 
	CamCopy02.rotationX.expression="thisComp.layer('CameraCopy 1').orientation[0]"; 
	CamCopy02.rotationY.expression="thisComp.layer('CameraCopy 1').orientation[1]"; 
	CamCopy02.rotation.expression="thisComp.layer('CameraCopy 1').orientation[2]"; 
	theComp.layers.addCamera("Baked Camera",[0,0]).startTime=0; 
	CamCopy03=theComp.layer(1); Bake(theComp, theComp.layer(2).position, CamCopy03.position); 
	Bake(theComp, theComp.layer(2).rotationX, CamCopy03.rotationX); 
	Bake(theComp, theComp.layer(2).rotationY, CamCopy03.rotationY); 
	Bake(theComp, theComp.layer(2).rotation, CamCopy03.rotation); 
	Bake(theComp, theComp.layer(2).zoom, CamCopy03.zoom); 
	theComp.layer(3).remove(); theComp.layer(2).remove(); 
	alert("Turn off the auto-orientation on the baked camera"); 
	//****************************** END 

Re: Removing parenting & targetting -- baking the AE camera

Posted: November 15th, 2009, 4:44 am
Script perfect!!
but sometimes i have a trouble with YRotation when i use Null as parent for camera.
script worked only when YRotation <= 66,1 degree
ZRotation worked any degree
maybe someone knows answer

Re: Removing parenting & targetting -- baking the AE camera

Posted: December 17th, 2009, 8:09 am
by caltd
Just wanted to say thanks for the script - much appreciated & very useful!