Hello,
I’m currently doing an Engine Upgrade of a project and upgraded it all the way from 4.27 to 5.5.3. As part of the upgrade, I am investigating performance changes and observing different Stats from the StatSystem.
One thing that stood out to me, is that the “Shader Count” from Stat Shaders has increased from ~3500 in 4.27 to ~32400 in 5.5.
What could be some of the reasons for this dramatic increase and how can I investigate this further?
Kind regards
Jan Plähn
Hello,
Thank you for reaching out.
I’ve been assigned this issue, and we will be looking into the increased Shader Count stat for you.
Hello,
As a baseline, Unreal Engine 5 introduces a number of new global shaders (for Lumen, Nanite, etc) that were not present in Unreal Engine 4. This might be accounting for some of the shader permutation increase you are seeing.
You could also look to see how many shaders are being generated per-Material. This article discusses how Shader Permutations are created from Materials, and potential solutions to unexpected increases.
[Content removed]
Please let us know if this helps.
Hi!
Thank you for the swift response. I’ll take a look into the Shader Permutations created by Materials and possible changes. Thank you for linking the guide.
These new global shaders you mentioned, would they also be compiled if Lumen and Nanite remain turned off as in our case?
Kind Regards
Jan Plähn
Hello,
In the case of Nanite, the shaders would not be compiled if the feature is disabled in the Project Settings (“r.Nanite.ProjectEnabled=False”).
If “r.Lumen.Supported” is 0, this will prevent the generation of Lumen shaders.
Keep in mind that there are other systems that add global shaders. Nanite and Lumen are just two notable examples. Some of these systems are just updates to existing systems, and cannot be disabled in the same way.
Unreal Engine 5.6 has some improvements to make sure shader permutations for Nanite and Lumen are stripped at cook time if they are disabled in the project. For more information, please see CL: 41759390 on //UE5/Main.
Please let us know if this helps.