Simple Lit Shader has 16 million variants?

Hi,

When building my URP 14 project, the “Compiling Shader Variants” tasks takes extremely long for two standard shaders.

Universal Render Pipeline/Simple Lit (16 million variants)

and Shader Graphs/Standard Vertex Color (6 million variants)

I am aware, that there is a general discussion topic about shader stripping here Compiling Shader Variants Taking Ages . I browsed the topic and already disabled several render features, but the number of variants did not decrease.

My project is fairly basic (but had some migrations from 2020 onwards) and as far as I understood, most of the variants are stripped out during this process, but it needs to be done on every cold build.

So my questions:

  • Is it “normal” to have so many variants for those standard shaders? I am not even actively using Shader Graph… Third party shaders have way less variants.
  • What can be done to identify and remove all the unnecessary variants?

It is quite easy to get the variant counts into range of millions by having lots of multi_compile in the shaders. And URP does. What matters more here is the amount of actually compiled variants, which seems to be in a sane range for you there.

Atm the only way to reduce the full variant set or “all the possible variants” is by reducing multi_compile usage. The amount of actually compiled variants is controlled by feature usage through scriptable stripping and in more recent versions variant prefiltering. In essence the quality levels and the renderpipe settings in them affect the amount of URP variants being included in the build. For more custom pruning one can also implement their own stripping scripts in addition to the provided ones, but for that one needs to have intimate knowledge about which variants are needed in their build.

1 Like

Thank you for your detailed reply!
I will check, if there is any specific render feature or quality level, that can be discarded. Reducing multi_compile usage in the >URP standard< shaders does not sound like an option to me.