- Home /
Unity 5 Real time lights cast shadows with gaps / light leaks
Hello,
Real time shadows cast by a directional light in Unity 5 have tiny gaps in them. As if the models had cracks and there was light passing through.
http://www.brainbox3d.com/bordel/shadowsU5.png
As you can see, the models are very simple and I checked them for actual gaps, missing polygons and reversed normals. I tested close to 20 models from different projects and they all exhibit the same issue when placed into the scene. The lines get rougher and finer depending on the quality settings but never actually disappear.
The bug appears in places where two polygons are perpendicular to each other - hard edges, walls, ledges, etc. They emerge and disappear as the camera angle changes.
This wasn't an issue in Unity 4 and appeared upon the update of this project to Unity 5.
Any input would be appreciated. I tried to search for a solution but couldn't find anyone with a similar problem.
Thanks
BRAiNBOX
I encounteres this problem when different parts of a mesh are not "one piece", meaning while vertices might lie completely on other edges or vertices, there is no actual connection with polygons sharing vertices. Through those visually and mathematically not-existing gaps, Unity makes slivers of line shine through.
I'm having the same problem. It certainly helps A LOT turning the Normal Bias all the way down to 0 (thank you!) but it doesn't fix it 100% for me. As @BEEFDOCTOR mentioned turning the Shadow Bias all the way down makes the shadows look like they're all going through a screen door so I just left it at .03. Is there another method I can use to clean this up that I'm missing? This is so weird and frustrating!
Answer by brainbox3d · Mar 17, 2015 at 09:05 PM
Oh never mind.
The answer was setting the Directional light Bias all to 0 OR selecting "Two sided" in a prefab's cast shadow setti0ngs.
Hope someone with a similar issue might find this helpful.
BRAiNBOX
Does "Two Sided" casting mode affect performance too much? I'm trying to find an answer to this question.
Answer by BEEFDOCTOR · Jul 01, 2015 at 11:27 AM
The problem you are going to face by putting your lights shadow bias down to 0 is "shadow acne" try setting the shadow bias to 0.04 and turn your normal bias down :D
Answer by kautsar211086 · Jan 09, 2017 at 09:13 AM
In my case, the solution is the normal bias should be "0"