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

Importer does not ignore transform of skinned mesh #368

Closed
Vega-KH opened this issue Mar 18, 2019 · 4 comments
Closed

Importer does not ignore transform of skinned mesh #368

Vega-KH opened this issue Mar 18, 2019 · 4 comments
Labels
importer This involves or affects the import process

Comments

@Vega-KH
Copy link

Vega-KH commented Mar 18, 2019

On import, if multiple nodes / meshes share a skin, the transform matrix and TRS are ignored on all except the first. For example, if the GLTF json code is like this:

{
     "name": "node_0",
     "mesh": 0,
     "rotation": [ 0.0, 1.0, 0.0, 0.0 ],
     "skin": 0
 }
{
     "name": "node_1",
     "mesh": 1,
     "rotation": [ 0.0, 1.0, 0.0, 0.0 ],
     "skin": 0
 }

Then the first node (in this case, node_0) will have the rotation added on import, but the second will not. This causes incorrect skinning.

@julienduroure
Copy link
Collaborator

Hello,

Can you please provide a complete glTF or glb file that have this issue?

Thanks

@julienduroure julienduroure added the importer This involves or affects the import process label Mar 18, 2019
@donmccurdy
Copy link
Contributor

This sounds like a possible mistake on the part of the exporter... from the glTF spec:

Client implementations should apply only the transform of the skeleton root node to the skinned mesh while ignoring the transform of the skinned mesh node.

In the example above, I don't think either of the rotations should be applied. See KhronosGroup/glTF#1285 and KhronosGroup/glTF#1403.

@Vega-KH
Copy link
Author

Vega-KH commented Mar 19, 2019

I can provide a sample where this is a problem, but I think with the note above by @donmccurdy , the problem may instead be with applying any transform and with the exporter (not Blender, in this case.) I will verify this is an issue tomorrow and post an example.

Also, with this limitation in mind, it seems that the exporter may need to ensure that all transforms are applied to skinned meshes before export, or there will be unexpected results.

Thanks for the replies.

@Vega-KH
Copy link
Author

Vega-KH commented Mar 19, 2019

OK, now that I have learned that the transform SHOULD be ignored on skinned meshes, I am revising the issue. The problem is that the importer does NOT ignore the transform on the first skinned mesh attached to a skin (strangely, it does ignore it on all subsequent skinned meshes attached to the same skin.)

When viewing with Microsoft 3D viewer, this is how it looks (correct) with the transform ignored on the skinned mesh:

rig-test-3

When importing it into Blender, this is how it looks (incorrect) as the transform is not ignored:

rig-test-3-blender

Here is the offending bit of JSON:

{
            "mesh" : 0,
            "name" : "Cube",
            "rotation" : [
                0.5,
                0.5,
                0.5,
                0.5
            ],
            "skin" : 0,
            "translation" : [
                0,
                1,
                0
            ]
        },

And here is the test file:

rig-test-3.zip

@Vega-KH Vega-KH changed the title Import ignores matrix / TRS when multiple meshes on same skin Importer does not ignore transform of skinned mesh Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
importer This involves or affects the import process
Projects
None yet
Development

No branches or pull requests

3 participants