Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Creating Uber Shader - exceeding shader variant limit

Discussion in 'Shader Graph' started by Julian_Nementic, Nov 30, 2022.

  1. Julian_Nementic

    Julian_Nementic

    Joined:
    Jan 10, 2014
    Posts:
    7
    Hello there,

    im creating an uber shader with shader graph and have some problems with the Shader Variant Limit setting in the preferences. I have 5 boolean keywords and 1 enum keyword with 4 entries resulting in a total of 9^2 = 512 possible shader variants. All of the keywords are shader features and in the game we use approximately 30-50 variants. The default value of the Shader Variant Limit 128 as far as I know, but the setting is in preference so not shared by our version control and asking every single member of our team to set this setting to a higher value does not seam like a good workflow.

    Here is the shader graph for reference:

    upload_2022-11-30_15-54-50.png

    Explaining my situation, here is my actual question:

    Is it a good practice at all to exceed the default Shader Variant Limit of 128 given that most of them will be striped on build time? I looked at the lit shader of the URP which uses a lot more than 7 keywords, so I don't see why i can't use more than 7 in a shader graph.

    Exceeding the limit also breaks shader on some machines by not compiling correctly. But this might not beloning here and seams tobe a bug I need to reproduce and report.