Thin Instances of a GLB?

I have been trying to get Thin Instances working on a GLB with multiple sub-meshes that are coming in with it and am failing miserably.

Anyone with any ideas?

I think @phaselock might have solved nearly all of this, he linked this PG earlier in my thread: which I need to sit down and study more carefully.

Yeah thats a .babylon and it file and might be a little different then doing it with a GLB because of the root node and handiness of the model

Could you provide a repro PG? The gltf importer does not create meshes with sub-meshes (mesh.subMeshes.length always 1).

There was a problem in the bounding box computation of thin instances. I have corrected it but not made the PR yet.

To bypass the problem, just flag your mesh as being always visible and not culled by the frustum (alwaysSelectAsActiveMesh = true).

1 Like

OOOOOhh, ill check out if that works and if so Ill make a PG to show it.
Thanks as always buddy!

The PR to fix the bounding box computation of thin instances:

1 Like

Was this ever sorted out for GLB files because I have been trying all day and am also failing miserably?

Could you provide a repro of the problem?

Ok, so I kind of got it to work, but not as smoothly as I was hoping. Even though the GLB was a single object in Maya, it used two different materials so the exported GLB came in as two separate objects.

I tried doing a mesh merge and multimat to force them back in to one mesh and then thin instance, but that did not work. I ended up having to just use the matrix data on each separate part. I’m sure there must be a better way.

The thing is that you have a (100, 100, 100) scale on the parent node of your two meshes.

The merging process will apply this scale to the vertex coordinates, as it applies the world matrix transform to the vertices before baking them.

So, when creating thin instances for this mesh, you should take into account this factor 100 in the translation values:

Note that in the end you will still have two draw calls, as the merged mesh has two sub-meshes.


Thanks for the heads up with that. The scaling issue would’ve eluded me for a bit for sure!