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

Question shadergraph as skyboxe issues.

Discussion in 'Shader Graph' started by Nakou, Dec 13, 2022.

  1. Nakou

    Nakou

    Joined:
    Feb 6, 2013
    Posts:
    6
    hello everyone.

    i'm working on a project that is full URP in term of settings.

    i was following some tutorials to make simple star-filled skies in shadergraph (with an unlit URP shadergraph) and i noticed that everytime i tried to link the material created with this shader into the skybox of the scene, it says that it can't work because my shadergraph is not compatible, saying "Shader of this material does not support skybox rendering" when i add the material as skybox material. And it put the shader in question into the scene as a 6 sided skybox while it shouldn't.

    Fj2fx3OWAAEjiVX.jpg

    so i tried another tutorial, which provided a downloadable shadergraph too, but still, i end up with the same result with or without the downloaded version...

    i've noticed that if i name the shadergraph with the word "skybox" somewhere, the note under the skybox material disappear but it doesn't fix the fact that it still tries to show the material as a 6 sided cube skybox.

    i tried to find some answers on google but so far i cannot find someone with the same issue than me (or maybe i couldn't find the correct way to ask google about it).
    is it a bug from 2022.2 or is it something i am systematically missing in shadergraph/lighting configuration?

    thanks in advance.
     
  2. Nakou

    Nakou

    Joined:
    Feb 6, 2013
    Posts:
    6
    i've found the issue. well, the bug.
    it works fine in the 2022.1.23f
    it's only in the 2022.2.0f1 that the skybox breaks.

    2 vanilla projects started as with just "Core URP", left on 2022.1.23f, right on 2022.2.0f. Just copied/pasted the same shadergraph from the second tutorial of the original post.
    we can see the bug is only on 2022.2 (scene view, basically same angle of camera).
    upload_2022-12-13_18-16-57.png
     
    Captain-Cabri likes this.
  3. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,396
    Please make a bug report for it so it can be fixed
     
  4. Nakou

    Nakou

    Joined:
    Feb 6, 2013
    Posts:
    6
    Yep doing it right now.
     
    Alpha_CaO and DevDunk like this.
  5. zsombor

    zsombor

    Joined:
    Feb 21, 2013
    Posts:
    2
    hi! did you create a big report? is there any update on this? I'm having the same issue.
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,396
    If there is no reply from OP you can file the report yourself as well
     
  7. Alpha_CaO

    Alpha_CaO

    Joined:
    Oct 31, 2021
    Posts:
    1
    I also encountered the same problem. In the 2021 version, although there are warnings, they can be displayed normally. But it can't render correctly in 2022 version
     
  8. PFosterSumo

    PFosterSumo

    Joined:
    Jan 21, 2022
    Posts:
    3
    Just came across this issue after doing a test upgrade on an older project. Open your skybox shadergraph and disable Cast Shadows in the graph settings - this fixed it for me (and there's obviously no reason for it to be enabled)
     
  9. actuallystarky

    actuallystarky

    Joined:
    Jul 12, 2010
    Posts:
    188
    Weirdly I had the exact same problem but the opposite fixed it for me. I'd switched Cast Shadows off and had the strange Skybox issues. They didn't go away until I'd switched cast shadows back on - which doesn't make a lot of sense.
     
    IgorAherne likes this.
  10. OUTTAHERE

    OUTTAHERE

    Joined:
    Sep 23, 2013
    Posts:
    656
    I fixed my skybox by disabling depthwrite - shadows doesn't reliably fix it.
    upload_2023-3-2_10-47-25.png
     
  11. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    1,383
    This worked for me, thanks!
     
  12. floky

    floky

    Joined:
    Oct 6, 2010
    Posts:
    273
    Apparently the DepthWrite setting is not enough to fix the error. The only workaround I found is to copy the generated shader from the shadergraph and correctly set the shader tags in a separate shader file and change all the shader pass properties:
    Code (CSharp):
    1.  
    2.         Tags
    3.         {
    4.             "RenderPipeline" = "UniversalPipeline"
    5.             "RenderType" = "Background"
    6.             "UniversalMaterialType" = "Unlit"
    7.             "Queue" = "Background"
    8.             "DisableBatching" = "True"
    9.             "ShaderGraphShader" = "true"
    10.             "ShaderGraphTargetId" = "UniversalUnlitSubTarget"
    11.             "PreviewType" = "Skybox"
    12.         }
    13.  
    14. -----------
    15.  
    16.         Cull Back
    17.         Blend Off
    18.         ZTest LEqual
    19.         ZWrite Off
    20.         ZClip False
    21.  
    I couldn't find a way to override these tags from ShaderGraph.

    I changed the RenderType and Queue to "Background" (these being the main reason the shader is not a compatible skybox shader) and I disabled batching for it (because one sky) and added the corresponding PreviewType for a nice editor skybox preview.

    After applying the above, I used the customized shader on the skybox material and apparently it works reliably.

    I thought by now Unity would have added a way to also add/set tags from the ShaderGraph.

    "ZClip False" sets the GPU depth clip mode to Clamp to workaround an apparent URP 14 issue when skyboxes are rendered with multiview instancing.
     
    Last edited: May 16, 2023
    FariAnderson and alexandre-fiset like this.
  13. corriedotdev

    corriedotdev

    Joined:
    Sep 1, 2012
    Posts:
    21
    Filing a bug report as well. 2022 LTS Breaks this.