-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Importing Animation to Identical Rig Breaks It #71525
Comments
Let me know how to improve your experience of Godot Engine |
I wouldn't consider this "retargeting" as it's the same model and all I'm doing is importing all animations into one AnimationPlayer to be played back. This is something other engines have no problem doing without the need of spending the time creating a profile of some sort. I see "retargeting" as when I have two distinct rigs and I'm trying to adapt an animation to work on a rig it wasn't made for. This isn't the case here. It should all be drag and drop and seamless since the only thing different is the scene. |
Both Panda3D and Unity don't suffer from this issue when importing a base model and separate animation files. They must have some sort of normalization going on under the hood to make it work. Models were created in Maya and exported with maya2glTF. |
@fire @lyuma After sharing this with a friend who has a ton of experience in Panda3D, he thinks the issue is due to how Godot creates a unique armature for each glTF file. Godot needs a way to import just the animation data from a glTF file without generating a new armature. The base file should define the armature and subsequent animation files should provide the data that moves that armature. |
@xMakerx if it works in Unity, would it be possible to share the Unity scenes, along with the imported model files and animation, including .meta? (You can do this with Export Package of the .unity, .anim / controller and .fbx/.glb or just right click the whole folder NOTE: When making the package, make sure to uncheck include dependencies to avoid inadvertently packaging up a bunch of unrelated script files.) Seeing how it is set up in Unity such that it works will be helpful for me to understand where the Godot import workflow is breaking.
That is how Godot already works, In fact, there's a dropdown in the import that says "Import As" and you can choose AnimationLibrary. But you're running into trouble for some reason: the animation data from both files are like speaking different languages. A 30 degree rotation on one is different than a 30 degree rotation on the other. So I'm trying to figure out why. The Unity project could hold the key. |
For some animation systems, this may not be a problem if the animation file only takes out the difference in its rotation. In Godot, there is currently a realtime retarget custom module fot handling that case, and I guess that sharing these animations will work well if it can be applied without a SkeletonProfile (or you adopt your model with SkeletonProfile ). But currently there are no plans to do so yet. If you do not use that module nor reatarget-system, you will need to match the edit bone rotation in blender if the two models have different edit bone rotations in blender, as mentions above. Edit bone rotation is a value automatically calculated from the Head-Tail positional relationship and Roll value. You can easily check it with the this add-on. If you are using Maya, Maya has Local Rotation Axes like the concept of rest in Godot, but since Maya does not output rest as a glTF, some retargeting may be needed externally if you want to share the animation output from it. @reduz is more knowledgeable about Maya. |
@lyuma I was able to get this working in Unity using their Legacy animation system. So, I didn't have to worry about creating an avatar profile or anything like that. I've attached the Unity package for you to look at as well. I wanted to add that taking the .FBX files and using Godot's official fbx2gltf converter to get the files imported into Godot does not fix this problem. I tried making the animation file import as an Animation Library as suggested to no avail. This is a problem with how Godot is treating these files. @TokageItLab @fire |
Thanks for the Unity (.fbx) testcase. Here is my progress report so far... I can see that the FBX versions of the models play fine in Unity, as do versions converted using FBX2glTF. I was also able to reproduce the same problem you saw in Godot by playing the animation from your attached glTF file, onto a converted FBX in Unity, manually replacing the conflicting bone names with colons (I may have messed this up, since I did this part by hand): But... now is the more interesting thing I discovered. I used FBX2glTF to convert models into .glb format. The animation here is called "Take 001": So there is probably a bug in Godot here. As another testcase, I made two more glb files which work fine in Godot, Unity and windows 3D Viewer: Here's the test project with all 4 glb files in it (and one more copy named _neutral_anim.glb set to import as AnimationLibrary. Anyway, so far it still seems like a Godot bug, but I will need to continue investigating. Now that we have working and non-working examples in the same project, it might be easier to compare and see what's different between them. |
Addresses issues where an animation glTF file has an animation track with only one keyframe. Fixes godotengine#71525 As a side-effect, this could cause many unwanted position, rotation and scale tracks.
Sorry I didn't reply sooner. We did determine the issue. The fact that swapping out the node hierarchy from one file with the other proved to be a key clue in uncovering the cause. So the issue is that there is an animation track affecting the node "root". This animation track has one keyframe, which sets the root node to a rotation of (0°, 0°, 6.3°) The thing is, due to the default export settings from the DCC tool used (in this case, maya. but I'm pretty sure blender would do the same thing), gltf models are posed in the first frame of its animation when exporting. Here are the screenshots showing the issue. Here is how the FBX Unity project shows up. See how many unnecessary position, rotation and scale tracks there are. But here you can see we do have the 6.3 degree rotation about Z: And finally, here is the "fixed" Godot build with my new PR #72007 So next step is to review the PR and understand the implications. Thanks once again so much for the report, the extensive testcase, and for providing the working Unity project. I think all of this detail has given me and @fire a complete understanding of the cause and a proposed fix. |
I appreciate the update! I wanted to ask what the Optimize Animation option does if the default behavior is to strip tracks. Maybe this functionality should be available but under the Optimization options? Instead of a single checkbox maybe there's different optimization levels? I think by default, the Engine should recreate the input verbatim. Optimization should be a choice later on. Animations have been the biggest headache for me in Godot, so this is actually incredible news that you and @fire figured out the issue. Thank thank thank you! I will be eagerly awaiting the official release with this included. |
Godot version
4.0.beta12.mono.official [3c9bf4b]
System information
Windows 11, RTX 2060 SUPER, Forward+
Issue description
This is the result when I import an animation I saved on an identical model in a different scene.
Here is what the animation looks like in the scene where the animation is saved.
I have a model with animations broken up into separate glTF files. Each file has an identical setup except for a differing animation. My expectation is that when I import an animation saved from within another scene, I expect the animation to work the same as it does in the scene that saved it. This is NOT the case, and, as you'll see, when I import the animation into the animation library of the base model I get a "slanted" result.
Steps to reproduce
How to Reproduce w/Reproduction Project
Minimal reproduction project
ReproductionProject.zip
NOTE: YOU DO NOT NEED THE MATERIALS OR THE SCRIPT TO REPRODUCE THIS ISSUE. IGNORE ANY DEPENDENCY ISSUES
The text was updated successfully, but these errors were encountered: