5/claude-sonnet#19
Open
jayf0x wants to merge 1 commit into
Open
Conversation
When densityDissipation=1.0 the splat shader accumulates density unboundedly in the FBO. Clamping to [0,1] in the display shader (both GLSL and WGSL) before specular/color calculations eliminates the saturated halo artifact. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Fixes #5.
Approach
When
densityDissipation=1.0, the splat shader adds density to the FBO each frame with no decay, causing values to accumulate unboundedly above 1.0. The specular term (specDen = density * min(density * 5.0, 1.0)) then explodes with those supra-1 values, producing a persistent halo/glow.The fix clamps both the primary
densityread and all eight Sobel neighbour samples to[0.0, 1.0]in the display shader — applied to both the GLSL (shaders.ts) and WGSL (wgsl-shaders.ts) variants. This is a display-only clamp: FBO data is left untouched, keeping the approach non-destructive and scoped to the rendering path.No behaviour changes at normal dissipation values (< 1.0) since those values never exceed 1.0 in practice.
🤖 Generated with Claude Code