Home

Awesome

SMPL to FBX

🤖 Update 2023: Support blender addons.

I can convert motions in SMPL format into FBX files.

Blender addons

Blender addon allows you to load SMPL into Blender without setting up FBX SDK and get the best of Blender's power.

Blender files and part of codes are based on https://smpl.is.tue.mpg.de/.

Install blender addon:

(download zip file from Releases) -> Edit -> Preferences -> Add-ons -> Install -> (select the zip file) -> search smpl -> check the inventory of SMPL: Load SMPL from pickle

https://github.com/softcat477/SMPL-to-FBX/assets/25975988/f212d1ed-d7b7-4481-be14-5866f4172075

Load a smpl file:

See the screen recording.

https://github.com/softcat477/SMPL-to-FBX/assets/25975988/e9405fc4-9748-4d67-9118-9e63e04bd027

Steps

  1. Install Python FBX.
  2. Download the SMPL fbx model for unity. Keep the male model SMPL_m_unityDoubleBlends_lbs_10_scale5_207_v1.0.0.fbx.
  3. pip install -r requirements.txt
  4. Here's the file structure:
    <root>
    |--Convert.py
    |--SmplObject.py
    |--FbxReadWriter.py
    |--<pkl_path>/
    |  |--*.pkl
    |--<fbx_path>/
    |  |--SMPL_m_unityDoubleBlends_lbs_10_scale5_207_v1.0.0.fbx
    |--<output_path>/
    
  5. python3 Convert.py --input_pkl_base <pkl_path> --fbx_source_path <fbx_path>/SMPL_m_unityDoubleBlends_lbs_10_scale5_207_v1.0.0.fbx --output_base <output_path> to start converting.

What's inside the pkl file?

A pkl file contains a dictionary with two keys: smpl_poses and smpl_trans. There's a sample pkl file in ./Pkls/sample.pkl.

Appendix

I got a translation vector [d0, d1, d2] of a frame. How do I assign each dimension to the correct axis?

Follow this order:

Bones

bones=[(0,1), (1,4), (4,7), (7,10), # R leg
       (0,2), (2,5), (5,8), (8,11), # L leg
       (0,3), (3,6), (6,9), # Spine
       (9,12), (12,15), # Head
       (9,13), (13,16), (16,18), (18,20), (20,22), # R arm
       (9,14), (14,17), (17,19), (19,21), (21,23)] # L arm