Glb export and usdz conversion


I have a problem when I’m exporting a scene with multiple objects into glb using “BABYLON.GLTF2Export.GLBAsync()”. Basically, the downloaded .glb file looks as intended when i view it in babylon sandbox, but something strange happens when i convert to .usdz. I’ve used different usdz converters, and with all of them the meshes look like they have textures/materials on the inside of the mesh.
Should look like this:
But instead looks like this:

I’ve tried changing parameters of the materials and textures in the exported glb e.g. backfaceCulling, twoSidedLighting, mesh.sideOrientation and none seemed to fix the problem.
The only thing that made any difference was if I set scene.useRightHandedSystem to true. In this case, at least the correct side of the mash has textures, but the UV mapping is then messed up:

Any Ideas on how to fix this?

Did you try to convert other GLB files, for example sample models - glTF-Sample-Models/2.0 at master · KhronosGroup/glTF-Sample-Models · GitHub ?
Maybe there is a problem in your converters?

Yes, for example glTF-Sample-Models/2.0/IridescenceLamp/glTF-Binary/IridescenceLamp.glb
This one converts okay.

A bit more context: Initially, the models I’m trying to export had many different materials, which sometimes had the same name. This meant that when I exported to GLB, some textures would be copied to parts of the model where they shouldn’t be. I then renamed all textures and materials to have unique names. After I did that, textures would no longer be copied to incorrect meshes, but the above described issue appeared.

Could you create a repro in Playground to have a look what is happening on?

renameMaterials is the function in question … if you compare the exports with or without renaming, you can see the difference.

What are the converters you used?

I used Apple’s reality converter, the automatic conversion in modelviewer (requires usdz, but tries to convert on its own if you pass it only a glb file) and some free online converters.

1 Like

I guess you should post the issue on the converters side as nothing we do in Babylon might help workaround it ?

1 Like

I used this converter GitHub - Schlomoh/usdz-converter: Python gltf to usdz converter using docker image plattar/xrutils
And it seemed to solve the problem. There’s still some issues with the final look of the usdz model but the side orientation and UV mapping is correct.
Still, seems strange to me that Reality converter isn’t able to convert correctly…

Yup, you should definitely let them know.