Multi-Materials Cause Strange GLB Export Artifacts

Hello! After upgrading from BabylonJS 7.32.5 to 8.27.1, I began experiencing a bug around the glb/glTF exporter. This bug was only made evident to me when I attempted to render glbs exported from Babylon which contain meshes with multi-materials in Blender’s Cycles.

I’ve put together a playground for generating example glbs.

The mesh sphere in the Babylon scene appears like this in all tested versions (6.49.0, 7.54.2, 8.28.0).

But when the resulting GLB is rendered in Cycles, I get the following results.

6.49.0 With Materials (Seems correct to me. I think visual differences can be explained by the different rendering contexts.)

6.49.0 Without Materials (Again, seems fine)

7.54.2 With Materials. Here we can see missing pieces of the mesh. Seems like maybe one of the submeshes just didn’t get included in the export. Additionally, we see strange artifacts in the upper part of the mesh. Seems maybe like overlapping geometry. Maybe the ‘missing submesh’ here is actually just in the wrong place?

7.54.2 Without Materials. This just makes the artifacts at the top more visible.

I also tested version 8.28.0 to see if this issue has since been resolved already, but the results are identical to those of 7.54.2.

Is this a known issue or is there maybe some new requirement in handling multi-materials in glb exports that I am unfamiliar with? Any information here would be greatly appreciated. Thank you in advance!

cc @alexchuber

Thanks for the report! Will take a look.

1 Like

Here’s a fix:

3 Likes

Thanks very much! Are we still waiting on @bghgary to review before this can make it into a release?

Thanks for checking in. Yes, this is just waiting on a final review. He has a ton on his plate right now, so to help speed things along, I’ll go back and simplify the PR today. I lumped in the fix with some extras that don’t technically break your case :slight_smile:

1 Like

Thank you so much!

1 Like

Sorry for the delay. @alexchuber Ping me offline and we will get your changes merged ASAP.

2 Likes

Spinning up a patch release now that will include the fixes. Should be published shortly. Thanks for your patience :slight_smile: