Skip to content
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

Animations for bones with non-uniform-scale rest pose have artifacts #49010

Closed
lyuma opened this issue May 23, 2021 · 3 comments
Closed

Animations for bones with non-uniform-scale rest pose have artifacts #49010

lyuma opened this issue May 23, 2021 · 3 comments

Comments

@lyuma
Copy link
Contributor

lyuma commented May 23, 2021

Godot version:
4.0.dev 45d3b96

OS/device including version:
Windows 10.0.19041.985

Issue description:
Animations have visual artifacts when rotating non-uniformly scaled bones

Here is the animation within Godot:
When played in Godot
The artifacts are the result of a desperate attempt to counteract the non-uniform scale: it requires stretching hundreds of units locally just to move a little bit.

Same animation when played in https://gltf-viewer.donmccurdy.com/
Played in Don McCurty's glTF viewer

One possible fix is to deconstruct the non-uniform-scale component and perhaps multiply it into the child nodes. However, this could affect the hierarchy of existing glTF files so could be compatibility breaking for 3.x

Steps to reproduce:

  1. Load the attached project.
  2. It should play the animation automatically. if not, enable editable children on the GLB file and play the animation.

Minimal reproduction project:
gltf_non_uniform_bone_animation.zip

@fire
Copy link
Member

fire commented May 24, 2021

Deconstruct the non-uniform-scale component and multiply it into the child nodes.

https://github.com/iimachines/Maya2glTF/blob/master/LICENSE

https://github.com/iimachines/Maya2glTF/blob/3d7ba8eaf03ea15afe0720129db88deba7f8749a/src/PolarDecomposition.c#L621-L637

From lox

<Lox> Polar decomposition turns a 3x3 real matrix M into M = R * S with R being a rotation matrix and S being a scale matrix (not necessary uniform or diagonal, i.e. the scale axes can be different to XYZ). This decomposition is unique.

Equivalent you can always turn a 3x3 matrix M into M = R1 * D * R2 with R1,R2 being rotation matrices and D being a diagonal matrix (i.e. S part in TRS). This decomposition isn't unique.

@TechnoPorg
Copy link
Contributor

On current master, the animation looks the same for me as it does in the online glTF viewer. This was probably fixed by #53765, which improved support for non-uniform scaling,

@lyuma
Copy link
Contributor Author

lyuma commented Feb 8, 2022

Thanks for testing and confirming this is fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants