[Bf-committers] Alembic Import Documentation
Cordell George Bloor
cgbloor at ucalgary.ca
Sat Nov 23 01:36:32 CET 2019
I work with a number of scientists doing physical simulations and Blender has been an enormous help in making our work look great. Since Alembic import seems to be undergoing active development, I thought I'd share my experience.
The first approach I took to importing my simulation results into Blender was to spit out OBJ or PLY files for each frame. Export was super easy to implement, even without third-party libraries. However, I found that import was very inefficient. One minute of my simulation was 3600 PLY files (~5GB), and my naive importer script ran for hours before crashing due to running out of memory. One of my colleagues began writing a script that loaded and rendered each frame separately to spread the work out, but I began investigating Alembic.
It took me a while to successfully create an Alembic file that Blender (2.79) would accept. The Alembic library has a rather complicated interface itself, but it essentially has you build and serialize a scene graph. Once I figured out how to write a basic Alembic file, I discovered that Blender has a number of expectations for the structure of that graph and for properties set on its nodes. Ultimately, I ended up looking through the Blender importer source code to figure out what those expectations were. I did that in February, so I don't remember all the requirements, but it was stuff like that the root object of the Alembic archive should be an Xform.
Once I got it working, Alembic import was fantastic. It was fast and the imported data was simple to use. The only hard part was at the beginning, when I needed to figure out how to write an acceptable Alembic file. It would help a lot to add some documentation on that subject.
I created a minimal version of my Alembic exporter<https://github.com/cgmb/alembic-example/blob/master/main.cxx> to document the process for others in my lab. That's probably not useful to you folks, but if I'm doing anything silly in there, I would love to know!
Thanks for making such a great tool.
More information about the Bf-committers