Open cgordon5025 opened 8 months ago
To help us narrow this down, do you see the same issue when running gltfjsx with a higher precision? The default is 3 decimals precision in node position/rotation/scale, which could be an issue. There's an option for this in the gltfjsx GUI, or the --precision
flag in the CLI. I think the CLI is generally more up-to-date than the web GUI.
Further when I export within Blender, I see immediately that the Fox and Dog models have the same deformation that appear in the gltf file...
I'm not sure I understood this part, do you mean you see the deformation in Blender after export, unrelated to gltfjsx? I'm testing in Blender 4.0 and not seeing the deformation there so far.
Seems your rigs are using BBone, that can not be exported in glTF. This can explain deformation issue in any glTF viewer.
Note that Blender now have the requested API to convert BBone to multiple bones. But the work still to be done to manage it correctly at export is huge, and not planned for now.
I'm not sure I understood this part, do you mean you see the deformation in Blender after export, unrelated to gltfjsx? I'm testing in Blender 4.0 and not seeing the deformation there so far. @donmccurdy
Thought I had resolved it by updating my blender to 4.0, things were working yesterday and now this morning it broke once again. Yes, both the gltf file and Blender have deformed bones after the export occurs. This morning I had to make a quick adjustment to the scene, and when I exported it once more the bones deformed again
Seems your rigs are using BBone, that can not be exported in glTF. This can explain deformation issue in any glTF viewer.
Note that Blender now have the requested API to convert BBone to multiple bones. But the work still to be done to manage it correctly at export is huge, and not planned for now. @julienduroure I used rigify to create the rig. I am fairly new to Blender. Is there any way I can remove/change this without restarting the rig? Or a way to convert it myself before exporting?
@julienduroure Another question, if it is the bendy bones why are the two other rigged models in this file work/retain their structure, while the two quadrupeds lose it?
If you want me to investigate more deeply, can you please create a new .blend file with only the dog and a single action for it, where we can see the deformation the best, and indicate what part is deformed.
As far as I can see, there is not so much BBone deformation on owl and crab (even if there is some BBones).
But there are for the dog (on the neck for example):
@julienduroure Sure I can provide that. What is odd, is that I made a demo version of this file with only one animal, and it exported without problem. I have since updated to Blender 4.0, but the issue is still persisting. I am noticing it is only the front paws of both the fox and dog (quadrupeds) that are affected, would changing the bone type for that segment resolve this, though in an unorthodox manner? DogCustomRig.zip
In the main file, where I see the deformation occur is on the front two paws on the joint just above the foot, identified as the foot_front_heel, in the model you can see its near perpendicular to the xy axis, but when I export to gltf it becomes more parallel to the xy axis.
This deformation occurs on the neutral pose of the models, so it affects every animation they use
Sorry, but I am not able to understand clearly what your problem is.
Is your blend file changed after export, or is the issue can be viewed in an external viewer? Please make some screenshots that show the issue.
Is it some bone/joint rotation issue, or the problem come from geometry/mesh issue? There is no "foot_front_heel" in your file. Do you mean "front_foot_heel_ik.R/L" ?
Does your DogCustomRig shows the issue, or only the main file myProject ?
@julienduroure my Blender file is changed after export AND the deformation is viewed in the final destination. When using a GLTF viewer (https://gltf.pmnd.rs/) the issue does not show itself.
It seems to be a bone rotation issue, that after executing the export front_foot_heel)ik.R/L changes its orientation. Because the rig is parent to the model, the model deforms due to the front_foot_heel_ik.R/L changing orientation/rotation.
CustomDogRig was showing no issues when I tried to export it. The issue is only in the main file (myProject)
Below are photos of the model in three different environments In blender (before exporting)
In GLTF Viewer
In ReactProject and Blender after exporting
Seems I am not able to reproduce
Before Export :
Pose
Rest
After Export:
Pose
Rest
@julienduroure This is correct, however noce you convert this to jsx and using gltfjsx, you will see that the animations are all deformed. the strangest part is that the neutral poses are correct, but once you apply the animation it does not work any more.
Attached is the sandbox I have been using to test my animations in a React project
@cgordon5025 is it possible to observe the deformation in any of these viewers?
If not, I think it may be necessary to report an issue at https://github.com/pmndrs/gltfjsx/. This exporter aims to produce a valid and visually-correct glTF file. Generating a JSX template from that is an additional process with its own complexities.
@donmccurdy Yes, in the first link provided, https://gltf-viewer.donmccurdy.com/
You can see that the dog, when in idle/rest position that the legs are proper and not deformed, but when activating the animation, the rig becomes deformed
See attached video.
The legs are also with this shape in Blender before export , when using this action DogHeadNod
@julienduroure In my blender file they are not like that, let me send another playground.zip
I have noticed that if it is not deformed before exporting, it will become deformed, but then you are able to undo w/ control-z
I can reproduce with this new .blend file Investigation in progress
I opened a discussion here about the Blender API to reset bones to rest pose (that is root of the issue):
Some bones are locked and have non default values (MCH-front_foot_parent.L for example). During switch between actions, to avoid unexpected issue when some channels are keyed on an action, but not in another, we reset bone matrices. This reset make all matrices Identity. But because of non default locked bone, this is not the behavior we get when using Clear Transforms (alt+G/R/S).
You can workaround that (if all your channels are keyed) by disable this option: Reset Bones between actions
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
Expected behavior When exporting my scene with animated models, I expect that the models retain their structure and integrity as I see it in the blender GUI.
Screenshots Expected Behavior (screenshot taken in Blender):
Actual Behavior (screenshot taken in React Project):
myProject.zip
Version
Additional context Add any other context about the problem here. I am using the polmandres GLTF to JSX converter to render this, when using their provided GLTF viewer (https://gltf.pmnd.rs/) the models looks correct, yet in the project they are warped. Further when I export within Blender, I see immediately that the Fox and Dog models have the same deformation that appear in the gltf file. If I click undo, they are 'fixed', but the gltf remains warped.