Join them all !
Today is a great day for me. Because I put online my first addon for Blender ! In fact, it's not my first addon .. but it's the first I release publicly.
So, I'm proud to present my Animation Joiner. I designed it with dynamic simulation in mind, but I found it could be usefull for character animation, too. My goal was to merge animated objects into only one mesh, animated by a MeshCache modifier and a PC2 file.
Why a PC2 file ?
PC2 is a binary cache file format, wildly use in production. It can be nativaly streamed in 3DS Max and Blender, but can also be used in Maya, Lightwave, Houdini, and many others. Because Blender doesn't have Alembic support yet, PC2 is for me the best to way to interchange animated object between 3D packages.
But when I wrote this addon, I wasn't thinking of interchange format. I was thinking of dynamic simulation, and more precisly Rigid Bodies. I work a lot with rigid bodies in Blender. And the most difficult part of the job is to manage cache files, specialy when you have thousands of debris. I dreamed about a technic where you can manage multiple debris as easy as only one mesh. And that's the goal of my addon.
Reducing the complexity of the scene
Select your debris, set the path to the PC2 file and click on Join Animated Objects. After few seconds, on the next layer, you will find only one animated mesh using a MeshCache modifier, streaming a PC2 file. Now, you can duplicate (linked) the mesh and multiply the number of debris without rising the usage of the memory. And you can even offset the animation ! If you generate two PC2 files for the same debris, you can also crossfade from one Meshcache to another by using the Influence parameter.
Because you now have only one object, you can add any modifier on it, like a Bevel for instance. But you can also emit particles from all the debris really easily. You can even duplicate (linked) this object and add a Collision modifier on it. By this way, particles will be emitted by the debris, but they also bounce on them ! Try to do that when you have hundred of debris ... not so easy.
Same thing for the smoke : you can try to emit smoke from the debris, with a duplicated object set as a collider. With only two objects, you can see the smoke flowing through every holes in a falling wall !
Reshaping and retiming dynamic simulation
Because you have only one object, you can deform it during the animation by using a lattice of even shape keys. In the demonstration video bellow, you can see that I tweak the position of only one debris because it intersect with another one. You can also emit particles and use an Explode modifier, followed by a Solidify to generate more smaller debris.
MeshCache can be animated using different options. One of my favorite is the one named "Custom". Because, you can timeremap you simulation by only creating keyframes, slow it down (the position of each point will be interpolated !) if you want to create a slowmotion shot of a falling building, without the need to simulate it at an higher framerate !
Maybe I'm wrong, but I think it's easier for Blender to manage fewer objects with an high polygons number than a lot of objects with fewer polygons. I think it's because of the dependancy graph. So, if you take a look at the first image of this post, 4 millions polygons are used to generate debris of all the buildings. But I can run the animation at 3 FPS and it only take 500 Mb in RAM, because of the instances used in the scene. And last but not the least, Cycles start almost immediatly when I launch an interactive rendering !
The music used is this video comes from the wonderfull Freeky Cleen & Dickey F :
For character animation too !
After a lot of years working with dynamic animation on several 3D packages (Maya, Houdini, Blender, etc ...) I think I know how it works, now. But when we talk about character animation, I have to admit that I'm a real noob on that. Even after 20 years working in the CG industry. So, that's why I thing the rest of this post "could be" usefull for animator ... but I not really sure. If you are an character animator, please tell me what do you think about that, in the comments bellow.
After my first experiments with my addon on dynamic animation, I developped the support of modifiers. By clicking the small checkbox in the interface, you can merge skinned object into one animated mesh. And it preserve UVs, Materials, Shapes, VertexColors, WeightMaps, etc ...
In the video, you can see me playing a little bit with Sintel, creating a PC2 file for 40 frames and then using them with drivers to offset each duplication in time. I thing it could be useful to manage crowd animation, but it's only my own opinion.
PC2 or shape keys
As an experimental feature, I added the possibility to convert all steps in shape keys instead of a PC2 file. Each frame use a different shape, the animation keyframes are automaticly created during the "baking". I add this fonctionnality for realtime engine such as Unity of UnrealEngine 4, who can (as far as I kown) embed animated shapes in the mesh by using FBX export.
Download link and final words
Finaly, here is the link to the addon :
You can just install it using the "File >> User Preferences" menu, and the "Install from file" button, by selecting the AnimationJoiner.py file.
So ... that's it. This is only the first version of my addon. Some bugs or limitation could be there, let me know. The only one I found for now is the baking of a cloth simulation. The PC2 conversion, integrated in my Addon, is inspired by the official PC2 exporter bundled with Blender (Thank you Florian Meyer !!!). But I took only some part of the initial export function. But AFAIK, you can use his exporter to export the cloth in a first pass, they join it with other objects with my addon in a second pass.