Git Product home page Git Product logo

smpl-to-fbx's Introduction

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

install-addons.mov

Load a smpl file:

See the screen recording.

open-ui.mov

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.

  • Dict["smpl_poses"] : A (N, 72) ndarray, where N is the frame number.
    • Joint order:
      0:Pelves
      1:L hip
      2:R hip"
      3:Spine1"
      4:L_Knee"
      5:R_Knee"
      6:Spine2"
      7:L_Ankle"
      8:R_Ankle"
      9:Spine3"
      10:L_Foot"
      11:R_Foot"
      12:Neck"
      13:L_Collar"
      14:R_Collar"
      15:Head"
      16:L_Shoulder"
      17:R_Shoulder"
      18:L_Elbow"
      19:R_Elbow"
      20:L_Wrist"
      21:R_Wrist"
      22:L_Hand"
      23:R_Hand"
      
    • 72 is from 24joints*3; 3 is the dimension for the rotation vector of each joint.
  • Dict["smpl_trans"]: A (N, 3) ndarray. The translation of the Pelvis in each frame.
  • Basically following the AIST++ naming rule. The code is designed specifically to convert the AIST++ dance motions into fbx files.

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

smpl-to-fbx's People

Contributors

softcat477 avatar tree-ind avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.