Hi! recently I started to use Graphics.DrawMeshInstanced in my WebGL game, because there are scenes with 10k+ objects that need to be rendered. This helped a lot to improve the FPS, but sadly added another issue.
Now it takes ~20 seconds to load a scene where Graphics.DrawMeshInstanced is used because the first call to this function requires the shaders to warm up. The next time the scene is loaded, it loads almost instantly.
This is kind of unbearable, especially in multiplayer, where other players will have to wait for a single-player until he loads the scene.
Things I have tried:
- Using a shader variant collection, and adding it to the preload shader list in Graphics. This, of course, solved the problem of slow scene loading, but now the game took really a lot of time to load (>1 minute, although the shader variant contained only a single shader and a single variant).
- Calling Shader.WarmupAllShaders on game start. I waited 10+ minutes, but the game still did not load, but that was expected, there are 600+ shader variants.
Is it possible to somehow speed up the shader warm-up time in WebGL? Iām using Unity 2019.03.0f1