Why do the shadows keep dropping quality when i zoom out? It looks terrible

Hello

I have added a simple tree model into my game world, but when i zoom out the shadows drop suddenly in quality and it looks terrible. I got the draw distance for shadows high, i am using deferred (if that matters) for my camera.

I have this image to show what i mean:

It’s driving me crazy. How can i fix this so it will not drop quality in shadows on zooming out so much ?

This is from shadow cascades switching from one cascade level to the next. As you zoom out the shadow quality will degrade, there’s no way around that with real time shadows in Unity.

Go to the quality settings and play with the number of and split for cascades.

I’ve been playing around with it for a while, quite tricky to understand it fully, is there no way to stop it cascading at all and just remain high quality?

You can turn off cascades to prevent the switch, but as you zoom out the shadow maps have to draw more and start looking worse quickly. Cascades are used to try to mitigate this, but it’s a hard problem.

Given its a static thing why couldn’t the shadow just get smaller without randomly losing detail outline?

The shadow itself isn’t static, it’s real time. If you used baked lighting and a light set to baked or mixed it’ll stay more consistently detailed, but it’ll also never be as sharp as the realtime shadow when close up unless you greatly increase the shadow map resolution which will take a long time to build.

“Why does the framerate keep dropping when I zoom out???”… that will be your next question.

If you’re drawing more stuff, you can’t draw the same level of detail on that stuff or it becomes much more expensive. I guess this brings the game’s development to and end though? sigh

No because i ain’t getting any frame rate issues for 100 trees. But many games don’t have such harsh transition of shadows as you zoom out, unity’s is just pretty sudden that its an eye sore.

I saw this shadow LOD a lot while playing PC games like Sim City series.
I think this is a common optimization for normal gaming computer like me.
I can’t handle a metropolis view on top like a world map without LOD.
My computer sure will have “smoke” coming out.

My issues is why only 4 cascades? why not 10 so you can make it finer less abrupt adjustments as you zoom out…

Because it would be the slowest thing ever :slight_smile:

Fair enough, I’ve no idea how other engines manage much smoother transitions then without much impact on performance.

I believe its a problem with the implementation. For example GTA V uses shadow cascades - same as unity actually yet there’s no sign of the horrific banding. I’m going to guess it’s a precision issue but perhaps @bgolus would know more as I only have rudimentary working knowledge.

I suffer with the same problem and I’ve even tried dynamically tweaking cascade ranges.

Most games uses cascaded shadow maps at this point. Doing a google search on that term will get you a excess of links showing off how it works, and the problems it has.

The main problem is most modern games that use cascaded shadow maps blend between the cascades or do some other trickery so the change isn’t as abrupt, but Unity just does a hard break from one cascade to the next. Figuring out the best place to have the “splits”, or where the changes happen, is a surprisingly difficult issue that’s had a lot of time spent on it and no one has ever really solved. Unity’s answer was to implement a decent version and let the authors play with the numbers to try to get something passable where other companies have found potentially better automated solutions. That said even the PC version of GTA V suffered from almost exactly this issue early on:

1 Like

Oh nice! I haven’t noticed it myself on PC but I guess it probably takes some fiddling before it happens. As Unity’s is a plain solution, there’s room for improvement I guess.

I don’t know the technical complications, but there must be people out there that know the solutions unless they are all snapped up by the big game corporate that won’t release their secrets by paying ex employees to keep it quiet. Otherwise unity would have hired a pro to help on it im sure.

The issue is there feels like there should be a “perfect” solution to shadow cascades, and there have been a lot of versions people have touted as perfect, but none of them actually are. If you ask any graphics programmer about cascaded shadow maps I guarantee they have a story about some perfect algorithm they tried to implement for ages before giving up and doing it a simplier way and tweaking it by hand until it looked good enough or just improved the shadow filtering to the point no one could tell the cascades we broken.

Also while there is some secret sauce at some companies most are fairly open. The current state of PRB is a good example of that with many companies working together after Disney published a paper on their lighting model to elevate the entire industry.

1 Like

Kinda humbling to see that multi million $ game developers don’t even have a solution some times :stuck_out_tongue:

Is it possible to do some sort of dithering / filtering on the cascade split so it’s not such a clear break?

The Sunshine! asset supposedly does this, and I’ve modified the screen space shadows do to this before, though in my case it wasn’t worth the (minor) performance hit. There’s even code in there already to do smooth blending if you change one line and use stable fit instead of close fit (I think?).

1 Like