Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Realtime lights leak through walls

Discussion in 'Global Illumination' started by ScetticoBlu, Nov 26, 2020.

  1. ScetticoBlu

    ScetticoBlu

    Joined:
    Nov 26, 2020
    Posts:
    18
    Hi all,
    I have an indoor scene where the main lights come from the corridor. These lights are set to mixed.
    Here a picture of my problem. Inside all the rooms I have this effect where the lights from the outside bounces over that white wall. I swear I read everything I found online, changing bias, adding new meshes in order to block the light but this cause a shadow undesired on the other side of the wall. I have no idea why this is happening.
    upload_2020-11-26_16-12-18.png
    Here the section of my wall. Yellow is where the light bounces inside the room.
    upload_2020-11-26_16-20-38.png
    The three meshees composing the wall aren't even clipping, all seems clear, how can I stop the light properly? It's really annoying because it would a huge inpact on the gameplay. I'm not using HDRP.
    If someone know the problem, he could save me hours of useless attempts trying fixing it. Thanks!
     
    Neytirix77 likes this.
  2. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    If you are using mixed lights and the unwanted shading is within the real time shadow range there are several tings you could try:
    Make sure all blocking geometry is set to cast shadow.
    Make sure shadow map resolution is sufficient and check the biasing setting.
    Make sure the offending light is actually set to shadow casting.
    Make sure the geometry which is showing the unwanted lighting is set to receive shadows.

    Use the frame debugger to inspect the offending draw call to verify the material/shader have the right keywords and inputs set.
     
    BrandyStarbrite and adamgolden like this.
  3. ScetticoBlu

    ScetticoBlu

    Joined:
    Nov 26, 2020
    Posts:
    18
    Thanks for your answers! I didn't try your solutions because I found that merging in blender all the green walls of the room doesn't let the light leaks through. Probably Realtime light doesn't like multiple meshes one next to another.
     
    BrandyStarbrite and Pema-Malling like this.
  4. IrtezaRmasud

    IrtezaRmasud

    Joined:
    May 19, 2020
    Posts:
    15
    Assuming ur walls has no thickness. Always one thing to remember, Never ever use only single plane as walls. Walls should have thickness. The each room walls only made with single plane will leaks directional light. Adding thickness to your wall will solve the problem. Just think of it, does the real-life wall is that thick like plane? No! If no then why u should use plane as walls?Single plane can be used as cloth, paper etc but not walls.
     
  5. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,622
    Not exactly, in any 3d software render (Lightwave, blender, etc...) you do not need to add thickness to your walls and it will render without any light leaks, so i do not think that is the source problem.
     
  6. hickv

    hickv

    Joined:
    Oct 31, 2018
    Posts:
    40
    It is expected for real time shadows to leak through walls... you have to tweak it's shadow-map resolution and bias. Game engine realtime lights are nothing like Blender, Lightwave or Maya 'realtime' lights, they are built for different purposes (that being, 'preview realtime' vs 'high-fps realtime').
     
    lilacsky824 likes this.
  7. guilhermedaniluski

    guilhermedaniluski

    Joined:
    Feb 16, 2019
    Posts:
    1
    I suggest you to try and set the object model normals option to "none".
    upload_2021-11-1_23-57-5.png
     
    unity_EDdq8x7gw4afZg likes this.
  8. Bezoro

    Bezoro

    Joined:
    Mar 16, 2015
    Posts:
    133
    Lighting works differently in the software you described.
    You can't compare a real-time renderer like Unity with path-tracers. (Although we seem to be going in that direction now with raytracing, but we are not there yet.)

    In real-time engines in particular objects with no thickness will let light through very easily, for multiple reasons.
    The simplest way to mitigate this is by making the material double-sided, but even then its not a perfect solution.
    By far, to get the best results, you need to make the wall have some actual thickness, or put something to block the light outside the bounds of the level.
     
    lilacsky824 likes this.