SceneLoader Load Material Bug When SceneFilename Is ArrayBufferView

Hi, I ported 3dtiles-threejs to Babylonjs, I use this function to import multi Mesh to BBL:

I find all materials are the same:

I download ArrayBufferView from b3dms as glb and check them in sandbox, their material are correct created:

If sceneFilename is string

If sceneFilename is ArrayBufferView

cc @srzerbetto, it seems that when passing an array buffer, the texture created for the first ImportMesh is reused for all other imports (look at the textures, they are all identical in the array buffer case, whereas they are different when each .glb file is loaded separately).

1 Like

Iā€™m taking a look at it.

1 Like

Hello @Moriy , how are you doing? Sorry for the longe delay on this.

There is a problem with how we currently handle texture cache for models loaded using ArrayBufferView, currently there is a caching mechanism that is based on the provided URL and the texture name. Since we have no name information coming from the ArrayBufferView that uniquely identifies the texture, the cache system considers all textures to be the same.

I will be discussing with the team a possible solution to this, but for now what you can do is provide a unique value for each rootURL, it does not need to be a valid URL since it will only be used to create a entry in the cache and nothing else in the ArrayBufferView case (see example bellow):

ImportMesh Bug | Babylon.js Playground (

I will keep this post updated once we have a final solution for this problem.


We have a fix for that merged into Babylon.js master, it should be included in the next Babylon.js release (probably 6.48.0)