assetContainer.instantiateModelsToScene not works as expected with thinInstances

Hello everyone,

Recently, I ran into a small issue while using assetContainer. Here’s what happened:

My colleague created a glb model using Blender, and some of the meshes in this model use thin instances. I need to add this model to the scene multiple times.

I used LoadAssetContainerAsync to import the glb file into an assetContainer, and then used assetContainer.instantiateModelsToScene to create multiple instances. However, I noticed that for the meshes that originally used thin instances, only the base mesh was retained after instantiation [the thin instances themselves were missing].

It’s not convenient for me to share the actual model file, but I have reproduced this issue in a Playground (pg):

I think it’s probably the same issue regarding thininstanceCount as in instantiateModelsToScene for assetContainer.

Solution for clone:

3 Likes

You were right. When I directly set entries.rootNodes[0].thinInstanceCount = originBox.thinInstanceCount;, I got the correct result, see:

1 Like

This solution seems to only address the problem within the Playground, but that might not be enough for my situation.

I’m currently building a 3D editing tool based on BabylonJS, and I anticipate having more users upload their own models in the future. Iterating through all thinInstances to set the thinInstanceCount after every instantiateModelsToScene call isn’t an ideal solution.

Additionally, I noticed in the issue thread above that a PR was apparently submitted to fix this. However, looking at the current results, it still appears to be problematic. Is this a new bug?