Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

HDRP multiple light shadow issues

Discussion in 'Graphics Experimental Previews' started by sanmn19, Jun 4, 2018.

Thread Status:
Not open for further replies.
  1. sanmn19

    sanmn19

    Joined:
    Jun 30, 2013
    Posts:
    56
    I'm having trouble getting shadows to work correctly with multiple lights. In the first screenshot, I have only the primary light enabled which casts shadows correctly

    1.png

    Now I have a exact duplicate of that light but with very low intensity of 0.01 that is disabled.

    3.png

    If I enable the secondary light, the shadows disappear. Here is how it looks:

    2.png

    Here is the shadow setting under render pipeline asset.

    Fourth.png

    Edit: If I increase the secondary light intensity then shadow starts appearing once again. Notice it in the screenshot below

    5.png

    This looks like a bug in HDRP. I'm using 1.10.0 preview. This happens in other versions as well.
     
    Last edited: Jun 4, 2018
    Mobazy likes this.
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Can you possibly reproduce this with simpler geometry or untextured geometry? It would logically show the issue far clearer to people unfamiliar with your model.

    The shadow Atlas settings seem wrong as well... also watch how much space your dir light is taking up.
     
  3. sanmn19

    sanmn19

    Joined:
    Jun 30, 2013
    Posts:
    56
    @hippocoder I have made it generic now. I don't think it's an issue with my hdrp asset settings.

    Can you elaborate this "also watch how much space your dir light is taking up."?
     
    hippocoder likes this.
  4. sanmn19

    sanmn19

    Joined:
    Jun 30, 2013
    Posts:
    56
    I have made some more observations. This issue does not happen with point and spot lights. Also, disabling shadows on secondary directional light of any intensity fixes the shadows. Also, indirect light intensity, view bias, normal bias , view bias scale, near place, edge leakage settings have no effect on this issue.
     
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    With HDRP you have an atlas, and the directional light will take up a fixed amount of space in that atlas. Lights will often use less atlas space, but never more than they have - so there is typically some waste atlas space.

    But when your light is set up to use more space than is available in the atlas, things will break. You are not even using power of 2 sizes, but I recommend you do, and you look to see if what you are asking of lights will fit. Do you have red errors in the console?
     
  6. sanmn19

    sanmn19

    Joined:
    Jun 30, 2013
    Posts:
    56
    I get those error when I increase the shadow resolution to a high value. I have lowered the overall atlas resolution to as low as 2k and the lights proportionally but this issue still persists.
     
  7. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    187
    HDRP does a special screen space shadow resolve pass on the directional light for performance reasons. Due to this only one directional light can have shadows right now. Internally it's just a define to re-enable an arbitrary amount of shadowed directional lights, but modifying this behavior is not exposed right now.
     
  8. sanmn19

    sanmn19

    Joined:
    Jun 30, 2013
    Posts:
    56
    @uy3d Thanks for the reply! When will HDRP support multiple directional lights?
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It does. Just not shadows on both.
     
  10. AdamSingle

    AdamSingle

    Joined:
    Apr 18, 2013
    Posts:
    22
    Where is the define located?
     
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's on the HDRP asset, you don't need a define.
     
  12. Dabartos

    Dabartos

    Joined:
    May 26, 2016
    Posts:
    33
    I am pretty sure that's what he was asking about mate. Not very moderator-y of you ;)

    edit.: I am not just ranting, I am reacting to it because I would like to know as well.
     
  13. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    At the time of writing, directional shadows were not supported on more than one directional light. Now, with version 3-4, you can determine the budget for specific lights.

    What does that have to do with being a moderator, stating facts?
     
  14. hatless

    hatless

    Joined:
    Dec 15, 2010
    Posts:
    48
    That's not very moderator-y of you ;)
     
  15. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    How confusing! But this is offtopic now so I'll bow out.
     
  16. Dabartos

    Dabartos

    Joined:
    May 26, 2016
    Posts:
    33
    We're simple human beings without the badge of honor which (as retarded as it might sound) excuses us to be petty and mean.

    On the other hand you're the moderator, you're the beacon of structure, integrity and order. (if you didn't catch what the question was about no problemo, you were going after the actual question that was asked, which is alright)

    Also, as far as I know there is no support for multiple duirectional light shadows but I am happy to be corrected.
    PS.: no hard feelings for real man, we're coolios
     
  17. mephistonight

    mephistonight

    Joined:
    Dec 14, 2016
    Posts:
    75
    Can I ask more about this? Does that mean HDRP does screen space contact shadows from directional lights by default?
     
  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's user configurable now. I'll lock this thread as people keep using outdated information.
     
  19. Matjio

    Matjio

    Unity Technologies

    Joined:
    Dec 1, 2014
    Posts:
    108
    Note that you can use Spot lights with the Shape set to box to emulate more directional lights with shadows. Of course Spot lights don't offer the same features (no cascaded shadows,...) but maybe a work around that work for you.
     
Thread Status:
Not open for further replies.