godotengine / FBX2glTF

A command-line tool for the conversion of 3D model assets on the FBX file format to the glTF file format.
Other
311 stars 73 forks source link

Reset to the first animation in the stack #42

Open lyuma opened 1 year ago

lyuma commented 1 year ago

FBX files may contain multiple AnimationStack objects, in which the first is expected to be used as a rest pose. This is the case in kenney's assets at https://kenney.nl/assets/series:Animated%20Characters

I have verified that other FBX implementations take the ordering of AnimationStack into account and use the first item to determine the rest pose. However, the way the code here is written, it may leave it on the last animation rather than the first.

lyuma commented 1 year ago

This does not solve the issue: This change would have to be coupled with passing the first frame timestamp into EvaluateLocalTransform(), rather than the default (infinity) which ignores the animation tracks.

If we go forward with this change, it would then require changing the animation code to use this computed base transform as the baseTransform/Translation/Rotation/Scaling, rather than the result of EvaluateLocalTransform(infinity)

Somehow Unity seems to have this behavior of using the pose of the first frame of the first animation, but it's not clear to me why this is the correct approach.

I'll mark this as a draft for now. If anyone can test Kenney's assets in other FBX software (such as Unreal, Maya, etc.) and see which put the model into a T-pose rest pose and which don't.

In terms of a Godot workflow, another option is to make this a manual step of the Godot advanced importer, and choose an animation frame to be copied from there.

fire commented 1 year ago

I don’t think think we have a plan for resolving this. So I’m trending on closing the pr in a few weeks.