Skip to content

Conversation

kishoreVen
Copy link
Contributor

@kishoreVen kishoreVen commented Mar 3, 2023

Exporting IGL Assets from Blender

Context

I created a deformable mesh with a skeleton and it's corresponding skinning weights in blender. However, I wasn't able to find any tooling to export libigl compatible assets.

Solution

So I created this script to export

  • obj that exports mesh compatible with libigl's read_obj function
  • tgf that exports skeleton hierarchy compatible with libigl's read_tgf function
  • dmat that exports skinning weights compatible with libigl's read_dmat function

How to Use

  1. In the scripting tab of the Blender layout, load the blender_script_export.py
    Screenshot from 2023-03-02 20-45-51

  2. Select the parent Armature in the scene inspector of the editor
    Screenshot from 2023-03-02 23-14-05

Key Notes:
a. The armature used for rigging needs to match the name of the parent selected for export.
b. It's best to set the highest level bone of the armature as "root". If you intend to use a different name, update this line in the script.
Screenshot from 2023-03-02 23-15-29
c. You can optionally control what to export in the settings on the top right
Screenshot from 2023-03-04 23-29-27

  1. Provide a path with an asset name on where to export the file. You do not need to provide any extension. Navigate straight to the folder and provide an asset name like shown.
  2. Hit "Export" and the script should do the rest.
    Screenshot from 2023-03-02 20-52-37

Debugging

I dump out a blender_igl_export.log file to ~/Documents/. This should provide a good set of progress, errors or warnings.

Remaining Questions

  1. Is this script even needed for other folks?
  2. If answer to 1. is yes, then is this the right location for the script?
  3. Any further optimizations needed?

Proof of life

  1. Loading the cylinder from blender using libigl. The image also shows the root bone's skin paint.
    Screenshot from 2023-03-04 23-31-16

Here is what it looks like in blender
Screenshot from 2023-03-04 23-33-21

  1. Comparing the animation loaded from dmat vs animation loaded as npy
    Screenshot from 2023-03-04 23-27-23

  2. Comparing frame 31 of animation in igl vs blender (in order)
    Screenshot from 2023-03-05 00-09-13

Here is what it looks like in blender
Screenshot from 2023-03-05 00-08-53

@alecjacobson
Copy link
Contributor

This is really cool. I'm going to merge, but I wonder if this is the best place for this? I don't think this is going to get included in the pypi distribution as part of the bindings, right?

@alecjacobson alecjacobson merged commit ce1fc67 into libigl:main Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants