-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve shadow filters #12195
Improve shadow filters #12195
Conversation
Looks like the moire pattern are worse now: This is the Hidroplane mode. (https://content.minetest.net/packages/apercy/hidroplane/) |
The moire pattern on objects might get worse due to changes in offset biases that need more tuning (I spotted some artifacts too). Latest changes to combat peter-panning might also contribute to more visible moire/self-shadowing. |
I noticed that with soft-shadows. When a close shadows overlaps a distance soft-shadow the far (softer) shadow "wins". Is that what you mean? |
There was a more specific problem that I would call a "tree on a cliff" problem. When a high tree projected a shadow on a cliff, its silhouette would appear in the shadow of the cliff, because those pixels had much longer shadow depth and penumbra radius. The problem should be fixed now by translating depth to penumbra using a linear function (opposed to quadratic function previously). The problem of softer shadows taking over the harder one is due to storing only one depth value per texel, and I don't see how it can be solved without complicating the SM texture generation significantly. |
Yes, that's the tradeoff I chose to do for near-zero shadow depth. |
Should be done in the latest commits. Filter radius is now at least 2 texels, which together with adaptive quality reduces effect of the sharp edges / dancing shadows. |
So far I think it still looks better without this change. :( |
Can you share examples? |
@lhofhansl I've tried to find the balance between player's feet and peter panning. Looks much better on my machine at least. |
Thanks for looking! The fragment shaders do not compile for me. I had to make the following changes:
and
At the relevant places on the object and nodes fragment shaders. Also the player shadow looks still "jaggedy": |
@lhofhansl I've applied the fixes, thank you.
|
Hmm... I think my view distance is larger (300) and shadow map size is set 4096 (and max shadow distance is 450) |
* Avoid peter-panning effect due to filtering of short shadows * Scale the penumbra radius linearly * Try a different penumbra detection algorithm
Thanks for sticking with this @x2048. I'll try out the latest change. |
Don't give up on us @x2048 :) |
Still here. Keeping silence since there's not a lot I can share now |
Adjust sharpness factor for perspective factor Avoid sharp shadows on surfaces without normals (e.g. plants)
@lhofhansl OK, I have something interesting now.
|
👍 With soft-shadows set to 10 is looks nice now! (Still the very close edges with the player shadows, but I think that is cool) |
Agree. I've increased the maximum blur to 30 now, changed default to 5 and copied the the changes to object shaders. |
@x2048 Can you also change the default value of |
@kilbith I'll change the defaults in a different PR |
Helps troubleshooting
Default is 5.0 Maximum is 15.0 to avoid phantom shadows
@x2048 is this still WIP? |
@Zughy Thanks for pointing out, it's approved now, so not a WIP |
With the introduction of new SM texture distortion in #12166, PCF filter for shadows was outdated and produced wrong results.
What's done:
Benefits:
To do
This PR is a Work in Progress and depends on #12191 being merged, but review is welcome.
- So far it has been solved by limiting the soft shadow radius
How to test