Search Unity

Bug URP 14.0.4 Rendering Layers are totally broken

Discussion in 'Universal Render Pipeline' started by larsbertram1, Nov 29, 2022.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    as soon as i enable rendering layers (in the "URP-HighFidelity" asset in a new and "empty" project) lighting goes nuts and point lights e.g. will not affect any object when using forward or forward+.
    also the ui of the light component is broken: selecting "rendering layers" -> "everything" will set it to "nothing". manually activating all layers will set it to "nothing" as well.

    it used to work in beta 14 i think...

    renderingLayers.PNG
     
  2. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    769
    By the way, this also exists in latest URP 15. (2023.1.a20)
     
  3. Jar_Coding

    Jar_Coding

    Joined:
    Oct 5, 2017
    Posts:
    17
    I can confirm that this is broken in 2022.2f1 too. Looks like GetMeshRenderingLayer in Lighting.hlsl does not get any infos about the rendering layers of the mesh. After deleting the following line I get the light correctly but unfortunately without the layer feature. :rolleyes:
    Code (CSharp):
    1. if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)
    Coming from 2021.3 the feature worked as excepted.

    In short: the whole section here in the documentation Rendering Layers | Universal RP | 14.0.4 (unity3d.com) does not work :)
     
    Last edited: Dec 9, 2022
  4. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    192
    Renderering Layers are broken for me too in Unity 2022.2.0f1. How could they let that slip through the cracks! They do work for a Directional Light but not Point or Spot. Has anyone submitted a bug for this yet?
     
  5. Jar_Coding

    Jar_Coding

    Joined:
    Oct 5, 2017
    Posts:
    17
    I submitted a bug report for this today ;)
     
  6. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    192
    Nice. Link it here when you can!
     
  7. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    nice to see we are not alone on this one

    i also noticed in render layers has issues with additional lights color temperature in that the temp color leaks thru into all render layers not getting masked
     
  8. MustardBoy

    MustardBoy

    Joined:
    Jul 10, 2015
    Posts:
    7
    it work with "Deferred", but not with "Forward" and "Forward+"

    WorkDeferred.jpg
     
  9. ChrisJohnson

    ChrisJohnson

    Joined:
    Feb 20, 2013
    Posts:
    64
    Does anyone know if this has been fixed yet? I’m using 2022.2.3f1 with URP/deferred rendering, and there doesn't seem any way for me to get light layers to work.
     
  10. KimmoFactor

    KimmoFactor

    Joined:
    Dec 29, 2020
    Posts:
    39
    ChrisJohnson likes this.
  11. peterbay

    peterbay

    Unity Technologies

    Joined:
    Nov 2, 2017
    Posts:
    100
    fendercodes and ChrisJohnson like this.
  12. ChrisJohnson

    ChrisJohnson

    Joined:
    Feb 20, 2013
    Posts:
    64
    Nice, that will be great!
     
  13. Sir_Mallory

    Sir_Mallory

    Joined:
    Feb 12, 2014
    Posts:
    6
    Glad to hear this about the lights! But in Unity 2022.4, there's a similar issue in the URP renderer. In Filtering, when I try to click on the opaque or transparent layer mask and then I deselect a layer, the corresponding gameobject keeps on being rendered unless it's on Default layer, throwing the error "IndexOutOfRangeException: Index was outside the bounds of the array."
    I don't know if it's a bug or a mistake of mine.
     
  14. fragilecontinuum

    fragilecontinuum

    Joined:
    Jan 12, 2020
    Posts:
    54
    I don't know if it's a related issue, but after upgrading my project from 2021.3 to 2022.2, any existing System.Flags enums (which I personally was using in ScriptableObjects) could no longer be set to anything other than Nothing or Everything in the inspector panel, though the existing value has been retained regardless. Creating new Flags enums works fine, so it's a bit of a weird one.
     
  15. ChrisJohnson

    ChrisJohnson

    Joined:
    Feb 20, 2013
    Posts:
    64
    DannyBoyOnline likes this.
  16. DannyBoyOnline

    DannyBoyOnline

    Joined:
    Jul 1, 2017
    Posts:
    4
    Having same issue and shadows not working properly either for any directional lights since upgrading. Have upvoted your bug report.
     
  17. ChrisJohnson

    ChrisJohnson

    Joined:
    Feb 20, 2013
    Posts:
    64
    Is there any estimate of when light layer culling masks will be fixed?


    I also can’t use the new rendering layers either because changing a lights renderingLayerMask doesn't seem to work.



    I tried both:

    light.renderingLayerMask = 2;

    and

    light.renderingLayerMask = 1 << 2;

    but neither work
     
    trombonaut likes this.
  18. slippyfrog

    slippyfrog

    Joined:
    Jan 18, 2016
    Posts:
    42
    OMG. this still feels broken (I'm running Mac using Metal). @those who reported only observing this on on OpenGL targets -- should I switch over to OpenGL (from Metal) to resolve this issue or will/has that been deprecated?

    having lights on different rendering layers seems to result in undefined behaviour. Realtime Shadows do not seem to renderer for certain lights (I only have two lights in my scene that cast shadows) when I have two lights, one on each rendering layer. if I jack up the intensity on the second light, then shadows start rendering. if I disable one of the lights , then shadows casting on the second rendering layer seem to render.

    I feel that rendering layers extremely powerful feature and it is important to continue work in Unity to decouple Rendering Layers from GameObject Layers/Physics Object layer. When I refactored my game to use rendering layers to partition lighting, I assumed that the feature is working.. it is perplexing that it is included in a stable, support branch if it is not functionality correctly.

    Any movement on the resolution of this???
     
    Gasimo likes this.
  19. bisewski

    bisewski

    Joined:
    Jan 16, 2014
    Posts:
    310
    Did you find a way to use it? I am using the last release .26f1 and rendering layers in Android keep isnt working.
    Only in editor mode.
    My issue is with Decals...