Skip to content

improve: pre-blur density FBO for smooth normal computation #7

@jayf0x

Description

@jayf0x

Problem

The in-shader Sobel kernel (8 taps) approximates normals but can't fully eliminate specular aliasing at all resolutions.

Proposed change

Add a blurDensity FBO (same dimensions as density). Run two separable Gaussian blur passes (horizontal + vertical, ~5 taps each) once per frame before the display pass. Bind the blurred texture as the source for normal computation only — the raw density FBO still drives color and alpha.

Acceptance criteria

  • blurDensity FBO created, same dimensions as density FBO
  • Two-pass separable blur runs before display pass
  • Normal computation reads from blurred FBO, not raw density
  • Color/alpha still driven by raw density FBO
  • No regression in existing visual tests

Cost: 2 extra render passes per frame, ~10 texture taps total.

Files likely touched: src/core/shaders.ts, src/core/wgsl-shaders.ts, src/core/simulation.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:renderShaders, FBOs, display passeffort:3Medium — half to full daytype:improvementEnhances existing behaviour

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions