Hey,
As mentioned in PlayCanvas’ optimization guidelines, reducing the number of shaders in use is one of several considerations with respect to performance. It also mentions that too many shaders can lead to “glitches in framerate”. I am currently working on a project where I suspect we have some performance issues related to this.
Anyone have any experience with what number of shaders is usually okay, and what is too much?
There is prob a big difference between what phones and computers can handle?
One question: The post talkes a bit about runtime performance related to having to compile new shaders on-the-fly, but do you know how much it impacts runtime performance otherwise? Say if you have a very static scene where no new shaders are introduced, will still say as many as 50 unique shaders, have a significant impact on FPS?
That depends on the work needed to be done by the shader per pixel. The more complicated the shader on a material, the more work has to be done per pixel that the material takes up on the screen.
The number of unique shaders shouldn’t be an issue after compiling. @mvaligursky or @Gustav_Sterbrant could explain more here.
To get an idea of how many shaders are compiled, and what the cost is, you can enabled this at start-up: pc.Tracing.set(pc.TRACEID_SHADER_COMPILE, true);