How to preload mesh/materials so that there isn't stutter when a model enters the camera view?

That’s odd. I did something similar and didn’t see any shaders being compiled. This is a probably a bug if you have compileMaterials already set on the glTF loader.

I had several use cases where I would adjust material properties after loading the GLTFs which would trigger a shader recompilation, which I wanted to perform in advance. And I could do the same thing for creating meshes dynamically, for example via BABYLON.MeshBuilder.CreatePlane.

Ahh, if you modify the material after load, then that’s different. You may consider calling material.forceCompilationAsync instead of Mesh.isReady.

1 Like