Handling particle shader compilation lag in Godot 4 web (compatibility renderer)

Godot Version



I’m working on a Godot 4 project using the Mobile renderer, however the web exports use the Compatibility renderer. I am running into an issue I also had using Godot 3 where there is a lag spike when firing each type of GPUParticles2D for the first time. I am getting around it using a solution that I used in Godot 3 where I fire all particles for one frame at the start of each scene.

Is there a better way to do this, or does Godot 4 have a way to handle this for the Compatibility renderer? The shader cache project settings don’t seem to work on the web, and they don’t seem to provide a way to precompile shaders.

The approach you should use to combat shader compilation stutter in Godot 4 is the same as in Godot 3: Show all effects behind a solid wall or sprite for 1 frame when the game loads.

Other approaches like ubershaders have been tried in Godot 3.x, but they were disabled in web exports because of bugs in browsers’ WebGL support. They also didn’t fully resolve shader compilation stutter, only reduce it.


Thank you very much for the response!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.