Skip to content

5/claude-sonnet#19

Open
jayf0x wants to merge 1 commit into
mainfrom
claude-sonnet-4-6
Open

5/claude-sonnet#19
jayf0x wants to merge 1 commit into
mainfrom
claude-sonnet-4-6

Conversation

@jayf0x

@jayf0x jayf0x commented Jun 4, 2026

Copy link
Copy Markdown
Owner

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 density read 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

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>
@jayf0x jayf0x changed the title fix: clamp density in display shader to prevent glow at densityDissipation=1 5/claude-sonnet Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: density accumulation glow when densityDissipation=1

1 participant