Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Directional light bleeds into closed corridor HDRP

Discussion in 'High Definition Render Pipeline' started by EpicMcDude, Jul 13, 2020.

  1. EpicMcDude

    EpicMcDude

    Joined:
    Apr 15, 2013
    Posts:
    117
    Hey everyone,

    I'm running into an issue with my directional light and with a particular corridor on my level. It seems the first half of the corridor is light by the directional light, while the last half is completely dark as it should be.

    The first example is how it looks from the outside, completely covered with the ceiling and walls.

    On the second example the corridor interior is completely lit while it should be dark. I have no idea why this is happening to only half of the corridor.

    I set up a reflection probe to help with the light and it did but only for the other half of the corridor.

    What can I do in this case?

    Thank you in advance example 2.jpg example 1.jpg
     
  2. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    You need either a double sided material or make wall geometry for both sides. Otherwise it will leak.
     
    cjjeffery and brainwipe like this.
  3. EpicMcDude

    EpicMcDude

    Joined:
    Apr 15, 2013
    Posts:
    117
    Hi Bordeaux_Fox, sorry for the late reply! Could you kindly let me know what you mean by wall geometry for both sides? You mean make a plane or something to block the light before it reaches the wall?

    The double-sided material didn't do the trick unfortunately.

    Thanks
     
  4. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Yes, for interiors you need geometry that blocks the sun light or basically any light source. Because usually a mesh is only rendered from one side, the light will leak through the side which is not rendered. Therefore, you need wall inside a corridor and then also for outside corridor. So instead of plane, make a cube, basically a mesh with a thick solid volume.

    Not this will not block reflections from the sky, so you still get some light leak. To get a perfect pitch black room, you also have to place reflection probes inside a room that covers the walls and floors.
    Also this method does not prevent light leaking when use Realtime GI with Enlighten.
     

    Attached Files:

    Last edited: Jul 20, 2020
  5. EpicMcDude

    EpicMcDude

    Joined:
    Apr 15, 2013
    Posts:
    117
    Ohhh I see, I'll give this method try when I when I'm out of the daily grind, thanks a bunch for your help.
     
  6. EpicMcDude

    EpicMcDude

    Joined:
    Apr 15, 2013
    Posts:
    117
    S
    So I did all of this and nothing was working, I couldn't really understand why, I also set up reflection probes in each area that have different lighting conditions.

    Out of frustration I enable and disable the Directional Light to see how much it was affecting the map and when I turned it back on, it started working properly... No light leak anywhere. So I guess that worked!

    Thanks man!
     
  7. EpicMcDude

    EpicMcDude

    Joined:
    Apr 15, 2013
    Posts:
    117
    ...because I forgot the update mode was "On Enable"... Game dev is hard, but sometimes it's just because you're kinda dumb huh