Search Unity

Bug URP "Lit" sample is missing all shaders in WebGL build

Discussion in 'Universal Render Pipeline' started by MGretton, Dec 1, 2021.

  1. MGretton

    MGretton

    Joined:
    Aug 24, 2017
    Posts:
    4
    I'm having an issue under WebGL when I build and run the "Lit" sample which comes with the URP package samples. None of the models appear at all, unless I turn "receive shadows" off on the materials used.

    This is under version 2021.2.4f1, but also tested and not working under 2021.2.3f1. URP is 12.1.1

    Procedure: create a new Universal Render Pipeline project, import the URP samples, switch to the "Lit" scene, add that to the scenes in build as the first scene, switch to WebGL in the build options, Build and Run.

    In the Chrome debug console I'm getting: GL_INVALID_OPERATION: Mismatch between texture format and sampler type (signed/unsigned/float/shadow).

    If I then switch back to the sample scene that the URP project starts with, and run that under WebGL, everything there has also disappeared (it's fine before I import the Lit sample).

    It seems like the Lit sample is perhaps changing something in the project settings, but I don't know what. Any ideas how to resolve this? I'm not familiar enough with URP/shaders to understand what's going on here.
     
    matt-nexus and AliceWasNeverHere like this.
  2. Kana_Dark

    Kana_Dark

    Joined:
    Nov 3, 2012
    Posts:
    3
    I can confirm I've been having the exact same issue and was just working on reproducing it in a minimal project. So far, I found that all objects with shadow-receiving materials disappear when there is no light that hits a shadow-receiving object on camera, specifically with baked GI. As soon as at least one such is in view, all objects immediately reappear. In my project, that happens with any lighting mode, though in the attempt at a repro that I made, it somehow only happens in Shadowmask mode, with Mixed lights. Similarly, I encountered the issue in 2021.2.3f1 and 2021.2.4f1.
     
    Last edited: Dec 2, 2021
  3. TonyvanLoon

    TonyvanLoon

    Joined:
    Nov 29, 2016
    Posts:
    2
    I can confirm that this also happens with the URP template project from Unity Hub. When I build for WebGL, all I see is the paint bucket that doesn't use the Lit shader. I also got the same error like MGretton in the Chrome debug console. If I try to include the Lit shader in the build, Unity say's it has to many shader variants. I tried to add it to the Preloaded Shaders with a Shader Variants file, but that doesn't work either. Seems to me that the Lit shader is broken for WebGL in Unity 2021.2.4. Didn't test in 2021.2.3
     
    blockimperium likes this.
  4. Kana_Dark

    Kana_Dark

    Joined:
    Nov 3, 2012
    Posts:
    3
    Oh, I forgot to mention, it's not just the default "Universal Render Pipeline/Lit" shader that has the problem, but any Shader Graph Lit shader that can receive shadows is also affected from what I could see.
     
  5. G33RT

    G33RT

    Joined:
    Dec 27, 2013
    Posts:
    52
    Seems to be still an issue in 2021.2.5f1 as well
     
    AliceWasNeverHere likes this.
  6. sumpfkraut

    sumpfkraut

    Joined:
    Jan 18, 2013
    Posts:
    242
    same here
    I tried to add the shader to "always included" but then i get this error:
    Code (JavaScript):
    1. Universal Render Pipeline/Lit has too many Shader variants(77309411328).To resolve this, go to Project Settings > Graphics and remove this Shader from the Always Included Shaders list.For more explicit control over how Unity includes specific Shader variants in a build, use a ShaderVariantCollection.
     
    Last edited: Dec 3, 2021
  7. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    is a bug report open for this?
     
  8. MGretton

    MGretton

    Joined:
    Aug 24, 2017
    Posts:
    4
    I'm not sure how that's done?
     
  9. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
  10. ovekaaven

    ovekaaven

    Joined:
    Oct 4, 2017
    Posts:
    2
    The URP documentation's FAQ has information about how to report bugs in URP. (I also suspect I suffer from this problem, by the way, using 2021.2.5f1, but maybe you're in a better position to report it than me.)
     
  11. blockimperium

    blockimperium

    Joined:
    Jan 21, 2008
    Posts:
    452
    Having the exact same issue. Kinda thing I would have thought would have been caught in the most basic of unit tests. But such is life. I have reported a bug for it also.
     
    AliceWasNeverHere likes this.
  12. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    Same problem here, using 2021.2.5f1.
     
  13. Jonas-Mortensen

    Jonas-Mortensen

    Unity Technologies

    Joined:
    Jan 3, 2020
    Posts:
    110
    @blockimperium can you link me the bug? I will take a look at this
     
    matt-nexus and AliceWasNeverHere like this.
  14. blockimperium

    blockimperium

    Joined:
    Jan 21, 2008
    Posts:
    452
    Case 1386080. Don't have a way to link to it directly.
     
  15. JS_Zeppelin

    JS_Zeppelin

    Joined:
    Jan 7, 2020
    Posts:
    1
    @blockimperium did you create the issue at https://issuetracker.unity3d.com/ ?
    I'd like to upvote it, but couldn't find it in the issues created during the last few days

    This is a major issue for us as well, preventing us from upgrading to 2021.2.

    €: WebGl seems to work only in 2021.2.1f, the issue is present in all other versions
     
    Last edited: Dec 7, 2021
    AliceWasNeverHere likes this.
  16. blockimperium

    blockimperium

    Joined:
    Jan 21, 2008
    Posts:
    452
    Nah. It was created in the Editor and that doesn't appear to be something easily tracked from issuetracker. Will keep that in mind next time.
     
  17. N04H08

    N04H08

    Joined:
    Jun 13, 2015
    Posts:
    8
    Having the same issue only with webgl 2.0 build tested my project with an android build and everything worked fined and displayed correctly
     
  18. Lupeni

    Lupeni

    Joined:
    Aug 13, 2017
    Posts:
    5
    Same issue here on webgl Build. Just had it on 2021.5 when it was working fine on 2021.2
     
  19. AliceWasNeverHere

    AliceWasNeverHere

    Joined:
    Aug 16, 2021
    Posts:
    11
    If you used a valid email that you can check when reporting, they send an email with a FogBugz tracker link.
    I sent one in from the editor with a very simple test scene for this issue (#1387161).
     
  20. matt-nexus

    matt-nexus

    Joined:
    Aug 4, 2021
    Posts:
    10
  21. AdionN

    AdionN

    Joined:
    Nov 6, 2019
    Posts:
    16
    Thank you for creating bug report. 2021.2.7f version also have same problem.

    As in example picture. How ever I would like to add something to it. If you use Universal rendering line Lit shader, but on material disable recieve shadows, it will render. Visible objects on the side have same shader, but have recieve shadows option removed on material options.
     

    Attached Files:

    bearcoree likes this.
  22. bearcoree

    bearcoree

    Joined:
    Mar 8, 2016
    Posts:
    72
    Can confirm on 2021.2.7f1, setting the Receive Shadows toggle to false on the material before building makes the materials appear. I also tried a script that sets the toggle to false during runtime on Start, but that didn't work.

    It also seems that the Terrain Shader has the same issue.
     
    Last edited: Jan 13, 2022
  23. Armitage1982

    Armitage1982

    Joined:
    Jul 26, 2012
    Posts:
    38
    FYI a fix is out in last beta 2022.1b : https://unity3d.com/fr/beta/2022.1b
    Bug ID doesn't match so I can't tell for your case, but in mine it works again.
    The one for 2021 should be coming soon, I guess...

    I agree, it's a mess.
     
  24. bearcoree

    bearcoree

    Joined:
    Mar 8, 2016
    Posts:
    72
    https://unity3d.com/de/unity/whats-new/2021.2.8 Patchnotes seem to say that it's fixed in 2021.2.8 now. I'm testing it right now.

    Edit: The issue is indeed fixed now.
     
    Last edited: Jan 14, 2022
  25. george_playbite

    george_playbite

    Joined:
    Sep 27, 2018
    Posts:
    38
    I'm in 2021.2.16f1 and I'm seeing this happen with the built-in render pipeline.
     
  26. Contato

    Contato

    Joined:
    Oct 2, 2015
    Posts:
    16
    Unity 2021.2.18f1 and I do not have the Universal Render Pipeline > Lit, I have others like SimpleLit, Unlit, etc

    I found that I have the Lit in other scenes, but in the scene i need the Lit then I do not have it as an option, what?

    edit: well.. I added the HDRP to my project, then i clicked all FIX buttons, then I removed the HDRP, reinstalled the RUP 12 and then returned to the RUP scene and the shader was there!

    Now I have the Lit shader!
     
    Last edited: Apr 19, 2022
  27. chopin1998

    chopin1998

    Joined:
    Jan 29, 2019
    Posts:
    20
    2021.3 seems met the problem.................
     
  28. richinarm

    richinarm

    Joined:
    Mar 13, 2020
    Posts:
    1
    For anyone experiencing this issue, I got mine to work by simply disabling 'Receive Shadows' in 'Surface Options'. I do not know what in my project this will affect for now but at least it works for now.
     

    Attached Files:

  29. Deleted User

    Deleted User

    Guest

    Going to Edit > Rendering > Generate Shader Includes
    Solved the issue for me, hope that it works for you too.
     
  30. fomafomitch

    fomafomitch

    Joined:
    Nov 22, 2020
    Posts:
    89
    Didn't fix it for me...
     
  31. Eloren

    Eloren

    Joined:
    Jul 17, 2019
    Posts:
    24
    Unity 2021.3.5f1. I get that problem even with SRP, so I don't have Edit/Rendering panel :(
     
  32. wangunity

    wangunity

    Joined:
    Sep 25, 2013
    Posts:
    12
    upload_2023-5-13_16-5-3.png
    I have same problem, webgl with light is ok on pc, but failed with android device. After I uncheck Strip Unused Variants , this problem was solved , even though still get the `creation shader failed ` message.
     
  33. K_Kuriyama

    K_Kuriyama

    Joined:
    Jul 4, 2020
    Posts:
    66
    In my environment, even after unchecking the strip, I could not display the Lit material on some Android models.
    Also, Unlit seems to be able to display them.

    My Unity version is 2022.2.15.