Cinema 4D .OBJ Sequence Export (Python Script, No Plug-ins)
As of Cinema 4D R17, there’s still no easy, built in method to export an OBJ sequence.
I needed a sequence made up of 1200 individual files to bring into Element 3D for After Effects.
There are two plugins that I’ve found that export a sequence of OBJ files, but neither of those were working as I needed them to for a recent project.
- Riptide Pro ($50) partly worked, but for some reason – no matter what options I set in the plugin – it had an issue with some of the cloner objects that were scaled – they were coming into Element 3D at completely the wrong size and the scale animation was been completely ignored. Even when I baked the whole MoGraph simulation to keyframes (using NitroBake) it wasn’t working as I needed it to.
- Plexus OBJ Sequence Exporter for C4D (free) exported the bare bones of the animation (including the scaled elements) correctly and if I’d been using Plexus, it would have been (appropriately) perfect . BUT, the Plexus OBJ Sequence Exporter doesn’t include any material ID’s in it’s OBJ files, and Element 3D requires each separate object to have a unique material applied if you want to texture them differently in Element 3D’s interface and generally have much more control over how you render with it in After Effects.
Exporting a single OBJ using Cinema 4D’s built exporter –
File > Export... > Wavefront OBJ (*.obj) – created exactly the file I needed – it worked exactly as expected in Element 3D. But there’s no option to export a sequence, just a single OBJ of whatever’s on screen at the time – and I didn’t fancy manually exporting 1200 frames.
At this point I was nearly ready to just render the entire video in Cinema 4D and forget Element 3D altogether, but I wasn’t quite ready to give up and needed the render speed and extra control I could get in After Effects.
After some more Googling, I eventually found exactly what I needed – an amazing little Python script by Owen Lim, hidden away on his Behance profile.
- Original Python OBJ Sequence Export script by Owen Lim – behance.net/gallery/18442389/C4D-Mini-Script-05-Obj-Sequence-Exporter
If you use version R16 of Cinema 4D or below, the script Owen has written should work perfectly for you as it is on his Behance page.
If you have R17 Owen’s script won’t work unless you make a few tweaks. So after even more googling, I found the changes I needed to make and managed to get it 100% working, which is what you see below.That was all a really long winded introduction to this incredibly useful script pasted below, updated to work in C4D R17.
I’ve only used this script in C4D on Windows 10, but it should hopefully work on the Mac version too.
EDIT: I’ve replaced the code that was written here with this link instead. The tab/indenting in the code |I had was wrong, and Python is apparently very picky when it comes to incorrect indentation and white-space.
Click the link below to view the code, or right-click it to save the file which you can then open in the Script Manager.
DOWNLOAD: C4D to OBJ.py
How to use it
To run the script, open up –
Script > Script Manager – paste in the code or open the file in the link above, set the animation range and frame-rate, then click
If you need to set the export options for your sequence (for example you’ll need to flip the x-axis if you intend to use the sequence in Element 3D), export a single OBJ first (any will do) using –
File > Export... > Wavefront OBJ (*.obj) – which allows you to set the options. Then when you export your sequence, those settings are retained for each file.
I hope you find it as useful as I have!