-
Notifications
You must be signed in to change notification settings - Fork 360
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
Feature Request: SMPL format export #5
Comments
Hi @jaykup1 , You can replace
With |
this is blender addon to opt smpl model here https://github.com/Meshcapade/SMPL_blender_addon |
Not exactly: https://meshcapade.wiki/SMPL Anyway to export with this skeleton layout? (so we can use https://github.com/softcat477/SMPL-to-FBX to convert that to FBX for game engines) |
Definitely going to try out the SMPL to FBX converter later tonight. As a workaround we've had great success simply running the rendered mesh sequence through AI mocap solutions to get game ready rigged animations, Plask, Deepmotion, etc. |
not work! different shape |
The export file has to be rearranged to SMPL skeleton layout before fbx conversion, help would be greatly appreciated. |
I'll try to clarify, please let me know if it helps:
after running
Can you detail here the data structure that the SMPL addon is expecting, and we will try to code an adapter between the two formats (and of course welcome you to send a pull request if you figure it out yourself). Hope this helps, |
Thank you for the reply,
|
Cool! If that's the case, the motion-diffusion-model/utils/rotation_conversions.py Lines 513 to 534 in 14d0f79
motion-diffusion-model/utils/rotation_conversions.py Lines 434 to 447 in 14d0f79
|
So, will there be a script that converts sample##_rep##_smpl_params.npy to FBX or something like that? BTW, awesome project, guys! Thanks a lot for your efforts. |
Does this process add new information? I've been building armatures and animations just from the results.npy manually with some quaternion magic. Would |
@amb very cool! Are you able to share any insight or code snippet as to how you accomplished this? We're getting close but it would help us greatly, no worries either way thx. |
@TREE-Ind Sure, it's just a proof of concept Blender script tho. Here you go: https://gist.github.com/amb/69cc8396bc61cc59a7e819aed6b21f34 |
@amb Wow nice work :D |
nice work! but....... Like you said ,# TODO: Is this really the best way to create armature in Blender? |
@GuyTevet How can I get the 6d out of |
@jaykup1 those are the 6d rotations, but in SMPL convention. You said |
@jaykup1 There is knowledge regarding how to convert SMPL angles to other characters (not in my brain, unfortunately). I suggest contacting the SMPL team or watching their tutorials on youtube. If you manage to resolve this, I will be very happy to know about it! |
@GuyTevet I only get TypeErrors, AttributeErrors (because I don't know what I'm doing), I just reshaped it (reshape(self.real_num_frames, 72), (reshape(self.real_num_frames, 3) to see if it's working. |
The shape of |
Hi |
Thanks for the code. This is amazing! |
@amb |
Conversion of data to .pkl file for 'softcat477/SMPL-to-FBX/' @jjp9624022 @TREE-Ind @Tony2371 @amb @mmdrahmani @alextitonis tell me if there are any problems, thanks |
It works like charm awesome @jaykup1 |
This is cool! Thank you. |
@mmdrahmani use the pkl file with this https://github.com/softcat477/SMPL-to-Fbx Change 'FbxTime.eFrames60's in SMPL-to-FBX/FbxReadWriter.py to 'FbxTime.eFrames30' Known issues: Glitches below 30 fps exports in 'softcat477/SMPL-to-FBX/' (20 fps expected) |
mdm2ue5.mp4Importing motion diffusion animations into UE5 at runtime now thx to the conversion code :D |
you can half the time of export by reducing 'self.num_smplify_iters = 150' in simplify_loc2rot.py to 50. (30 seemed fine), I will probably make a simple gradio gui and push it. |
The conversion code works awesome, thanks! Any suggestion what would be the best approach to bring down the file size of generated .fbx? Quality loss is acceptable till some point, I am just not sure if I should be playing with SMPL parameters or something else. |
Not possible (that I know of), reducing the imported fbx size breaks the animation calculation. If you are using a game engine you can export the animation. In unity engine, animation is ~4 MB (0.3 MB if you zip it). |
@babotrojka Not sure if this will work for your setup but we had good success converting the fbx to gltf while retaining the animation data which reduces the file size substantially. |
Thank again. ['gBR', 'gPO', 'gLO', 'gMH', 'gLH', 'gHO', 'gWA', 'gKR', 'gJS', 'gJB'] Do you have any ideas why I am getting this error? My guess the FBX sdk configuration was not done properly, although I followed the instructions provided. |
The first three lines are the output of these lines For |
@jaykup1 smpl_trans = np.array(trans_raw).reshape(self.real_num_frames, 3)*np.array([100, 1, 100]) How come the y coordinate is only scaled by 1 and not 100? |
I am loading animations into Unreal Engine using the conversion to pkl and SMPL-to-FBX repo. However, I would like to control the relative location of the foot joints to the ground floor in the simulator. I tried to use the coordinates given in results.npy for one animation, according to which the left foot is at a height of 0.388 cm in the first frame (I multiplied the scalars in results.npy by 100). However, when I load the animation into Unreal it looks like this: Where the feet are clearly 8-9 cm above the animations origin (m_avg_root) in it's local coordinate frame. How can I get the accurate local xyz coordinates of the joints in the animations? Did anyone else have a similar issue? |
I resolved the issue by mapping the translation of m_avg_root to m_avg_Pelvis. Fixed by changing motion-diffusion-model.visualize.vis_utils from: And by changing the line in SMPL-to-FBX/FbxReadWriter.py from: |
I made the change you suggested but still see an offset of 20cm in the vertical axis, the foot-ground contact does not exist |
You also have to take into account the lowest joint location in results.npy which may not be at 0. Then load the mesh into Unreal Engine with the lowest joint location offset from the floor height. |
hello. i was wondering the way you import motion-diffusion-model output to Unreal Engine. I am now struggling with retargeting to UE5.0 . If you have a code could you share it or explain it. Thank you for reading. |
I have the same issue, but I don't think I should always adjust the lowest joint location to 0, because some frames may have jumping action (two feet are away from ground). |
I seem to be having the same issue, |
@mmdrahmani @yotaro-shimose I was able to resolve Segfaults as mentioned in this PR. |
@TREE-Ind You mentioned converting fbx to gltf - could you share how you did this? And also, how can we transfer the animation to other meshes?
|
@mmdrahmani @yh675 @jaykup1 @GuyTevet After we get the FBX file, how are you retargetting that motion to other assets like the one shown in the video? |
If I see correctly, this script creates a Blender armature based on positional data from .npy. Then, for every frame it aligns the pose bones of this armature to match the positions of .npy joints. There are three issues with this method:
TL;DR this method is worthless for retargetting/driving other 3D models; it fakes the rotational information.
Blender's FBX export is pretty bad. I wouldn't rely on it. You are better off exporting to .bvh using Blender, then importing this .bvh to some software that can both import .bvh and export .fbx well (for example, Autodesk software, e.g. Motion Builder). That way you are sure your .fbx will work in other software. |
Hi, I am trying to convert MDM model output to fbx files so that I can import them to Unity. I have tried several methods, starting from the npy file I used the smpl2bvh script to get the mocap and then from Blender export it to FBX but I get strange effects as shown here Registrazione.2024-10-23.172800.mp4I assume it is due to the fact that the npy file only contains the positions of the joints frame by frame and not the rotations so when I have more complicated animations where the character has to rotate, turn, etc... it just tries to get the joints to that position. So I tried the repo that you have previously linked i.e. SMPL-TO-FBX. This definitely works better but it is very slow, it takes me at least 3 minutes and also I still have small glitches as you can see here. Registrazione.2024-10-25.095501.mp4So when I have an easy input like “Walk forward”, paradoxically it comes better with the first method, in fact I don't have those little head movements for example and it is much faster. Could you tell me how come I have those problems with the second method? Also, do you have a way to implement the first method by also calculating the rotations but avoiding the SMPLify algorithm which takes a lot of time? Thank you very much in advance |
Exported .npy has SMPL parameters but it would be great if it also get exported as pkl file with SMPL parameters.
The text was updated successfully, but these errors were encountered: