Open andrew-atef opened 7 months ago
+1
https://github.com/JYuhao88/SMPLerX-Server Here are some features you might find helpful.
I solved this by first converting to AMASS format and then using smplx_blender_addon to export fbx.
def convert_to_amass_npz(npy_path, npz_path):
motion = np.load(npy_path)
motion = torch.tensor(motion).float()
# Extract motion parameters
motion_parms = {
"root_orient": motion[:, :3],
"pose_body": motion[:, 3 : 3 + 63],
"pose_hand": motion[:, 66 : 66 + 90],
"pose_jaw": motion[:, 66 + 90 : 66 + 93],
"trans": motion[:, 309 : 309 + 3],
"betas": motion[:, 312:],
}
# Create amass format data
frame_length = motion.shape[0]
gender = "male"
left_eye_smplhf_and_right_eye_smplhf = np.zeros((frame_length, 2 * 3))
# AMASS JOINTS format
poses = np.concatenate(
(
motion_parms["root_orient"],
motion_parms["pose_body"],
motion_parms["pose_jaw"],
left_eye_smplhf_and_right_eye_smplhf,
motion_parms["pose_hand"],
),
axis=1,
)
trans = motion_parms["trans"]
betas = motion_parms["betas"][0]
# Save data in amass format (NPZ file)
os.makedirs(
os.path.dirname(npz_path), exist_ok=True
) # Create necessary directories
np.savez(
npz_path,
poses=poses,
gender=gender,
mocap_framerate=30,
betas=betas,
trans=trans,
)
2. https://gitlab.tuebingen.mpg.de/jtesch/smplx_blender_addon#installation
How to convert Motion-X files to FBX for 3D animation programs?