Search Unity

Override UnityStandardConfig.cginc - is it possible?

Discussion in 'Shaders' started by kulesz, Sep 20, 2018.

  1. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    140
    Hi,

    In folder Editor\Data\CGIncludes there's a UnityStandardConfig.cginc file with a bunch of setup directives.
    I'm trying to make a copy of it in my project folder and override UNITY_BRDF_GGX (from 1 to 0), but it doesn't seem to work.
    It works only, when changed directly in Unity installation folder, but this is not the case for us - the file must be located in project folder and used by version control, no local changed outside of project are allowed.

    Is there a way to tell Unity to use other UnityStandardConfig than located in installation folder?
    BTW, setting UNITY_BRDF_GGX value in custom shader also doesn't work (probably overriden by Unity).
     
  2. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550
    Pretty sure you can't, or the developer of NGSS would have done so as well.

    This is one of the issues that the scriptable render pipeline fixes.

    It's just one of those situations where you won't be able to rely on version control entirely. It's a shame they don't have more override slots like they have for DeferredShading.cginc
     
  3. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    140
    That's too bad, as 100% version control integration is a must in this case (as with most large projects).
    Additional slot for config file would be a lifesaver in this case.

    We could eventually copy contents of all BRDF lightning calculations (several cginc files) and put them all in custom Internal-DeferredShading file. But I don't now, if that would work (and upgrading to new Unity versions would be a nightmare)...
     
  4. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550
    Well, if you just want to disable GGX (how come?), then you could probably just put this in the Internal-DeferredShading:

    #define UNITY_BRDF_GGX 0


    Placed right before the other #include lines near the top of that file. So when a deferred shader is being compiled, this will cause it to take the non GGX path. All your existing Unity shaders will change to non-GGX, even the built-in ones. And this will be very easy to maintain.
     
  5. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    140
    Thank you - I'll check it out and report the results.