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

Node and skinning matrices #1035

Closed
xelatihy opened this issue Jul 8, 2017 · 8 comments
Closed

Node and skinning matrices #1035

xelatihy opened this issue Jul 8, 2017 · 8 comments

Comments

@xelatihy
Copy link
Contributor

xelatihy commented Jul 8, 2017

The spec is not clear on two main items.

  1. How to compute nodes' final node transforms
  2. How to compute final skin joint transforms

In particular,

a. Since nodes can refer to each other in any manner, are the final world transforms unique for each node? Or can a node have two different world transform as it is references by say two different scenes?
b. Is a node a root node always or it depends on the skin?
c. For skinning, how are the world transforms for each joint computed, given the corresponding nodes transforms? There should really be a formula for this in the spec.

Have been debug skinning for a long time now and can get the glTF 2.0 examples to work.
Are those supposed to be following the spec?

@lexaknyazev
Copy link
Member

Since nodes can refer to each other in any manner, are the final world transforms unique for each node? Or can a node have two different world transform as it is references by say two different scenes?

Node hierarchy is a strict tree (each node can have only one parent, nodes can't form cycles). Scenes can list only root nodes.

@xelatihy
Copy link
Contributor Author

xelatihy commented Jul 8, 2017

Ok, that makes sense. What about skinning matrices? Is there documentation on exactly how to compute them. We cannot get the skinning examples to work so we wonder whether we have the right math for them.

@javagl
Copy link
Contributor

javagl commented Jul 10, 2017

Surprisingly, the spec here refers to the glTF-Overview, where I tried to cover this in some detail, based on my implementation for glTF 1.0. The most relevant part should be this...

skinning

Although it refers to glTF 1.0, there should not have changed much for glTF 2.0, except for the bindShapeMatrix being omitted (or being the identity matrix, for that matter), because it is supposed to be pre-multiplied into the geometry.

The update of the overview (and the implementation) are still in progress. It would be good to know if there are any other changes, because I'm afraid that I won't be able to finish the implementation before the overview is due, leaving this uncanny feeling of not being sure whether the statements and computation in the overview are really correct....

@xelatihy
Copy link
Contributor Author

I have implemented following the overview image. For some examples in the glTF Sample models I do not get the same results. The problem appears to be that the skinning matrices are incorrect. And that could be a concern as to whether the skinning matrices are either model or world space.
There is no explanation anywhere on how to treat those, so either my code is bogus on some cases (very possible) or the matrices are not following the overview image for the examples in the model repository.

@javagl
Copy link
Contributor

javagl commented May 10, 2019

The computation of the joint matrices indeed did not change much between glTF 1.0 and 2.0, so the image linked above still reflects what is also shown in the latest release of the overview, except for the bindShapeMatrix, which is now assumed to already be either multiplied into the geometry or into the inverse bind matrices.

Beyond that, skinning is indeed a bit tricky, with some potential for misunderstandings and implementation bugs. A discussion about implementation alternatives was in #1397 - it is a bit extensive and math-heavy at some points, but might bring some insights.

There is also an issue collecting Skinning use cases and examples which may be starting point, at least for testing own implementations.

If there are more specific questions, feel free to either ask them here, or create a dedicated new issue for the question. Specifically, if you have an implementation that "does not work", then showing some code or screenshots of the result might help. To test the implementation, you could use one of the sample models (RiggedFigure or CesiumMan so that we know what the result should look like.

(The task to update/create a really minimal "SimpleSkin" example as a follow-up to #1558 is still on my TODO list. Until then, the glTF that is posted there already is a complete (embedded) glTF, and supposed to work in common viewers with the fix that was proposed in the issue discussion)

@javagl
Copy link
Contributor

javagl commented Dec 17, 2019

@xelatihy Any updates here? (Specifically: Can this issue be closed?)

Strongly related: #1504 and #1630 . Maybe we can converge and figure out where the spec has to be updated or extended.

(BTW: I have added a PR for the SimpleSkin example at KhronosGroup/glTF-Sample-Models#243 - maybe that's a helpful test case, although it still has to be reviewed...)

@scurest
Copy link

scurest commented Dec 18, 2019

The spec still does not contain any formula for how skinning should work.

@lexaknyazev
Copy link
Member

The nodes and skinning sections were clarified in the AsciiDoc spec release to address the OP questions.

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

6 participants