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

(Maybe) a difference of DCCs causes compatibility problems of glTF animation. #685

Closed
emadurandal opened this issue Aug 18, 2016 · 13 comments

Comments

@emadurandal
Copy link
Contributor

emadurandal commented Aug 18, 2016

Hi.

I achieved glTF Skinning Animation using my WebGL library at last.
https://cdn.gitcdn.link/cdn/emadurandal/GLBoost/69d12ff60434dd95f06e59ba9745a81b38483aa6/examples/index.html#standalone/loading_gltf_skinning_anim�

Then I tried other official models, but sadly, they became nightmare dragons.
nightmare

Thus far, You may think that my library is still immature (or not robust).
But, the problem is a little bit complicated.

I think Cesium.js library has the most accurate and fully functional (and official?) glTF Loader.
Then I tried that with my test glTF file.
But, the result is confusing me.
nightmare2

My library can handle the test glTF file properly. So It's not always true that my library’s implementation is wrong.
I use Maya to create my glTF skinning models, and the official glTF animation models seem to be made by Blender.
I think that these confusing results are caused by a difference of DCCs (and their exporters), and my library (GLBoost) and Cesium.js could be optimized for their different data habits.
To diffuse the use of glTF, I feel these compatibility problems need to be resolved.

Sorry for this vague issue. But I desire to help to diffuse glTF format.
I need to ask for your cooperation.

My skinning model Maya file is here. Feel free to use this for testing.
lady.zip

@emadurandal
Copy link
Contributor Author

I'm sure it's not a skinning problem. It must be a bone animation problem.

@pjcozzi
Copy link
Member

pjcozzi commented Aug 18, 2016

@lexaknyazev has been looking at skinning a lot recently for the 1.0.1 spec. @lexaknyazev any chance you have a minute to check out this model and see if anything jumps out as being wrong compared to the Cesium man model?

@pjcozzi
Copy link
Member

pjcozzi commented Aug 18, 2016

@emadurandal also:

@pjcozzi
Copy link
Member

pjcozzi commented Aug 18, 2016

@emadurandal I also noticed that PBR is on the GLBoost roadmap, feel free to chime in on #643.

@emadurandal
Copy link
Contributor Author

@pjcozzi Let me know if you need more information or files for this issue.

can I list it in the glTF repo since you are adding glTF support?

Yes, of course. I appreciate it! 😄 I'll also check #643.

@lexaknyazev
Copy link
Member

The first thing that jumps out is

"skeletons": [
    "_koshi",
    "_koshi_L_ashi_tsukene",
    "_koshi_L_ashi_tsukene_L_hiza",
    "_koshi_L_ashi_tsukene_L_hiza_L_ashi",
    "_koshi_R_ashi_tsukene",
    "_koshi_R_ashi_tsukene_R_hiza",
    "_koshi_R_ashi_tsukene_R_hiza_R_ashi",
    "_koshi_sakotsu",
    "_koshi_sakotsu_L_kata",
    "_koshi_sakotsu_L_kata_L_kurubushi",
    "_koshi_sakotsu_L_kata_L_kurubushi_L_te",
    "_koshi_sakotsu_R_kata",
    "_koshi_sakotsu_R_kata_R_kurubushi",
    "_koshi_sakotsu_R_kata_R_kurubushi_R_te",
    "_koshi_sakotsu_neck",
    "_koshi_sakotsu_neck_atama"
],

skeletons should contain only root nodes of skeleton hierarchies.

@javagl
Copy link
Contributor

javagl commented Aug 24, 2016

It's hard to guess from the screenshots what might be wrong there. So just minor remarks/guesses:

  1. The screenshots reminded me of the ones in http://stackoverflow.com/q/7595982/3182664 . There, the reason was a missing matrix transpose. However, this can hardly be the actual reason here: The error/difference does not seem to be directly related to the glTF files themself. I just checked both, the lady and the cesium man...
    animatedlady01
    ...and they seem to work (apart from some "twitching" of the lady at the beginning/end of the animation - this might be a bug somewhere else, maybe remotely related to Animation loop behavior #573 )
  2. Could this be caused by something as trivial as a wrong transform for the root node (basically a wrong bindShapeMatrix: The viewer assumes an identity transform, and doesn't take the actual transform into account)?
  3. The lady.gltf passes the validation (as lexaknyazev most likely already tried out)

@emadurandal
Copy link
Contributor Author

@javagl Thank you for the testing.

Could this be caused by something as trivial as a wrong transform for the root node (basically a wrong bindShapeMatrix: The viewer assumes an identity transform, and doesn't take the actual transform into account)?

Yes. My GLBoost library ignores bindShapeMatrix since I have no idea to use this property for. (Someone please teach me 😢 )

I tried jgltf-browser on my Mac a couple of minutes ago. But the build steps failed.
Will you please tell me the stable revision?

@javagl
Copy link
Contributor

javagl commented Aug 28, 2016

The bindShapeMatrix has to be the rightmost factor when computing the jointMatrix:

jointMatrix(j) = 
    globalTransformOfNode^-1 *
    globalTransformOfJointNode *
    inverseBindMatrix(j) *
    bindShapeMatrix

Regarding the jgltf-browser: I'll review the build later today / tomorrow (If this does not bring insights, or you think it's a general problem, we can handle this with an issue in JglTF, if you provide more details)

@emadurandal
Copy link
Contributor Author

@javagl wow, That's what I really needed. Thank you!
Also, I've never noticed gltfOverview-0.2.0.png.
The computing the joint matrices are written up in the png image.

I regret missing the overview. My GLBoost's computing takes a different approach in my own way without those correct information.
But, It's mysterious that my library can handle animations properly (for only my created data).

Regarding the jgltf-browser: I'll review the build later today / tomorrow (If this does not bring insights, or you think it's a general problem, we can handle this with an issue in JglTF, if you provide more details)

My two friends and I failed the build. If you don't mind, I'd like to make an issue.

@javagl
Copy link
Contributor

javagl commented Aug 28, 2016

To avoid "hijacking" this issue with otherwise unrelated topics, I opened a new issue for the build problems: javagl/JglTF#2

But, It's mysterious that my library can handle animations properly (for only my created data).

The bindShapeMatrix was only a guess. I thought that it might be only a minor issue, because the models are in both cases at least still "recognizable", and not completely messed up (although I wonder what the actual animation looks like). For the CesiumMan, the bindShapeMatrix is the identity, whereas for the Lady, it contains a scaling- and translation component. One could now just try out what happens when this is replaced by the identity (i.e. whether it then renders properly in Cesium), but of course, a review-based (less "trial and error") approach would be preferable.

@pjcozzi
Copy link
Member

pjcozzi commented Aug 29, 2016

@javagl @lexaknyazev thanks so much for helping @emadurandal with this.

@emadurandal can we close this?

@emadurandal
Copy link
Contributor Author

I very appreciate your cooperation @pjcozzi @lexaknyazev and @javagl . Thank you!

Although there are still some mysteries (what @lexaknyazev commented, and why Cesium.js can't handle my glTF animation data.), I prefer not to disturb you all any longer.

@pjcozzi please close this if you have no concerns. Finally, Thank you again for listing my GLBoost library in the glTF repo. My library is still immature, but I'll continually work to develop it to live up to the name on the list.

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

4 participants