Fix GPU-clustered decals vanishing at steep camera pitch#24954
Open
Ijtihed wants to merge 1 commit into
Open
Conversation
Contributor
|
Welcome, new contributor! Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨ |
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.
Objective
Fixes #24918. with GPU clustering on
Solution
When the camera looks steeply down everything visible is closer than the first slice depth so
assign_objects_to_clustersclamps the grid'sfardown tonear.calculate_cluster_factorsthen divides byln(far / near) == 0and the factors go infinite.the shader (
cluster_raster.wgsl) rebuiltz_near/z_farback out of those factors withexp()andexp(inf / inf)is NaN so every cluster/object intersection test failed and nothing got clustered. (that rebuild was also broken for single Z slice grids.)this just passes
near/farto the shader directly in a newcluster_z_boundsfield on theLightsuniform and drops the shader-side rebuild. #23438 is in the same area but a separate bug.Testing
madethe issue's scene and rendered it at fixed pitches on Linux/Vulkan (GTX 1660 SUPER) and counted decal pixels. before: 0 decal pixels from -50 to -90 degrees. after: matches the CPU clustering path exactly at every pitch. the interactive repro from #24918 also confirms it (decals gone past ~-50, SPACE toggles CPU clustering and brings them back with the fix both look the same)
Showcase
straight down (-90) GPU clustering, before vs after: