Hello everybody. Was having fun with different blocky stuff and noticed, that there is a problem with shadows from directional light. They begin to flicker on certain distance from the coordinates center (0,0,0). Problem appears somewhere between 1000 and 2000 coordinates, and the flickering grows as more as far from the center I am.
All project settings are default. Cube scale is 1,1,1.
Small structure on 0,0,0 coordinates and on 5000,0,0 coordinates:
Okay, so if anyone will face the same problem, it is caused by cascaded shadows. To avoid it disable cascaded shadows in the “Graphics” tab (turning them off in “Quality” tab doesn’t help).
It’s not z fighting, not really. It’s just a general problem with any system that relies on floating point numbers; when numbers get big, the accuracy gets lower. The solution is to not get that far from 0,0,0. Unity’s new HDRP internally treats the world as being centered around the camera to solve this problem on the rendering side.
I’ve read about floats accuracy, but I’m sure this isn’t the source of the problem since it appears even quite close to the center (like on 1500,0,0) and only with cascaded shadows turned on. Anyway, I’ve submitted it like a bug. If I’ll receive any detailed commentary from the dev team, I’ll write it here.
At 1500,0,0 the float value is already 1024 times less precise than at 0,0,0, and shadow maps are already dancing at the edges of what’s possible in the precision they have available at the world center.
Really wish there was a fix/workaround for this. It has been an issue for years, and essentially cripples the shadow system.
Adjusting the camera’s clipping plane helps, but it only reduces the flickering a little.
Recently, I discovered disabling Shadow Cascades in Graphics Settings eliminates flickering, but naturally leaves you with very jagged shadows. Wonder if there’s a way to hack aliasing onto whatever alternate shadow-rendering path that exposes?
I’ve terrain 2500x2500, it’s 2019 and it is still a problem, I’ve read all topic about similar issues, but nothing helps. Of course some methods masks problem a little, but it’s not a solution at all.
Not really, I’ve checked every option and it’s still same. Sometimes less, sometimes more, but it is for sure problem.