TheMasonX / UnityPCSS

Nvidia's PCSS soft shadow algorithm implemented in Unity
MIT License
727 stars 81 forks source link

Directional Shadows Messed Up #7

Open GeorgeDziov opened 6 years ago

GeorgeDziov commented 6 years ago

After adding PCSS and turning on realtime GI shadows started changing resolution randomly and light started bleeding frequently. When I turn camera at some specific angle shadows become blurry and very low res no matter the quality settings.

I can't return shadows back to normal even when I remove PCSS folder and disable GI. This also affects all projects including new empty ones so I'd like to know how to restore default directional shadows. Point and spot lights are normal.

Link to Youtube https://www.youtube.com/watch?v=xRB6QEwvwgE

chrisnolet commented 6 years ago

It’s really strange that this issue persists even after removing PCSS. It might be worth removing the project’s Library and Temp directories, and have Unity rebuild them.

On the surface, it looks like an issue with the shadow projection and/or cascades. Does ‘Stable Fit’ and ‘Two Cascades’ or ‘Four Cascades’ help? It might also be worth reducing the shadow distance down to 20 or 30, too, to see if that helps.

Does a fresh install of Unity make a difference?

GeorgeDziov commented 6 years ago

Just finished trying all suggestions - actually, while my current scene stays broken, there are some good results in general - shadow resolution is now normal again although directional shadows are still fuzzy but not as horribly as before so thanks for that.

Hope to get rid of fuzziness too, I had great shadows before even with 10K distance. Maybe it's some kind of scripting stuff? I tried restoring directional shadow shader but it did nothing. :(

chrisnolet commented 6 years ago

I'm glad those suggestions helped a little!

With shadows at a distance of 10k, it sounds like they may have been baked shadows. Is that possible/correct? By default, I believe mixed-mode lights project realtime shadows when static objects are within the shadow distance. Beyond the shadow distance, static objects revert to baked shadows.

You can change this behavior, so that static objects always use baked shadows, regardless of whether they're within the shadow distance or not. If you have static objects with baked shadows, try setting the Shadowmask Mode in Quality to 'Shadowmask' and see if that helps.

(Note that realtime and baked shadows have a different 'look', which is why it's not normally recommended to mix and match the two side-by-side, but it can work.)

Other than that, some other things to try for realtime shadows:

I'm not sure if UnityPCSS changes anything deeper in terms of the lighting setup, or if it has any lingering effects after being removed. (I'll leave the author of the asset to comment on that.) As you said, it's possible something more-complex is going on that's beyond me I'm afraid.

Hope this helps a little more though!

GeorgeDziov commented 6 years ago

Nah I try to avoid baking shadows (and I really regret I turned realtime GI on)... Tried fiddling with bias and resolution more, no more results unfortunately.

I just found that shadows don't change resolution at random. They change resolution based on how far I look. I mean if there's only a couple small cubes in scene, shadows are high res but if I put a big cube or a small cube far away, shadows get clunky. But when I look down, shadows are normal again cause only thing I see there is floor. It worked different before turning on realtime GI with PCSS included - shadows got blurry only when I increased the shadow distance in Quality setting.

Anyway thanks for helping Chris, at least I got somewhere with those darn shadows! XD

Well, I'll be waiting for author to solve the issue then.