I have bunch of GLBs loaded already which I need to clone at runtime for some reason. But whenever I am using InstantiateModelsToScene(), my game literally freezes for half to one second. any suggestion you have to solve this issue? I never used web worker. Just got to know about the concept today, can it help? thanks.
total run time was 1400 milliseconds and this function is eating up 435 ms out of that. the function call starts from bottom and it goes up till markAllSubMeshesAsDirt().
I’ve seen a similar performance issue with the glTF loader. Can you try this?
// Block the marking of materials dirty until the scene is loaded.
const oldBlockMaterialDirtyMechanism = scene.blockMaterialDirtyMechanism;
scene.blockMaterialDirtyMechanism = true;
call InstantiateModelsToScene
// Restore the blocking of material dirty.
this._babylonScene.blockMaterialDirtyMechanism = oldBlockMaterialDirtyMechanism;
If this works, we maybe should add it to the InstantiateModelsToScene function itself.