Importing rigged/animated 3D models from Blender

  1. I know Slicer has some built-in support to load static polygon meshes, where is it documented what formats? I think I saw mention of STL and OBJ so far
  2. We have a medical device being modelled, with animations, in Blender. As I understand, multiple poses of a skeletally-rigged model. We’ve come across some VTK support from skinned animations (https://www.vtk.org/doc/nightly/html/classvtkWeightedTransformFilter.html seems most likely) but I don’t know what capabilities Slicer has to actually load from this file… writing a bespoke loader would be a pain. Does Slicer support any standard file formats such as FBX?

Slicer Wiki → User Manual → Supported Data Formats

That makes me think of Bender - KitwarePublic a Slicer based project for repositioning voxelized anatomical models.

Note that it is named Bender and not Blender

It applies the rigging, skinning and posing technique to volumes by providing an additional step to resample the volume. It internally uses Cleaver and SOFA.

Part of the Bender project could probably be turn into a Slicer extension.

@lassoan What do you think ?

Yes, I think it would be a good idea to port Bender to an extension.

Thanks for the replies.

If you’re suggesting we actually use Bender instead of Blender for creating
the animations I don’t think this would work. We are working from
supplied polygonal models I think (although it might be solidworks) and I
think need to use industry-standard tools like Blender/3DSMax for modelling
and rigging/animating.

Bender = special build of Slicer with additional modules for animation and physically realistic simulation of tissue deformations.

Bender includes readers for BVH motion capture files and armature files. The armature file format seems to be some VTK-based format, so it would need to be modified to be able to read some other format that Blender/3DSMax can export.

See a couple of videos about what it can do:

While you can do basic rigging and animation in Slicer (Bender), for more sophisticated animations it is probably better to work in Blender or other professional modeler software, export results to files, and import those into Slicer.

There is also an armature exporter Blender plugin in Bender utilities. I think Blender can export motion capture data as .bvh and models as stl or obj. So, I think these may cover all data export/import needs.

I’m unsure… It appears Mo-Cap is exported via BVH but as I understand it,
STL/OBJ only store raw polygon data. Isn’t there a 3rd piece missing, the
actual rigging (armature as you describe it?)

Hey John,

Bender is able to directly read BVH files, so you can import the rigging
(armature) with its pose.

When importing a BVH in Bender, you can choose the frame of the animation
(as demonstrated in this video: https://vimeo.com/90788904#t=1m20s)
or you can manually adjust it from within the Armature module in the
armature pose panel (see the documentation here
https://public.kitware.com/Wiki/Bender/Documentation/2.0/Modules/Armatures)

You can also create (rig) and pose the armature directly from Bender.

Thanks !
Johan

Hi, I’ve maybe misunderstood what data is stored in the BVH file? So not
just the raw motion of points, but the rigging/weighting as well?
We don’t have mo-cap data, can we use BVH as a generic transport for this
sort of data?

And then - how do I get this into Slicer rather than Bender?
I can’t use Bender for the rigging because we want to use the same models
in realtime 3D engines, etc, and these really need to use more standard
formats like PBX… plus our artists will want to stay with familiar tools.

Many thanks.

I’ve checked and .bvh has both armature and motion capture data. Blender has a .bvh exporter, so I guess if you can import something to Blender then you can export it as .bvh and then Bender (=Slicer+extra modules) can use it for creating animations.

@Johan_Andruejol @finetjul Can you confirm?

Yes, BVH has both the rig and the animation information.)
Also, I seem to recall Blender having support for exporting under the BVH
format.

However, BVH import does NOT contain the weight information. You will have
to supply/create that yourself.
Since Bender is aimed toward posing/animating labelmaps,we need a weight
map that is also a labelmap.
That weight map can be created using a few modules:

-This 1-to-1 map can further refined to obtain smooth transition with the
Compute Armature Weight module:
https://public.kitware.com/Wiki/Bender/Documentation/2.0/Modules/ComputeArmatureWeight

In any case, I encourage you to download Bender and try it yourself, it’s
free :slight_smile:
Bender’s Workflow module takes you through all the steps needed to create,
rig and pose a labelmap. This should give you a better idea of what it can
do.

I hope this helps,
Johan

Thanks Johan. Since we’re talking about animating a 3D model rather than
medical dataset, not being able to import the weightings sounds like a
problem to me. That’s surely one of the key things an animator/modeller
would do, making them do it twice seems a bad idea.

I think I’ll ask the animator to peruse this thread in case we’re talking
at cross-purposes, though I think the terminology might be slightly
different anyhow.