GLTF exporter breaking up single mesh into multiple meshes

I have a single mesh in Blender that’s made up of 191k verts, 375k triangles.
hierarchy

As you can see, the fender area is all one unified piece

However, when exporting, the GLTFExporter breaks it up into 4 separate meshes in a pretty arbitrary fashion (I assigned a different color to see the separation):


You can see in the .gltf file, I’m getting 4 pimitives instead of just one, (each one has its own individual POSITION, NORMAL, and TEXCOORD_0 attribute):

I’m getting awful aliasing where these meshes meet, and it’s taking 4 drawcalls to render what should be done in a single drawcall:

Why is this happening? Is there a GLTF limit to the buffer size? How can I get the exporter to output all in one mesh, instead of a bunch of smaller ones?

Happy to say that updating GLTFExporter from 2.81 release to the newer 2.82 release solved this issue. The new exporter comes built in with the new Blender 2.82. The mesh is now exported as a single primitive as expected, and drawn in a single drawcall.

Was this just an exporter bug?

This was an exporter bug. See: See https://github.com/KhronosGroup/glTF-Blender-IO/issues/777.

There are some other edge cases where a single mesh in Blender would be split in glTF or three.js – for example, a single mesh in Blender could have many materials. That would come into threejs as multiple THREE.Mesh instances — GLTFLoader does not create multi-material meshes, and they don’t save draw calls anyway.

2 Likes

Nice find! I was about halfway done reading the GLTF spec trying to find where it specifies an index limit, when I realized a new exporter version had come out. :smile:

I’m having this same issue in Blender 2.81 and 2.9. I have an fbx coming in from Maya to Blender with UV’s. The fbx imports to Blender with no edges cut. When I export the fbx as a GLTF and reimport it into Blender, the mesh now has the edges cut wherever there are UV seams. I feel like this is happening on import. I say that because I tried exporting a GLTF from Substance Painter and importing it into Blender and the same thing happened. The mesh consists of 555 verts so I don’t thing it’s the same issue people were having with the 16 bit to 32 bit conversion. Is there something I’m missing in the settings?

glTF is a runtime format, and represents data the way it will be rendered on the GPU. In that context, a single vertex cannot have two UV values, and must be split if it represents a UV seam. So, this is expected.

1 Like

Hi @donmccurdy. That makes sense. Thanks for the reply.