AE ENHANCERS

Expressions/Scripts/Presets
It is currently Wed Jun 29, 2016 5:38 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 83 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: AE to C4D
PostPosted: Sun Apr 22, 2007 12:44 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 704
Location: London, UK
pt_AEtoC4D:
These scripts export data from After Effects to Cinema 4D. AEtoC4D exports AE cameras, nulls with the position and rotation of other layers, the comp frame rate, duration and start frame. Requires AE 7.0 and C4D R9.6, or greater.
Download pt_AEtoC4D_v1.4.zip

v1.4 UPDATE - JUL 10
Added CS5 compatibility.

v1.3 UPDATE - AUG 08
1. Now imports rotation for all layers, not just cameras.
2. Fixed bug when importing cameras with static rotation values.

Original After Effects composition:
Image

Resulting Cinema 4D project:
Image

Thanks to Paul Babb, Rick Barrett and Liam Stacy at Maxon, Ko Maruyama, Stu Maschwitz, Dale Bradshaw, Nab, Steve Kirby and Salvador Zalvidea for their help and ideas.

Instructions:
1. Put pt_AEtoC4D.jsx in Adobe After Effects / Scripts
2. Put pt_AEtoC4D.CSC in Cinema 4D / library / scripts.
3. Animate your scene in After Effects using a Camera with Layer > Transform > Auto-Orient set to Off. Animate rotation using the XYZ Rotation properties, not Orientation.
4. Select the cameras and layers you want to export and choose File > Scripts > pt_AEtoC4D.jsx. You'll be prompted to save a text file.
5. In C4D, select Plugins > User Scripts > pt_AEtoC4D and select that text file.

NOTES:
1. This script doesn't export camera zoom. You'll have to set the camera's field of view manually in C4D after import. Check out the test project, which uses nulls as a guide to help line up the FOV.
2. This script doesn't export parented layers.


Last edited by Paul Tuersley on Sat Sep 01, 2007 6:25 am, edited 5 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 12:51 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 704
Location: London, UK
AEtoC4D R&D:
Here's the story of how I researched and developed these scripts. It gives me a chance to credit all the people who've helped in the making.

I switch between vfx and motion graphics freelance work and have mainly used AE my whole career. Increasingly with the motion graphics work I'm needing more basic 3D elements, such as a stock model or some 3D text. AE's 3D capabilities haven't changed all that much since their introduction in AE5, and while there are some excellent third party solutions, they have some limitations.

Regularly having to get someone else to knock out these 3D elements isn't good. Clearly, animators that know a little of a 3D app have an advantage, and around here that app seems to be C4D.

Learning 3D:
So a week ago I decided it was time to learn a bit of C4D. I spent about 3 days going through tutorials to get a basic overview of the app. I got thinking about how it wouldn't be much fun if I couldn't get AE's camera data over to C4D. I still want to animate the camera and do the bulk of my animation in After Effects, I just want to sync C4D up so the 3D renders will match into the AE scene. I reasoned that I'd be a lot more enthusiastic about learning C4D if I knew the solution existed, so I decided to do some research.

AEtoC4D research:
To start, there was the request from Salvazalvi and the subsequent export script written by Nab:
http://aenhancers.com/viewtopic.php?t=456
It seems there is a solution for moving position data, but it's a bit fiddly on the C4D end (using ASCII data import) and it isn't working for rotation. So not quite there yet.

Nimpsy posted a similar solution for moving tracking data:
http://maxon.digitalmedianet.com/articles/viewarticle.jsp?id=42002
NOTE: It would be fairly simple for me to adapt the script to pass tracking data if anyone wants it?

Googling on, Simon Wicker posted this solution for Maya cam to C4D:
http://forums.cgsociety.org/showthread.php?t=253099
It uses C4D's Expresso (node based expressions) to convert the Maya camera data into suitable values for C4D. Very interesting stuff, but it still involves the ASCII data importer and some other fiddly steps.

Simon's solution was picked up by Yuppster, who tried to use it to translate AE camera data:
http://forums.cgsociety.org/showthread.php?f=47&t=321029
If you read the thread you'll see they also run into problems with rotation, caused by AE's rotation order being different to C4D's.

I decided to worry about rotation later. I wanted a more automatic solution than Expresso seemed to offer, something more like AE scripting, where it just reads the text file, sets things up and creates the keyframes. This meant learning C4D's scripting language, called COFFEE.


Last edited by Paul Tuersley on Mon Apr 23, 2007 2:28 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 1:06 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 704
Location: London, UK
Many cups of COFFEE later:
I can't tell you how much pain I went through trying to write the COFFEE side of the script. It was a similar experience to when I started learning AE scripting and mainly for the same reason, a lack of available real world examples of COFFEE code. There is some stuff out there, but not much.

That's not the case with AE scripting anymore. Thanks to AEnhancers and a number of other sites, there's a lot of code out there, which is a great reference for usage examples when you hit something new. In C4D, it seems that you can keep your script as a regular COFFEE script (like mine, ending in .CSC) or turn it into a plugin (source = .COF, compiled = .COB). Unfortunately, most COFFEE scripters seem to favour the compiled .COB format, so there's no chance to study their code.

The COFFEE language:
Apparently COFFEE's a bit like C++ (which I don't know) and Javascript (like AE scripting) but possibly more like C++. I can tell you one thing, it certainly seems a lot fussier that AE scripting for things like arrays, variable types and basic syntax. And I stayed well clear of classes.
Here are links to the COFFEE 9.5 SDK and the main forums I searched for answers:
http://www.maxon.net/pages/support/plugincafe_downloads_e.html
http://www.plugincafe.com/forum/default.asp
http://www.c4dcafe.com/ipb/lofiversion/index.php/
http://forums.cgsociety.org/forumdisplay.php?f=182
http://www.3dattack.net/forum/index.php
http://xpresso24.com

Problem - Recording Position keyframes:
The first major problem I had was simply finding a way to set the Position keyframes. I couldn't find a single usage example of someone using COFFEE to set a sequence of Position keyframes and from what I read, it seems C4D 9.5 COFFEE has some surprising limitations in this area.

I eventually found I could cheat by using CallCommand() which behaves similarly to AE scripting's app.executeCommand() for accessing menu commands. So my workaround for setting keyframes using COFFEE is basically to get the script to press the "Next Frame" button, then change the X, Y and Z values before hitting the "Big Red Record" button. It's dumb, but it works.

Problem - Doing the same for rotation:
I thought that'd be simple, but once I got the script to hit the "Goto Start Frame" button and repeated the process for the Rotation values, the keyframes came in ok, but now the "Big Red Record" button was also resetting the Position keys I'd already set. I eventually fixed it by storing the Position values in an array and applying the Position and Rotation keyframes at the same time.

Problem - Rotation order:
It was finally time to investigate the rotation order issue. I remembered Stu Maschwitz had posted a solution to AE's "wrong" rotation order on creative-workflow-hacks.com for Dale Bradshaw's auto camera rig creation script:
http://www.creative-workflow-hacks.com/2006/07/13/script-to-automate-rigging-a-camera-in-after-effects/
It was my lucky day. Stu's AE camera rig uses the same rotation order as C4D!!!! So that's why, for the time being, this script requires you to use that camera rig. I'm fairly sure I know enough now to create an inverse rig in C4D instead, but once you've used the rig, you may find you prefer it. If you pan then tilt AE's normal camera, you'll find the view is no longer level with the horizon. That doesn't happen with the camera rig or in C4D.

What's next?
So here I am, a week later, with what will hopefully prove to be a useful script. Depending on the demand, there are a lot of improvements that should be possible. Automatically setting the duration and frame rate in C4D, exporting other things like nulls, lights and layers (as reference planes). If someone can help me with the math, I can probably sort out zoom / field of view too.

One possible snag is I've heard the animation system has been overhauled in C4D R10. So it's quite possible this script won't work in it. There's no SDK available for COFFEE in R10 yet either so I have no idea what's changed.

Well that's it, if you've made it to the end, thanks for taking the time. And if you try the script, let me know how it works out for you.

cheers,

Paul Tuersley


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 12:15 am 
Offline

Joined: Tue Sep 21, 2004 7:29 am
Posts: 36
Hi Paul,

This is very good news. It will give us a lot more flexibility.
As soon as I'm back to my office I'll give your script a try with C4D 10.

It seems that the exact same reasons brought us to C4D.

I remember trying to do the same thing with 3DSMax and discovering that orientation and rotation don't do the same in AE. One entire project to trash.

Thank you very much.

Salvador


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 17, 2007 2:12 pm 
Offline

Joined: Wed Feb 28, 2007 4:29 pm
Posts: 1
Location: Berlin | Germany
Hi Paul,

Wow! That's really awesome that you actually made it happen. :-)

A big Thanks to you, and everyone who contributed to it. Really great giving this to the community...

All the best...

Sascha


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 22, 2007 12:04 pm 
Offline

Joined: Tue May 22, 2007 10:56 am
Posts: 1
Location: D-Ville
Paul,

If the only reason you're using the camera rig is because of the rotation order problem, you can fix it pretty easily in C4D.

Instead of making just a camera and trying to make it do all the work, create 4 nested nulls with the camera as the last item in the chain.

-PositionNull (Dump the position keys on this from the array)
|-P Null data
_|-H Null data
__|-B Null Data
___|-Camera (all coords to zero, just link fov data to it)


The order of the nulls forces C4D to do the rotations in that order. I tried this on Yuppsters sample data and the cams locked right up.

This way your AE script can use the normal XYZ so people can use the cam as normal.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 22, 2007 2:07 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 704
Location: London, UK
Thanks. Actually you can do it with just one null, the inverse of what the rig did in AE. The next version, which exports a normal AE camera, is nearly ready.

Paul


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 03, 2007 1:27 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 704
Location: London, UK
This is just a heads up to say check out the first post for an update to the script. This v1.1 update is really the first proper version of AEtoC4D, as it now exports normal After Effects cameras.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 03, 2007 3:54 pm 
Offline

Joined: Sun Aug 29, 2004 5:37 pm
Posts: 8
Location: Sweden
Great work Paul!

A question; would it be possible to update an existing animation instead of creating a brand new scene?
What I really want is a seamless way to go back-and-forth between After Effects and C4D, tweaking the animations on either end and have the changes updated in the other.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 03, 2007 4:08 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 704
Location: London, UK
It isn't possible with this script, and it sounds tricky to implement. For one thing, the script currently exports baked keyframe data from AE, so you can't really edit it once it's in C4D.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 03, 2007 5:51 pm 
Offline

Joined: Thu Dec 28, 2006 11:44 am
Posts: 1
Location: Pleasanton, CA
Nice stuff, Paul. Looking forward to giving it a whirl.

_________________
Bruce Findleton


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 04, 2007 1:11 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 704
Location: London, UK
I just made a quick fix to ensure frame rate's of 29.97 round up to 30 in C4D (it was rounding to 29). So anyone using 29.97 or 23.976 should download it again.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 20, 2007 3:32 pm 
Offline

Joined: Tue May 22, 2007 12:34 am
Posts: 2
Thanks for the time you put into this.

I go from Lightwave to AE via a set of scripts.
One very crucial factors in managing this well is to have a mean to adjust the scale of the 2D/3D environments.
In Lightwave if you model at a real worlds scale, the camera data come into AE fine, but the scale is so small that the 3D AE space is hard to work in.
The scripts I us let you up scale the export to AE, rather than modify the actual scale of the models - which is a no-no, in most cases.
I've just made the switch to C4D, but it struck me that it might be a important factor - including a simple multiplier to 'attenuate' the scale during export from AE to C4D.

Hope that make sense


Top
 Profile  
 
 Post subject: LW <-> AE scripts? OT question for Blabberlicious
PostPosted: Mon Jul 23, 2007 4:09 pm 
Offline

Joined: Tue Nov 07, 2006 2:07 pm
Posts: 21
First off, thanks Paul for the great scripts for C4D, looks like you put your all into them.

I wanted to ask Blabberlicious if the scripts he uses to exchange AE and LW info are available somewhere.

thanks, pdeb


Top
 Profile  
 
 Post subject: CS3?
PostPosted: Thu Aug 16, 2007 4:01 am 
Does this script work with After Effects CS3?


Last edited by Benjibop13 on Fri May 13, 2016 4:21 am, edited 1 time in total.

Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 83 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group