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.
  2. Dismiss Notice

Shader Control - manages shader keywords and variants - helps reducing compilation time and build si

Discussion in 'Assets and Asset Store' started by Kronnect, Nov 22, 2016.

  1. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,874
    Did you also reimported or updated some asset? That would reset the shader modifications for that asset.
    What does the Project View say? Do a check and look for that keyword in the list. Just disable it again.
     
    Last edited: Jan 29, 2022
    Crossway likes this.
  2. Rensoburro_Taki

    Rensoburro_Taki

    Joined:
    Sep 2, 2011
    Posts:
    274
    I bought it a year ago, and I am simply to dumb to understand how "reducing" keywords works. Or let's say what shader control really does in the end, and what can go wrong if I convert for example "emission" from 96 shaders found to what? What are the risks, if I convert these keywords? I am simply no programmer to understand what's going on. What I really don't want to read anymore is a "technical perspective" of how it works. I don't understand it! Every time, no matter what source (to less) I get back to "controlling shaders" I get the crisis, because I don't understand.

    Now I have a project that of course exceeded the number of shader keywords used and I am to fag to press the button "convert keywords to local" because I use many different shaders from github and the asset store and I don't want to f...u... my project.

    FEAR is what overcomes me! ^^
     
  3. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,874
    Simply put, Shader Control is a tool to solve the "max number of keywords exceeded" error by showing you where are the shaders in your project and letting you pick which ones can be removed. Even if you don't get this error, it's useful to remove unneeded shaders and reduce your app size, especially if you're keen on massive Asset Store content.

    Each shader listed by Shader Control uses one or more keywords. Shader developers use keywords to optimize the performance of shaders. Each keyword is usually associated to a certain feature. If your app does not use that feature, then that shader is adding unnecessary code to your app build and it's also reducing the available keywords to other shaders, hence the error you're getting.

    The option "Convert keywords to local" is safe and it can reduce a bunch of global keywords. Other than that, Shader Control lists all shaders, sort them by keyword count and use the Locate button to find them in the project and decide if they can be removed. If you have a shader that uses many keywords, and are unsure, contact the author (chances are that this is from the Asset Store) and ask him/her what keywords you can remove to optimize your app (the documentation of assets that rely on complex shaders should include a list of keywords and the explanation of what does each one).

    ALWAYS MAKE A BACKUP of your project before removing stuff if you don't understand or know the implications.
     
  4. Rensoburro_Taki

    Rensoburro_Taki

    Joined:
    Sep 2, 2011
    Posts:
    274
    Sorry, english is not my native language and I wasn't thinking at all, when describing my problem. What shader control is good for and the whole meaning behind the "keyword-thing" I understand, but what I don't understand is the actual process of shader control and how to handle the whole thing. From your description, shader control is then something like a router, that does it's job it was setup and the workflow continues. Because If so then I have a complete new understanding of shader control. It's like the gatekeeper for shaders.

    However, you say using "convert keywords to local" is something I can definitely do, without worries? Because for example the 1st most used one was the "emissive" effect 96 times. So, converting them to local means he summarizes all calls coming from all the shaders for that particular effect to one rail, by having them still working as expected?

    Sorry, I was thinking how many times you must've described it. :/
     
  5. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,874
    It's a bit complicated but keywords can be declared in the shader as global or local. Global keywords are limited. However some global keywords (specifically shader_features types declared as global) can still work perfectly as local keywords. So what Shader Control does in these cases is to modify the shader source (if it's readable) so the declaration is local, reducing the total global keyword count.
     
    Last edited: Oct 4, 2022
  6. Rensoburro_Taki

    Rensoburro_Taki

    Joined:
    Sep 2, 2011
    Posts:
    274
    I just pressed the "convert all keywords to local" button and it destroyed the most unusual shaders, which brought me over night to migrate the 360GB project from 2020 LTS to 2021 LTS. xD Normally I would get the crisis, but importing such a big project is always like a cleanup. Because I cleaned up again, this time by deleting shaders I really don't need.

    Of course the new project consists again masses of double entries, but I think I won't touch your plugin again, because I can't handle it. Especially because I have no clue how to handle it. 96 entries with emissive, now where should I look to check all the 96 entries? And that's just one shader effect! I think I will have to live with the mess and slowly switch to Unreal, because the shaders I use are a joke. Why? Because Unreal has all the - actually rudimentary shaders, already implemented - as STANDARD!

    We are fighting with the wrong engine! Oh, sorry "I am fighting with the wrong engine" How could I? xD

    Thanks a lot. The whole thing didn't helped me at all. Not your fault. But please stop explaining it again xD

    Update: I love your plugins, and I just bought beautify3! And thanks for your efforts!
     
    Last edited: Oct 4, 2022