sueda / fbx-extract

Extracts data from an fbx file
MIT License
42 stars 4 forks source link
animation fbx fbx-extract mixamo skinning

fbx-extract

This program parses an FBX file and writes six types of output files.

  1. An OBJ file of the mesh
  2. An ASCII file with skinning information
  3. An ASCII file with the skeletal animation information
  4. Texture files
  5. An ASCII file with the input information
  6. Four ASCII files with the local transforms for each joint in skeletal animation information

The input FBX file can be downloaded from Mixamo.

Authors:

Building and running

This project builds on top of the following projects:

To build the project, run cmake and make, and then run with the FBX file as an argument:

> mkdir build
> cd build
> cmake ..
> make
> ./fbx-extract ../data/bigvegas_Walking.fbx

Output files

Geometry

Skinning weights

4583 82 9
1 20 1.000000 
1 20 1.000000 
2 19 0.037664 20 0.962336 

Skeletal animation

27 82
0.000000 0.000000 0.000000 1.000000 0.000000 96.330055 9.825774 ...
0.008630 0.039924 0.024404 0.998867 0.657645 87.535782 2.391427 ...

Textures

Input file

Local transforms

  1. *_static_transforms.txt contains the static transforms between the joints.
    • The first line contains the number of joints.
    • Each line next contains 8 matrices: T Roff Rp Rpre Rpost Soff Sp S.
    • Each matrix has 7 numbers: 4 for quaternion (x, y, z, w) and 3 for position (x, y, z), so that each line has 7 * 8 = 56 numbers.
83
0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 ...
0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 ...
0.000000 0.000000 0.000000 1.000000 18.735231 -5.666687 -4.541196 ...
  1. *_skel_local.txt contains the Euler angles of local transformation for each joint in each frame.
    • The first line has two integers: frameCount and boneCount, which are the same as the skeletal animation file.
    • Each subsequent line is a frame with boneCount sets of Euler angles.
    • The rotation order of the Euler angles is stored in the next file.
    • The root joint contains Euler angles and positions, while all other joints contain just Euler angles. There will be 3 + 3 * boneCount numbers on each line.
27 83
0.019251 0.079420 0.049618 0.657645 87.535782 2.391427 ...
0.016953 0.083084 0.038091 0.214333 87.434326 2.976235 ...
  1. *_hierarchy.txt contains the parent-child hierarchy for each joint in each frame.
    • The first line contains the number of joints.
    • Each subsequent line is in the form of <JOINT INDEX> <PARENT INDEX> <ROTATION ORDER> <JOINT NAME>
    • If a joint has -1 as its parent index, then it is the root joint.
83
0 -1 EULER_XYZ newVegas:Hips
1 0 EULER_XYZ newVegas:Pelvis
  1. _binding_pose_local.txt contains the Euler angle of local transformation for each joint of the binding pose.
    • It has the same format as the _skel_local.txt file.
27 83
0.000000 0.000000 0.000000 0.000000 96.330055 9.825774...

TODO