Hi,
I am loading around 40 glb files from an external source at runtime.
Each of these files includes meshes as well as some textures (albedo, metallic and some have others also).
The loaded models are cloned to multiple instances with GPU instancing.
Whenever an asset is rendered for the first time, there is a visible stutter in rendering.
As far as my research goes, there could be two reasons.
a) pushing the texture data from CPU to GPU blocks rendering
b) there are shaders being compiled for each loaded glb
How can I identify wich one of those causes the stuttering?
I am trying to minimize the stuttering, and here are my different approaches.
-
If the problem is shader compilation, can i use
GraphicsDevice.asyncShaderCompilation
?
Found here, butGraphicsDevice.asyncShaderCompilation
returns undefined when testing, so i assume it is not implemented? -
After loading all glbs, I dumped shaders with
pc.app.graphicsDevice.programLib.dumpPrograms();
and then include the resulting js into the project. That made no difference -
I assume the resulting materials created after loading a glb are Standardmaterials. If so, would it make sense to skip shader compilation entirely and use a new StandardMaterial and assign the textures coming with the glb?
-
Kind of a shot in the dark, but is there a way to load the model first with a default material and then, in an async way populate with textures once the new material ready?
I found kind of a similar thread here, that’s where i found dumpPrograms()