-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Skeleton3D has bone indexes unpredictably shuffled around when importing GLTF #61641
Comments
Can you provide any type of example project that demonstrates this? It worked in our test cases https://github.com/godotengine/godot-tests/tree/master/tests/gltf_skeleton_tests when we were developing this. |
Also, can you try specifically Blender 3.2, the unreleased version? |
I think this is a problem with Blender's glTF exporter. Can you post glTF diffs? |
It seems exporting from this version does keep the bone indexes stable and essentially fixes the problem... although it has created its own set of problems, such as some bones being strangely twisted. I wonder if that is something I have to fix myself in the scene. I'll investigate further when I have some more time. |
Please try to contact the gltf blender team. https://github.com/KhronosGroup/glTF-Blender-IO/issues @julienduroure |
Upon further inspection and testing, it seems Blender 3.2 is in fact twisting the bones strangely on export, it even gets twisted when re-importing the GLB into Blender. I'll try to open an issue over there. However I still find it kinda curious that Godot 3.x imports a Blender 3.1 GLB with consistent bone indexes every time, while they get all messy in Godot 4.0 with the same files... |
@antourenein For Blender issue, please open a ticket here [1] with your test file. Thanks! [1] : https://github.com/KhronosGroup/glTF-Blender-IO/issues |
One thought that comes to mind is the possibility that the sorting algorithm has changed in Godot4. I don't know if this is true or not, but if the bone indexes are ordered by hierarchical and use unstable sort (https://en.wikipedia.org/wiki/Stable_sort), it is possible that they could be randomized between some bones which have same hierarchy on import. But I still recommend that you output gltf instead of glb and see how its contents change with the Blender output with opening it on text editor or something. So far, this issue lacks information to determine if it is a Blender bug or a Godot bug. |
If you open Previously, we changed to use BoneName instead of BoneIdx in some Class to solve this problem, but it still looks unstable. And I am planning to discontinue it in #61596. I can think of an alternative solution to this: after building the BoneTree in Impoter, reorder the items by BoneName and reassign the BoneIdx, which will generate a same BoneIdx regardless of the order of the nodes, unless the number of bones or bone names change. However, as a side effect, the order of the tree on gltf is different from the order of the tree in Godot; Since the parent BoneIdx is also reassigned when reassigning, the parent-child relationship is not different, but the order of the siblings is different. For example, the little finger may be listed before the thumb in Enum. Except for that problem, we can stabilize the imported BoneIdx. However, that is just a compromise and might be better implemented as an option. After all, this is due to the problem of "unstable order of glTF Nodes output from Blender", so I think the right way is to solve that in Blender. How do you think @fire? |
Fixed in KhronosGroup/glTF-Blender-IO#1659 |
I tried out exporting the scene from a new daily build of Blender 3.2 RC and it seems all problems relating to bone indexes really have gone away, as well as the strange twisting of bones! Thanks for looking into it! |
This bug is fixed on Blender side since June, this ticket can be closed! |
Sounds good. Can close any time. |
Godot version
4.0 alpha 9
System information
Windows 10, Vulkan, NVIDIA GTX 850M
Issue description
Every time a new GLTF scene containing a complex character skeleton is exported from Blender and then imported into Godot, the bone indexes are shuffled around and cause unpredictable animation and skeleton modification behaviors, requiring me to manually re-add the model to the player scene and change the modified bone indexes in the SkeletonModificationStack3D in order to fix the problems.
Note 1: This happens even if I do not modify anything in the Blender scene. I just need to export to a new glb file and Godot shuffles the indexes and ordering around when importing. The imported scene may stay the same if I re-export it in the same Blender session, but if I just close Blender, open it again and then try to re-export the scene, it is already unpredictable.
Note 2: This does not happen in the 3.x branch of Godot. The bone indexes and ordering are preserved as expected.
How the scene cointaning the model looks when everything is in place:
Godot_v4.0-alpha9_win64_YioWlQkj0C.mp4
How the scene containing the model looks after just closing and opening Blender and re-exporting the model without any modifications in the blender scene:
Godot_v4.0-alpha9_win64_egxaRG3UNP.mp4
(This is random, I never know what kind of crazy shape the character will take in the next export)
Steps to reproduce
Create a character with a complex armature in Blender (in this case, I used rigify and only exported deformation bones), export it to glb, add the model to a scene and set up the scene. Then try closing Blender, opening it again, and re-exporting the character to the same file and watch the scene that contains the model break with bone ordering issues.
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: