Use less blur for distant directional shadow splits#48776
Conversation
|
I was about to create a proposal for this. Is this and the blend splits at draft? |
Yes, this PR needs to be finished before it can be merged. Note that there's already a proposal open: godotengine/godot-proposals#2729 |
5af4c62 to
f8c168e
Compare
|
Rebased and tested again. Some changes I did:
The performance impact seems to be unnoticeable in practice. BeforeAfter |
|
Any reason why this PR has been dormant for so long, or just faded into the backlog of PRs to check? |
It needs a review by a rendering contributor (other than me) 🙂 |
f8c168e to
825f693
Compare
|
I applied @clayjohn's suggestions and tested again on both clustered and mobile backends (with and without Blend Splits). It looks good, even when split distances are customized. PS: I found a way to further improve shadow appearance by scaling the normal bias depending on the split's share. This is in a separate branch for now, but I can include it in this PR if you want: https://github.com/Calinou/godot/tree/directional-shadow-normal-bias-split |
825f693 to
e093668
Compare
|
Blend Splits with consistent blur levels alone probably becomes unnecessary for plenty of scenes. If Normal bias change adds to that.. especially if and when godotengine/godot-proposals#3908 (spherical Splits) become a thing... Blend Splits will really be a nearly pointless feature for most use cases.. 😃 |
|
Eh, I've noticed how Shadow Blur quality setting is now very inconsistent in what it's doing... For example, Soft Shadows Low look the softest, while going towards Ultra generally slowly decreases how soft they are, and the level of graininess is about the same. Also, I didn't test out the Normal tweaked branch, but this seems to negate the need for #55757 Normal bias setting changes |
I can reproduce this on the Vulkan Clustered backend, but not the Vulkan Mobile backend. Can you reproduce this on a vanilla
The shadow bias still needs to be increased up close, so I think #55757 is still relevant. |
This appears to be a regression in master. It looks like the enums are misaligned or something. |
clayjohn
left a comment
There was a problem hiding this comment.
Looks great! Once we resolve that shadow regression in master this will look even better!
|
Alpha 6 has no issues, only Clustered has this issue as stated above. On another note, the Normal Bias PR increases shadow acne considerably in some scenarios, such as on a flat plane when the sun is just rising, however in other cases it massively improves quality. (16k shadow map can easily do 10-20km view distance with it) And I found why Normal Bias at 2 is a good idea, highly curved objects clear out micro-shadow acne quite well... and the issue that I've reported for Directional Shadows (#55757 (comment)) is no longer effectively present, well in the Normal bias split branch. |
|
I think I may have figured out why there is such shadow acne appearing on a Plane when the plane is viewed (by the Directional Shadow) from such an angle (85-90 degrees angle from Plane's Normal) There might be a solution for this, which would be to detect Large differences in Depth on the Shadow Map and based on that increase Bias for the areas of the Shadow Map that are affected.. Here's a Sketch of the base Idea: White - Depth Far Note: This idea could also be applied to Spot and Omni Lights (especially Omni Lights) to Reduce their Shadow Acne in cases like #55757 (comment) |
This makes the transition between shadow splits less noticeable, specially when the expensive Blend Splits property is disabled.
e093668 to
1a41a17
Compare
|
Tested again after rebasing on latest BeforeAfterPerformance is pretty much identical. Testing project: test_shadow_b.zip |
clayjohn
left a comment
There was a problem hiding this comment.
Yep, looks great rebased on master. Great work!
|
Thanks! |





masterversion of #60186.This makes the transition between shadow splits less noticeable, specially when the expensive Blend Splits property is disabled. In many scenarios, you no longer need to enable Blend Splits to get good directional shadow appearance.
From empirical benchmarking, this seems to have a small performance cost (average 160.6 FPS over 5 screenshots instead of 163.8 FPS). I'm not sure if this is introduced by benchmarking. It's not very scientific since I carried this out from the editor and its fluctuating frame time information.Edit: Further testing didn't reveal any performance difference.
This closes godotengine/godot-proposals#2729.
Note: Not cherry-pickable to the
3.xbranch, since this relies on the per-light shadow blur feature found in the new Vulkan renderer.3.xequivalent of this PR (doesn't work with Blend Splits enabled yet): https://github.com/Calinou/godot/tree/directional-shadow-distant-split-lower-blur-3.xTODO
1.0for the first split.0.5for the second split.0.2for the third split.0.1for the fourth (and last) split.Preview
Note: GI and ambient lighting was disabled to make the difference in shadow rendering more obvious.
Before
Distant shadows have less detail. There is a noticeable "cut" between splits near the lamp posts in the middle of the image.
After
Distant shadows keep a similar level of detail. Despite Blend Splits being disabled, the cut between splits is now much less noticeable.