Baking Vertex Animations into Alembic Files

This continues the series on baking dynamics. Last time, we looked at baking rigid body dynamics into FBX f-curves, for rendering in applications that don’t support dynamics (such as mo2).

In that post, I mentioned that baking soft-body dynamics is a whole lot harder. There are several reasons for that:

  • Soft body deformations rely on per-vertex transformations
  • Apart from Alembic, there are essentially no standard ways of transporting point-based animations between 3D software
  • Even then, some simulations (e.g. fluids) may actually change the vertex and thus poly count, something barely any software can deal with

This problem isn’t new of course, and the industry had already come up with two methods to address this:

  1. Portable dynamics bake caches (take a look at the previous post for an explanation of dynamics baking). This is a way of transporting the internal bake cache between applications without “rendering” the transformations to a mesh. Notable software includes e.g. ChronoSculpt, which can work with three major cache formats (incl. Alembic)
  2. The brute force method: Bake a new mesh for every single frame. This is supported by many apps as “OBJ sequences” or “mesh sequences”, notably AE Element3D. As the name implies, the export format is really just a folder full of single OBJ files, one for each tick (usually a frame). The benefit of this method is the wide compatibility: everything supports OBJs (though not necessarily sequences), and changing polycounts are a non-issue since we just exchange the entire mesh every tick.

So mesh sequences address a similar problem to Alembic, but how can we convert between them? I needed to do this recently, in order to transport soft-body physics baked in Cheetah to Marmoset Toolbag 4 for rendering. Cheetah supports nothing - it stores its bake cache in the main scene file but the format is undocumented, and there isn’t any support for exporting Alembics. Toolbag on the other hand only supports Alembic, but not mesh sequences.

The first problem was easy enough to address, and I won’t go into much detail because you’re likely not using Cheetah and are just here to learn how to do the conversion from sequences to Alembic. In short, there’s both and import and an export script for OBJ sequences for Cheetah, created by forum users.

Baking and exporting leaves us with a folder full of OBJs:

Now we need to convert those into one Alembic file. I’ve searched quite a while for a simple way to do this, but I’m afraid there really isn’t one. We have to involve another piece of software, but thankfully it’s free: good old Blender.

Users of Blender have tried to solve this problem in the past, and some of them have had success with slightly abusing the Stop Motion OBJ plugin, though that workaround seems to no longer work in Blender 3.

Enter Barnaba Mikułowski, who graciously provided a plugin-free conversion setup based on a geometry node network in Blender. I’ve very slightly adapted his original file to be a more generic template, and you can download it here (3 MB).

Open the Blender scene (I used Blender 3, so I recommend you do the same). Click to highlight the “Import Sequence Here” collection and enable visibility if required.

Go to File -> Import -> Wavefront (.obj) – don’t use the legacy option

Navigate to your mesh sequence folder and click-shift-select all files that are part of the sequence (make sure the naming produces proper ordering!)

Click import, you should now see all OBJs imported as children of the import collection, in proper order, and rendered in the viewport.

To clean up the viewport, untick the box on the collection object to re-exclude it from the viewport. In the bake network, confirm the input is set to the import collection. Adjust the Blender animation timeline to fit your imported sequence (start and end frames can be set at the top right of the keyframe panel, and FPS can be set in the output properties which can be found behind the printer icon in the vertical icon bar on the right between the viewports and the inspector). Click the play button to preview your animation and check everything’s in order.

Now select (!) only the bake network in the object tree and go to File -> Export -> Alembic (.abc). Change the scene options if required, but make sure Only: Selected Objects is ticked!

Now, the file can be imported into any package that supports Alembic: