Skip to content

Diffusion/decay art knobs: afterglow, decay-gamma, separable Gaussian, diffuse-weight - #38

Merged
tamirelazar merged 8 commits into
devfrom
feat/diffusion-decay-art-knobs
Jun 18, 2026
Merged

Diffusion/decay art knobs: afterglow, decay-gamma, separable Gaussian, diffuse-weight#38
tamirelazar merged 8 commits into
devfrom
feat/diffusion-decay-art-knobs

Conversation

@tamirelazar

Copy link
Copy Markdown
Owner

Implements lever 7 (#30): four art-direction knobs on the diffusion/decay stage. All global-OFF / back-compat-neutral by default — a bare run and every existing preset are byte-identical to before; the 47 visual-regression goldens are unchanged.

Knobs (CLI + saved-config + per-preset default)

  • --afterglow <0..1> + --afterglow-rate <α>: EMA afterglow buffer (afterglow_lag) folded into the blended trail before downsampling, so the glow participates in white-point normalization. Luminous lingering tails. Default 0.0 (off).
  • --decay-gamma <0.25..2.0>: value-dependent decay new = cur·(1 − (1−factor)·(cur/peak)^(1−γ)). γ<1 lengthens faint tails without blooming cores; γ=1 delegates to the existing decay (byte-identical). Default 1.0.
  • --diffusion-sigma range widened 0.5–2.0 → 0.5–4.0, backed by a separable Gaussian (two 1D passes, radius ceil(3σ)) routed only when σ>2.0 — the existing 5×5/3×3 paths are untouched.
  • --diffuse-weight <0..1>: Lague blend new = old·(1−w) + blur·w. w=1.0 is a full-weight fast path, byte-identical to today. Default 1.0.

Design notes

  • Afterglow is a render-time fold into the transient blended buffer; it never mutates the trail map (sim dynamics unchanged). Wired at all five render entry points (interactive runner + print/capture/gif/webm export modes).
  • New knobs live in SimConfig; saved-config fields are Option<T> with #[serde(default)] so old TOML loads unchanged. The four new validation rules are enforced in SimConfig::validate.
  • No per-frame heap allocation on the default path: the afterglow EMA buffer is allocated once on enable; the diffuse-weight snapshot buffer is reused and only taken when w<1.0.

Verification

  • 789 lib tests + 47 goldens (unchanged) + clippy -D warnings clean + fmt clean.
  • Empirical same-seed check: every knob at its off/neutral value is byte-identical to baseline; on-values produce different frames with sensible direction (afterglow +46%, decay-gamma 0.5 +318%, wider sigma +27% lit cells).
  • Benches added for separable Gaussian, decay-gamma, afterglow EMA.

Spec: docs art-direction levers design §4–§8 (lever 7).

@tamirelazar
tamirelazar merged commit 6db2d09 into dev Jun 18, 2026
3 checks passed
@tamirelazar
tamirelazar deleted the feat/diffusion-decay-art-knobs branch June 18, 2026 15:56
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.

1 participant