MackeyK24

GLTF Importer De-Parenting Skinned Meshes

Recommended Posts

Yp @Deltakosh and @bghgary 

There seems to be a BUG in the GLTF importers... I have a hierarchy like this:

- Remy-Master (Parent)

--- Body (Child)

--- Bottoms (Child)

--- Eyes (Child)

--- Hair (Child)

--- Shoes (Child)

--- Tops (Child)

--- mixamorig:Hips (Child, Skeleton)

But when i look at the scene all the SKINNED MESHES (Body, Bottoms, Eyes, Hair, Shoes, Tops) are DE-PARENTED and in the root of the scene instead of being under Remy-Master.

That must be a BUG... Here is a screen shot of the scene:

931984634_ScreenShot2018-11-10at2_19_38AM.thumb.png.c8b50d6ea42194901b5e614afd74e8aa.png

 

Note: My GLTF json DOES have the 7 other nodes defined as children (and it works right in other viewers😞

 

 "nodes": [
    {
      "children": [
        1,
        2,
        3,
        4,
        5,
        72,
        73
      ],
      "rotation": [
        0.0,
        1.0,
        0.0,
        0.0
      ],
      "name": "Remy-Master",
    }
]

 

 

Share this post


Link to post
Share on other sites

I imagine it would do the same thing with any Skinned meshes that are children of a master mesh.

But here is my Remy-Master

Note: Is kinda big... Has a bunch for blendshapes and 17MB worth of textures

Yo @bghgary ... Hey Gary... I finally GOT THE WHOLE GLTF Export Pipeline... Take a look at Remy.

1... Picture prefect PBR Material Export

2... Animations (Including Skeletal Animations)

3... Blendshapes (Including Morph Animations)

4... GLB Binary Containers (Which includes ALL external scene assets)

5... And so much more... Like Navmeshes, Lightmaps, Terrains (Including Splatmaps)

I tell you... That took a minute to get right. All the Unity type GLTF exporters (Even the one you made for reference) does not really work right and does not export the all the major stuff... Mainly Skeletal Animations... That was a bitch to get right.

 

Share this post


Link to post
Share on other sites

This is done intentionally to satisfy the requirements for the glTF spec. See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note).

Quote

Implementation Note: 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 below, the translation of node_0 and the scale of node_1 are applied while the translation of node_3 and rotation of node_4 are ignored.

The code is here: https://github.com/BabylonJS/Babylon.js/blob/master/loaders/src/glTF/2.0/babylon.glTFLoader.ts#L564

Is this causing a specific problem for you?

Share this post


Link to post
Share on other sites
On ‎11‎/‎10‎/‎2018 at 10:29 PM, MackeyK24 said:

That took a minute to get right. All the Unity type GLTF exporters (Even the one you made for reference) does not really work right and does not export the all the major stuff... Mainly Skeletal Animations...

Skinning always take a bit to get right. I'm glad you figured it out!

Share this post


Link to post
Share on other sites
1 minute ago, MackeyK24 said:

I need to move Remy-Master as the parent .... body, shoes, etc should be children of Remy-Master

But why? Are you searching for them by path or something?

Share this post


Link to post
Share on other sites

I’m using the gltf as a scene file... could have many root transform node... not just a single character model... and yes I get Remy-Master by name and move around using my Third Person Controller ... but in Babylon the body etc are parented to the root Babylon node and not Remy-master or whatever the main character model name is... this one is Called Remy-Master

Share this post


Link to post
Share on other sites
26 minutes ago, MackeyK24 said:

I get Remy-Master by name and move around using my Third Person Controller

The expected behavior in glTF is that transforms (parent and self) of skinned nodes are ignored. If you want to move the skeleton around, you need to move the root of the skeleton hierarchy and not the skinned node. This is the same behavior in Unity.

Share this post


Link to post
Share on other sites

The moving around of nodes and ignoring transforms is just for glTF and for the loader. Once the loading is done, you can move the skinned mesh.

https://playground.babylonjs.com/#KDITCT#1

But in your case, since you have a whole scene and multiple roots to move. I don't have a good solution. Can you file an issue for this? I'll think of something.

Share this post


Link to post
Share on other sites

I have discussed this with the team and I can make a fix that will create a container transform node that will hold all the skinned meshes with the same glTF skeleton property. Moving this transform node will move all the skinned meshes under it.

Share this post


Link to post
Share on other sites
2 minutes ago, MackeyK24 said:

Why not just use the original parent node. 

There can be a non-identity transform on the original parent node which should not be applied to the skinned mesh. If there are meshes attached as children of this node, then I must split the hierarchy as the skinned mesh should not have the transform applied but the child meshes should.

I can add a flag, but I rather not have options for how the hierarchy is constructed. It might cause some confusion.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.