shadow: introduce a tighter caster culling method#10021
Open
show50726 wants to merge 7 commits into
Open
Conversation
romainguy
reviewed
May 19, 2026
Comment on lines
+464
to
+469
|
|
||
| /** | ||
| * Enable tighter caster culling for shadow maps. | ||
| * This can improve performance by culling shadow casters more aggressively. | ||
| */ | ||
| bool tighterCasterCulling = false; |
Collaborator
There was a problem hiding this comment.
Is there a reason to not always do this?
I mean, should this be a config like you did, or just a feature_flag, that we eventually remove?
What are the downsides of always doing this?
Contributor
Author
There was a problem hiding this comment.
I think people might want to leave this feature disabled when they are at CPU bound instead of GPU bound.
Additionally, as discussed offline, this shouldn't be used alongside techniques like VSM or mipmapping. Rather than disabling culling automatically, I added a warning in the configuration so the user can decide.
Contributor
Author
There was a problem hiding this comment.
I've made it a per-view option instead
pixelflinger
requested changes
Jun 5, 2026
show50726
force-pushed
the
dev/caster-culling
branch
from
June 6, 2026 04:35
12f9249 to
ac2d79f
Compare
address comments push frustum planes 1 texel away add warnings make tigher culling a per-view config
show50726
force-pushed
the
dev/caster-culling
branch
from
June 6, 2026 04:36
ac2d79f to
851b219
Compare
show50726
force-pushed
the
dev/caster-culling
branch
2 times, most recently
from
June 8, 2026 05:07
2f1103f to
58284b5
Compare
show50726
force-pushed
the
dev/caster-culling
branch
from
June 8, 2026 05:41
58284b5 to
120768a
Compare
pixelflinger
requested changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Inspired by this post:
https://x.com/SebAaltonen/status/1717455941551919261?s=20
The basic idea is to look at the view frustum from the light, and find those planes that construct a "silhouette". All the renderables outside this silhouette will never cast the shadow to the view frustum so we can safely cull them. Note that in our approach, we construct a table to easily look up for each back planes combination, what would be the silhouette vertices, so we can avoid some calculation.
The basic idea is to look at the view frustum from the light's perspective and find the planes that construct a "silhouette". Any renderables outside this silhouette will never cast a shadow into the view frustum, so we can safely cull them. Note that in our approach, we construct a lookup table for each combination of back-facing planes to determine the silhouette vertices, allowing us to avoid some calculations.
Implementation reference:
https://github.com/godotengine/godot/pull/82584/changes#diff-8babe54c0b184d1c71d515dc1a35aedcb772169ef06ade4fe5d7f162086aaa2a
Comparison
I tested it with gltf_viewer using the Bistro scene.
Without tighter caster culling:

With tighter caster culling:

We can observe that the frame time is slightly lower in the image below.