10 minutes build time ( and canceled!! ): shader variants..

I dont know in which world it is normal for a game engine to take 10 + minutes to build a scene with a cube and 1 directional light and 2 materials. ( built in )
All that time taken just to complile shader variants , FOR THE DEFAULT MATERIALS.
URP.

Built in , legacy renderer still much better than this .

Did you, by chance, have postprocessing enabled?

Yes there is was PostFX.
But just now I recreated the exact scenario in the built in pipeline and the build time took no more than 90 seconds.(2 materials, 1 directional light and plenty of PostFX)

The Lit shader uses several multi-compile keywords to create shader variants based on pipeline settings:

  • Shadows on/off
  • Shadow cascades on/off
  • Soft shadows on/off
  • Point/spot light support
  • Lightmaps
  • Ambient occlusion
  • Etc…

All for the general purpose of performance scaling. The Standard shader in the built-in RP doesn’t use this set up, so builds faster.

It can easily amount to 25k variants and can take up to an hour for the first build to finish because of this. Though, subsequent builds will be super fast due to caching.

In 2020.3 this behaviour was recently improved. Now, if shadows aren’t enabled on any pipeline assets in the project, no shader variants for shadows will be built at all.

@Crystalline well, postfx v2 in URP allows to turn things on and off at runtime, so there’s a lot of variants there by default. There’s a long thread about this already, probably more than just one :slight_smile:

Okay but does stencil has much to do with postFX? Because , right now i am building a simple scene and its been compiling stencil related stuff for more than 8 minutes.

Im 15 minutes into building a scene with 4 objects and one light ( + post fx) and still not done.

That’s unlikely :slight_smile:
What’s your PC configuration? Or are you on a Mac?