useful tools for motion data processing, related to SMPL, BVH, FBX, etc.
python==3.11
pip install -r requirements.txtfollow the motionGPT to prepare the smpl model, you should set them as the following structure.
📦deps ┗ 📂smpl ┃ ┗ 📂smpl_models ┃ ┃ ┣ 📂smpl ┃ ┃ ┃ ┣ 📜readme.txt ┃ ┃ ┃ ┣ 📜SMPL_FEMALE.pkl ┃ ┃ ┃ ┣ 📜SMPL_MALE.pkl ┃ ┃ ┃ ┗ 📜SMPL_NEUTRAL.pkl ┃ ┃ ┣ 📜gmm_08.pkl ┃ ┃ ┣ 📜neutral_smpl_mean_params.h5 ┃ ┃ ┣ 📜smpl.faces ┃ ┃ ┣ 📜smpl.tar.gz ┃ ┃ ┣ 📜smplx_parts_segm.pkl ┃ ┃ ┗ 📜SMPL_downsample_index.pkl
if your mocap data is noisy, you can use Kalman_Filter to smooth the data.
this way is notice: the data should be transfor to SMPL joints.
python ./tools/Kalman_Filter.pymodify the setting in joints2bvh.py, then run the script.
python joints2bvh.pybased on animationGPT for this part.
this part comes form motionGPT
python -m Smplify3D.fit --dir YOUR_JOINTS_FOLDER --save_folder DIR_TO_SAVE --cuda 0this will fit joints to smply, and generate the SMPLPose.pkl which is for bvh; and generate mesh.npy in the same folder in YOUR_JOINTS_FOLDER, which is for render;
python -m HyberIK.fit -- dir YOUR_JOINTS_FOLDER --save_folder DIR_TO_SAVE --cuda 0once you get the SMPLPose.pkl, you can use the following script to generate bvh file.
python smpl2bvh.py --gender MALE --poses ${PATH_TO_Y0UR_INPUT} --fps 60 --output ${PATH_TO_SAVE} --mirroryou can find more details on this smpl2bvh
Smplify3D(left) and HyberIK(right)
you need to install blender at first
Path_to_your_blender -b --python ./tools/bvh2fbx.py -- --BVHF BVH_FOLDER_PATH [--FBXF FBX_FOLDER_PATH]you can use fbx in unity and UE to make animation now :) enjoy it.
thanks for their great work.

