[3.x] Use less blur for distant directional shadow splits#60186
Conversation
clayjohn
left a comment
There was a problem hiding this comment.
Two problems here:
- Using a lower form of PCF for further splits results on visibly worse quality shadows, I don't think we should force that on users
- Sampling textures in if/else blocks can be a problem on older GPUs as the GPU ends up running both sides of the branch (and thus waiting on the results of both texture lookups). There is a reason this section of code is structured to do the texture lookups after the branching. On high-end GPUs the difference likely won't be noticable, but on low end or older GPUs this can really hurt performance.
A better approach is to do what you did in 4.0 and adjust the directional_shadow_pixel_size based on which split you are in. This avoids both issues above and should result in the same benefits as your 4.0 PR.
|
Yes I have to say that the before version looks better to my eye, especially in GLES2. The splits may be less noticeable, but the shadows look more blocky. |
62a3a67 to
8c76e87
Compare
|
I applied @clayjohn's suggestions. It seems to be working well and performs identically compared to PS: Seeing this Edit: Video of this pull request with #54355's PCF25 shadow filtering on top: vid.mp4 |
8c76e87 to
19075dd
Compare
|
I've gotten it to work in GLES2 again – it looks good from my testing. Please check if the approach used in GLES2's |
This makes the transition between shadow splits less noticeable, especially when the expensive Blend Splits property is disabled. This is only effective when the shadow filter mode is PCF5 or PCF13.
19075dd to
0cd4e10
Compare
clayjohn
left a comment
There was a problem hiding this comment.
Looks much better now. Let's discuss this with other rendering contributors and users. I'm concerned that the visual change is too much to justify making this change to a stable release. I see the benefit of making ths shadow blur stable as it is in 4.0, but, in my opinion, the before scenes look a little nicer than after. This is likely due to how PCF works and may not be avoidable. As it is purely a visuel change (performance should be about the same) I want to make sure we get as much input as we can.
The benefit of this PR should be much more noticeable in motion, as the difference between splits becomes much less noticeable when the camera moves. Screenshots don't do great justice for this PR 🙂 |
3.xversion of #48776.This makes the transition between shadow splits less noticeable, especially when the expensive Blend Splits property is disabled.
This is only effective when the shadow filter mode is PCF5 or PCF13.
Testing project: test_shadow_b_3.x.zip
Preview
GLES3 (PCF13)
Old revision of this PR
GLES3
GLES2