Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I get the skeleton for re-targeting from a fbx file? #40

Closed
Robokan opened this issue Apr 20, 2023 · 2 comments
Closed

How can I get the skeleton for re-targeting from a fbx file? #40

Robokan opened this issue Apr 20, 2023 · 2 comments

Comments

@Robokan
Copy link

Robokan commented Apr 20, 2023

I just want to thank you for publishing the source code to this amazing paper!

I have a fbx file with 2 frames of animation both have the the skeleton in tpose. I am trying to get a tpose for retargeting from the fbx file so I tried:

fbx_file = "/home/bizon/Documents/to_ase/MM_T_Pose.FBX"

motion = SkeletonMotion.from_fbx(
fbx_file_path=fbx_file,
root_joint="pelvis",
fps=60
)

skeleton_fbx = motion.skeleton_tree
zero_pose_fbx = SkeletonState.zero_pose(skeleton_fbx)

plot_skeleton_state(zero_pose_fbx)

The result is a mangled skeleton.

if try:
plot_skeleton_motion_interactive(motion)

I get a perfect skeleton. So I know the fbx file is good. What is the right way to get the Skeleton in tpose?

other observations:
If I print the sample Skeleton loaded from cmu_tpose.npy and the Skeleton loaded from 07_01_cmu.fbx. They are identical (other than local_translation). What's different is the SkeletonState on each. So I am assuming I am missing some kind of transform that needs to be done. I wonder, how was the cmu_tpose.npy originally created from the fbx file? That answer is probably the solution.

@Robokan
Copy link
Author

Robokan commented Apr 22, 2023

I figured out the solution. Assuming the tpose is the first frame of the animation in a FBX file (which it is in the CMU animations) then this will get the tpose from the first frame and save it for use in retargeting. To use this on some other motion capture file just get some animation with a tpose in it and then grab the frame and save it.

fbx_file = "data/07_01_cmu.fbx"

motion = SkeletonMotion.from_fbx(
fbx_file_path=fbx_file,
root_joint="Hips",
fps=60
)

tpose = SkeletonState.zero_pose(motion.skeleton_tree)

first_frame = motion.tensor[0, :]
tpose.tensor = first_frame
tpose.to_file("data/custom/cmu_tpose_test.npy")

plot_skeleton_state(tpose)

@Robokan Robokan closed this as completed Apr 22, 2023
@xbpeng
Copy link
Collaborator

xbpeng commented Apr 22, 2023

glad you figured it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants