After spending more than a year working on a raymarched project in three.js, I've noticed that as the complexity of the project has increased, so has the initialization time. It now takes over 40 seconds to load the project in the browser, but once loaded, it runs smoothly at +60fps. Through performance tests, I have identified the InitMaterial function within three's library as the culprit for this delay. Could anyone shed some light on what might be causing this issue? My hunch is that it could be related to the numerous uniforms we use in the shader.
You can access the relevant code here. Please note that the globalsinclude.glsl file contains the list of uniforms being used.