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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Decal (Render Feature) makes Lit Shader graph shaders invisible in Builds | 2021.2.11f1

Discussion in 'Universal Render Pipeline' started by mashixuan8, Feb 14, 2022.

  1. mashixuan8

    mashixuan8

    Joined:
    Nov 4, 2014
    Posts:
    22
    The use of Decal with "Technique: Automatic" or "DBuffer" makes any Lit Shader graph shaders invisible in Unity 2021.2.11f1 in Builds(shaders would still be visible in Editor). Using the Technique: Screen Space would make models visible in Builds but Decals will become purple as if their materials are missing.

    Very easy to reproduce:
    1. Add in Decal as a render feature to Universal Renderer Data
    2. Create a Lit Shader graph shader, default is fine, and assign it to a material then apply the material to any model.
    3. Build the project.
    4. Open the built project 5. the model is invisible.

    Once you remove Decal(render feature) the model will render correctly.
     
    Last edited: Feb 16, 2022
  2. mashixuan8

    mashixuan8

    Joined:
    Nov 4, 2014
    Posts:
    22
    Changing Technique to Screen Space makes Decals render incorrectly in Builds. Decals will appear purple in builds as if their materials are missing.
     
  3. fragilecontinuum

    fragilecontinuum

    Joined:
    Jan 12, 2020
    Posts:
    51
    I have the same problem in 2021.2.10f1, with DBuffer decals causing any Lit Shader graph shaders to be invisible only in build (editor is fine). For me, switching to screen space decals with the Accurate G-buffer normals turned off (URP deferred) and GPU instancing turned off on the decal materials (as suggested here: Bug - Decals Don't Work In Build - Unity Forum) is working for now, but the screen space decals have a z-fighting issue which is still making them somewhat unusable.

    I get the feeling that URP decals might be getting some work behind the scenes ahead of decal layers being included which is messing things up a bit? Or it's related to erroneous shader stripping, which is quite likely given the problem only shows up in builds.

    Note: It's possible this bug sprung up earlier in 2021.2.8 or 2021.2.9, I hadn't properly tested a build for a little while, but I know 2021.2.7 was working fine.
     
    Last edited: Feb 16, 2022
  4. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    481
    Both urp and hdrp have some issues with stripping out shader variants in 2021.2.8 or higher. The issues is supposed to be fixed in 2021.2.12
     
  5. jaguero

    jaguero

    Joined:
    Dec 17, 2018
    Posts:
    8
    I had the same problem, and now in 2021.2.12 version my shaders are back to normal, but now the Decals are invisible in build.
    Im working with URP, and the decals are set to "Automatic", but I tried setting them to DBuffer and Screen Space and nothing changed.
     
  6. fragilecontinuum

    fragilecontinuum

    Joined:
    Jan 12, 2020
    Posts:
    51
    I also upgraded to 2021.2.12 and Lit shaders are working fine again-- but similarly have issues with some decals showing up whilst others don't, notably with screen space decals. Weirdly, I can enable and disable the GameObjects with the projectors on in Play mode and have found that one decal shows up for each pair of enabled decals with the same decal material (and it's quasi-random which one, possibly the closest to camera at the time of enabling, though). Not really sure what is going on there, but doesn't seem to be a stripping problem at least :)

    But Jaguero, you might want to try turning off GPU instancing on your decal materials if that's set; turning that on makes mine completely invisible too.
     
  7. Warrior4Swords

    Warrior4Swords

    Joined:
    Mar 24, 2015
    Posts:
    2
    This is not fixed! Using Unity 2021.3.16f1. Using Deferred Rendering Path + having Decals render feature OFF makes the URP Lit Shader that comes with the URP package invisible. Turning Decals render feature ON using Deferred makes the Lit Shader visible again but the colors appear incorrectly. Forward Rendering Path seems to work fine (?). Wasted days trying to figure why this is happening, since in Editor it works fine, it only breaks in build. I'm using Addressables and it also breaks when using "Use Existing Build" inside the Editor. Hopefully Unity staff can hop on here and explain possible workarounds or when we should expect a fix...