Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Solution
mainsimplified down to thelight_size / cascade_diameter. The light size could be tweaked for this to look ok, but the softness of the shadows would be unintuitive for cascaded shadow maps given the interplay between the cascade configuration and the light size - if you change one you would have to tweak the other.128.0f / shadow_map_sizeequivalent to 128 texels, whereshadow_map_sizeis the texture dimensions of the cascade. At least for the shadow map size we use. Given all cascades use the same resolution, this is practically a constant:128.0 / 2048.0 = 0.0625in UV units. This means that each cascade will search smaller or larger regions for blockers depending on how close they are to the camera. It does feel like the blocker search. This came from this MIT-licensed code: https://github.com/PanosK92/SpartanEngine/blob/f0526aac0ed3197cc3ffb09d029f8b3bde8daf21/data/shaders/shadow_mapping.hlsl#L106Testing
I've tested using the
pcssexample on an M4 Max.Showcase
Soft shadows off:

PCSS

main:PCSS on this PR:

Note how the shadow is harder at the base of the tree and softer around the leaves. I don't have a ground truth image of this scene to compare to, but this is at least more how it should be.