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

bug in jointed cloth animation #3707

Closed
coldgemini opened this issue Mar 26, 2021 · 7 comments
Closed

bug in jointed cloth animation #3707

coldgemini opened this issue Mar 26, 2021 · 7 comments
Assignees
Labels
gltf Specific to glTF support

Comments

@coldgemini
Copy link

coldgemini commented Mar 26, 2021

Describe the bug
The animation results of the attached gltf file are quite different when shown in filament v.s. in babylon.js, with the former being a bit disruptive and the latter quite smooth.
test(1).gltf.zip

Screenshots
From Filament
image
From Babylon.js
image

Filament Version
1.9.10 in vscode plugin
image

Desktop (please complete the following information):

  • OS: macOS
  • Backend: [OpenGL]
    image
@prideout prideout self-assigned this Mar 29, 2021
@prideout prideout added the gltf Specific to glTF support label Mar 29, 2021
@prideout
Copy link
Contributor

@coldgemini I think the zip file is missing a bin file.

@coldgemini
Copy link
Author

I uploaded the glb file.
Thanks.

test(1).glb.zip

@prideout
Copy link
Contributor

Thanks for the bug report, I am able to repro. Maya exports skinning as two separate node hierarchies and we might have a bug in how we deal with this.

As an aside, Three and Babylon have "flashing" issues after the cloth has collapsed, perhaps due to degenerate polygons or depth fighting. Also, you might want to set doubleSided to true.

@prideout
Copy link
Contributor

I checked and we correctly handle all the scenarios tested here, include separate node hierarchies:

https://github.com/KhronosGroup/glTF-Asset-Generator/blob/master/Output/Positive/Animation_Skin/README.md

This might be an issue with the fact that there are 32 nested joint nodes, in theory we support this but I don't think I've tested a model with this many joints.

@flyingonly
Copy link

We think that the problem has nothing to do with the hierarchy. It's caused by the decomposition and composition of the matrix. In the makeBone function, the matrix is decomposed and then composed in the shader. It can be done with the pure transform matrix, however, the bone matrix is not only the transform matrix, but the product of the transform matrix and the inverse bind matrix. And the process may cause the matrix cannot be re-composed, especially when the transform matrix has a scale which differs in each axis, while the inverse bind matrix has a rotation along the axes.
A simple test can be done in filament_test. Add one rotation matrix after the matrix generated by the product. Then the test will not pass.
截屏2021-03-31 下午4 33 22

@prideout
Copy link
Contributor

prideout commented Apr 1, 2021

This is not a gltfio issue, it's a known limitation in Filament itself. We store decomposed transforms for bones because they are more compact than two separate matrices (positions + normals). We implemented this in 2018 via #383.

Therefore we do not support shearing. In general glTF disallows shearing for nodes, although it does not explicitly place restrictions on the skinning matrix.

Shearing matrices can be decomposed into (rotation + non_uniform_scale + rotation).

In this particular case, the finalized bone matrix (which includes the inverse bind matrix, as you mentioned) has shear.

Note that support for non-uniform scale with skinning is a point of contention within the glTF community (see here).

I wonder if you could achieve your desired effect in a different way, e.g. via morphing rather than skinning?

@prideout
Copy link
Contributor

prideout commented Apr 7, 2021

Filament does not support shear in the skinning matrix, closing.

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

No branches or pull requests

3 participants