Search Unity

Bug Shader Stripping checkboxes in Project Settings are inverted for Realtime GI

Discussion in 'Global Illumination' started by LazloBonin, Jan 11, 2023.

  1. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    I just spent hours trying to debug why Enlighten realtime GI wasn't working in my builds, and my discovery and fix is that the two checkboxes in Project Settings > Graphics > Shader Stripping > Lightmap Mode are lying: they're actually inverted.

    In other words, if you check Realtime Non-Directional, it prevents stripping of Directional shaders, and vice versa.

    You can confirm that under the hood by looking at ProjectSettings\GraphicSettings.asset's YAML in a text editor:
    • Realtime Non-Directional affects m_LightmapKeepDynamicDirCombined
    • Realtime Directional affects m_LightmapKeepDynamicPlain
    Just from the naming, it's obvious that they are inverted.

    Furthermore, "Import From Current Scene" will (un)check the right box(es), but that means it doesn't have the right effect, so you can't trust that button either.

    I'm just sharing my findings in case anyone else wonders why Enlighten Realtime GI works in Editor but not in Builds. (And yes I know I should probably report this as a bug but I've had a very long day and I'm too lazy to setup a repro project, sorry!)

    upload_2023-1-11_16-56-3.png
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,799
    Which Unity version? I can't seem to be able to recreate it in latest 2021LTS on a Mac, but I also have had project settings do different things than what they were saying they did in the past.
     
  3. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    2020.3.43f1
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,799
    Nope, unfortunately I can't recreate the issue there either, although 2020LTS is the version where I also had issues with project settings storing the wrong values.
     
  5. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Very odd! I can consistently reproduce it here. Wonder what kind of environment setup might make ours differ. Thanks for looking into it & providing a different perspective though. Either way, I sure am keeping both of these checked on my end in the time being! ;)
     
  6. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    I was able to reproduce this on my machine, and have submitted a usability ticket internally. To our defense, when placing a mouse cursor over the properties, the tooltip clearly indicates that by checking the box, you'd be including that shader in the build.
     
  7. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    813
    Thanks! I think we may be referring to different things. I understand that checking means preserving and not the other way around. However, checking directional seems to preserve non-directional, and checking non-directional seems to preserve directional. That's the unintuitive inversion I'm referring to.
     
  8. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Thanks for the clarification. I did try to reproduce this issue in the latest 2021.3 LTS, but was not able to. Please see the attached screenshots.
    Though it appears that you can reproduce the issue just fine. Could you please report the bug, once you'd have the time? You can also include the link to this thread in the bug description. Thanks!
     

    Attached Files: