Jump to content

gltf,glb and left- handed system


satguru
 Share

Recommended Posts

I see that the babylonjs loader does not convert the glb or gltf meshes from right-handed system (their native format) to left handed system.

Instead it seems it parents them with "__root__"  nodes to handle them in a left handed system.

Is it not possible to convert them entirely to left handed-system?

Link to comment
Share on other sites

@satguru The loader does not currently convert the data from right-handed to left-handed. It is computationally expensive to do this. glTF is intended to be a runtime format, so it is intended to load fast. You have two choices with the loader. Either continue with the "__root__" transform that flips the z scale or change the coordinate system of BabylonJS to right-handed. Do you have a scenario that requires the data to be converted?

Link to comment
Share on other sites

@bghgary __root__ and a scaling of -z doesn't seem right.  A quick way to bring gltf to babylonjs perhaps but not sure if it is a good long term solution. It makes gltf feel like a special case. People will have to take special care to handle it. They will have to remember that in babylonjs each gltf mesh comes with am extra parent node of __root__. Every time they scale they would need to make sure scale in z is -ve. Rotation around z would be counterclockwise  , baking seems to be an issue and so on. A gltf mesh will feel different from other babylonjs meshes. Not a good idea if we want to make gltf native to babylonjs.

Link to comment
Share on other sites

Quote

How expensive can it get?

The cost is iterating through every single float of positions, normals, tangents, indices, etc. Depending on the model, it can be quite expensive. It certainly does not scale well.

Quote

Also what about an offline converter?

This isn't possible. glTF is expected to use right-handed data. If you are going to convert offline, might as well convert to a .babylon file.

Link to comment
Share on other sites

1) won't we have to iterate through each of the elements anyway, to move them from gltf data structure to babylon data structure? Or is the gltf data structure so similar to the babylon data structure that that won't be an issue?

2) by offline I did mean creating a .babylon file :)

3) not sure about making the option off by default. In a right handed scene I am assuming we won't be adding a "__root__" node. So by default in right handed scene the meshes would show up without "__root__". Whereas, if the default is off, then by default in a left handed scene meshes will show up with "__root__" node. Potential for confusion? 

 

Link to comment
Share on other sites

3) One of the reason I was advocating converting to left handed system was to avoid adding extraneous nodes.
In other words keep things as close as possible to the original.
We don't want users scratching their head wondering "from where  did this node come from?  I didn't have this in my gltf file".

So I was thinking that there should be  something like a "fast-left-handed-load" option which should be off by default.
That option would come with the caveat that if the user turns it on then they would get faster load time but at the cost of having to deal with an extra nodes called "__root__" and  -ve scaling.

Link to comment
Share on other sites

  • 5 years later...

Hi there! Was this ever elaborated? Would be a great non-default option to convert the coordinate system of the loaded assets.

Usecase: Upload .glb to a private server -> import .glb into a scene -> convert it to left handed -> export as .babylon -> provide on server -> use .babylon-asset in different scenes.

This way the expensiveness would be "hidden" in the upload/conversion process. Wouldn't even need to be a loader option. Just a "apply(bake)-glb-transforms" or something like that.

 

I tried to do the conversion myself in code, and it seems possible, but unfortunately I'm not that experienced yet. Going to proceed in this direction if you say this is never going to be an option. Any help or pointing in the right direction would be much appreciated as well in this case.

Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...