Search Unity

LWRP Multiple Directional Lights (only one with shadows)

Discussion in 'General Graphics' started by Fishrock123, Nov 15, 2019.

  1. Fishrock123

    Fishrock123

    Joined:
    Feb 16, 2017
    Posts:
    4
    Having trouble getting multiple directional lights to work with the LWRP.

    It seems that feature was supposed to be supported once the LWRP came out of preview and the settings assets that the LWRP template generated do indeed appear to have options for additional lights.

    I also found https://forum.unity.com/threads/lwrp-directional-lights.666634/, which seems to be the only thread on this since the package came out of preview? I really don't understand the suggestion in there, though. (Also I need the second light to be realtime.)

    I have shadows turned off on the second directional light, and both are set to "realtime".

    All the LWRP settings are set to "per-pixel" and support 4 additional lights.

    The second light doesn't impact the scene unless the intensity is set so high it overrides the primary light so that only it is rendered...

    Any idea what I might be doing wrong? I can post the full settings if necessary. Most things are the defaults, but Fog is off, I have a custom skybox, and SMAA is on.
     
    Mobazy likes this.
  2. Fishrock123

    Fishrock123

    Joined:
    Feb 16, 2017
    Posts:
    4
  3. Fishrock123

    Fishrock123

    Joined:
    Feb 16, 2017
    Posts:
    4
    Ok I found the following code block and comment in LightweightRenderPipeline.cs ...

    Code (CSharp):
    1.  
    2. // LWRP doesn't support additional directional lights or point light shadows yet
    3. if (visibleLights[i].lightType == LightType.Spot && light != null && light.shadows != LightShadows.None)
    4. {
    5.     additionalLightsCastShadows = true;
    6.     break;
    7. }
    8.  
    I am going to open another issue tracker issue since it appears that one was erroneously closed.
     
    CD-ECEU likes this.
  4. CD-ECEU

    CD-ECEU

    Joined:
    May 21, 2019
    Posts:
    7
    They still haven't fixed it.
     
  5. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I use multiple directional lights in URP. IT works fine. Unity 2019.3.10f1
     
  6. AkhmedAbasov

    AkhmedAbasov

    Joined:
    Mar 13, 2014
    Posts:
    163
    This problem is still here.
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Report a bug :)
     
  8. AkhmedAbasov

    AkhmedAbasov

    Joined:
    Mar 13, 2014
    Posts:
    163
    no :confused:
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Then you don't have a problem, right?
     
  10. CD-ECEU

    CD-ECEU

    Joined:
    May 21, 2019
    Posts:
    7
    Not with shadows, you don't.
     
  11. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I don’t but I’ve definitely had multiple shadow casting lights in my project working as a test until i saw the framerate on device.

    i think i had directional and spotlight shadows though, not multiple directional.
     
  12. AkhmedAbasov

    AkhmedAbasov

    Joined:
    Mar 13, 2014
    Posts:
    163
    There is a problem, but it’s easier for me to solve it differently than to report and wait
     
  13. raghadalghonaim

    raghadalghonaim

    Joined:
    Apr 22, 2020
    Posts:
    54
    Same here, did you solve it?
     
  14. AkhmedAbasov

    AkhmedAbasov

    Joined:
    Mar 13, 2014
    Posts:
    163
    no
     
  15. Mobazy

    Mobazy

    Joined:
    Jan 27, 2018
    Posts:
    9
    Still seeing this problem, not even using LWRP. How do we submit a big?
     
  16. The_MrX_

    The_MrX_

    Joined:
    Aug 25, 2019
    Posts:
    12
    Is this intended or a bug? Can't seem to find an official post about it(by a unity dev).
     
  17. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Dot product in shader with normal and a direction (for the fake-light) gives you basic directional lighting for free, for as many lights as you want. Obviously no shadows, but this is a very common way games would shade in the past when lacking lights.

    Added in case it helps anyone.
     
    renanse likes this.
  19. oleg_v

    oleg_v

    Joined:
    Nov 10, 2017
    Posts:
    68
    Still there. Feature is needed to emulate shadows different by stength for close and far (ambient) objects. Idea was to separate such objects by layers and use different culling mask for each directional light.