When I build my game, I see messages like this:
This is a ShaderGraph shader I’ve authored. What I don’t understand is what the significance is of the “total internal programs: 68”. Does this mean that 68 different versions/variations of this shader have been built and included in my build? Is that generally okay? Or does that large number indicate some issue with my process, and that the number should be much lower? As far as I know, I’m not trying to support lots of different variations on this shader, but maybe there’s just something built-in about using the HDRP Lit output in ShaderGraph that automatically does this.
Anyway, should I be concerned about this?
Take a look at this documentation page: Unity - Manual: Declaring and using shader keywords in HLSL
In short, shader variants will cause many different versions of the same shader to be compiled. This is normal, and for some of the more complex shaders the number of variations can balloon quite rapidly. 68 variations for a shader is totally unsurprising for a basic lit shader in the HDRP.
Okay. So, I’m guessing the large number of variants on this shader is entirely due to me using the Lit output node, and that all of these variants are due to the possibility for various HDRP features to be toggles on/off during the game. So, if a player goes to my options screen and turns off “distortion”, then Unity will swap the material’s shader for a variant that doesn’t support distortion. Something like that?