Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Directional Light going through my blender asset's walls in weird ways.

Discussion in 'Global Illumination' started by foxkingg, May 10, 2022.

  1. foxkingg

    foxkingg

    Joined:
    Dec 4, 2017
    Posts:
    8
    I am working on a prototype, and I have to rush so the model I'm working with is not "optimal" in many ways. Either way, I've tried many things but whatever I do, light still passes through walls and it changes depending on how I orient the camera (even though the asset is not moving at all). The only thing that seemed to have fixed the issue was turning the "Near Plane" setting of the Directional Light all the way up to 10 (max value). I was wondering whether this solution might cause other issues or if you know of any other ways I might be able to fix this. Thanks!

    error1.png error2.png
     
  2. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,123
    Are these planes? If they're, change to cube to add some thickness.
    Planes don't have any thickness, should never be used for walls/roof in a game engine to prevent light leaking
     
  3. foxkingg

    foxkingg

    Joined:
    Dec 4, 2017
    Posts:
    8
    Oh, I didn't know that... Thanks!
    They are planes xD
     
  4. foxkingg

    foxkingg

    Joined:
    Dec 4, 2017
    Posts:
    8
    As an addition to the solution, the issue may not have been the mesh, but rather the fact I had set my shadow distance too high in the URP settings... Lowering it and tweaking the light's "near plane" value is what ended up fixing my issue.
     
    jumisko and PutridEx like this.
  5. jumisko

    jumisko

    Joined:
    Feb 18, 2020
    Posts:
    10
    I found the setting on the directional light I was using in URP 2022 LTS, under Shadows, Near Plane slider.