- Home /
Hard shadows glitching geometry in Android
I've noticed in my recent builds that when I enable hard shadows on a point light, all of the geometry in the scene goes a bit crazy. However, this only happens in Android.
Here's a screenshot of the game running on Android with real time shadows disabled:
And here's a screenshot of the game running on Android with real time shadows enabled:
As you can see, all of the geometry is completely messed up when hard shadows are enabled.
Things to note:
In the Unity editor (and on iOS), the real time shadows work completely fine.
I've been building this game for a while. In the past, the real-time shadows worked on Android completely fine. I've only noticed recently that they cause this glitch, as I haven't turned the shadows on in a long time. So I'm unsure when this glitch started happening, but I can confirm that it did used to work OK at some point in the past.
This is on Unity 5.5b11, but I've also tried building in 5.3 and 5.4, and it has the same issue.
EDIT: After doing some more testing, I can confirm this problem doesn't affect directional lights. A directional light in this scene with shadows set to "Hard" casts shadows properly, and it works OK. As soon as I switch it to a point light, it starts showing the same messed up geometry as in the picture.
Any ideas what's wrong? Any suggestions on how I might fix this?
Thanks in advance.
Answer by IgorAherne · Nov 12, 2016 at 07:37 PM
couple of guesses:
1) check the distance of light, it might get glitchy shadows if it's very big (above 500)
2) see if enabling cascades helps in Project->quality settings of the game
3) play with "Bias", "Normal Bias" and "Shadow Near Plane" settings of the light
3.5) shadow distance in Project->quality settings shouldn't be above 1000
4) perhaps the material's shader is broken after the update
5) check camera's near and far clipping planes, they shouldn't have a difference larger than 500 ish
Thanks for the help and all the ideas. Unfortunately I couldn't fix the problem through any of your points. Here's an update on each one:
1) The range of the light sits somewhere between 10 and 20 (varies depending on how close to the ground it is). But it never goes above 20.
2) Cascades are already enabled, and set to "Two cascades". I've also tried it with no cascades and four cascades, but that didn't fix it.
3) I've played around with the "Bias" / "Normal Bias" / "Shadow Near Plane" settings, but the problem still occurred regardless of what settings I picked
3.5) The shadow distance is set to 20. I've also tried it on 50 and 100, but it made no difference.
4) The material is just the standard Unity material. I will try some others and see if it breaks similarly or not.
5) The camera planes were set to 0.3 and 1000 for near and far respectively. I lowered the far plane to 100, but it didn't fix it.
Thanks again for your input.