Skip to content

research(wave): state-of-the-art survey for 2D wave PDE alternatives (closes #3111) - #3112

Merged
zackees merged 1 commit into
masterfrom
research/3111-wave-pde-alternatives
Jun 15, 2026
Merged

zackees merged 1 commit into
masterfrom
research/3111-wave-pde-alternatives

Conversation

@zackees

@zackees zackees commented Jun 15, 2026 •

Copy link
Copy Markdown
Member

Delivers the research-mission deliverable specified by #3111: a definitive recommendation document at agents/docs/research/wave_pde_alternatives.md.

What's in the doc

  • Coverage of all 10 approach families from the issue's search catalog: compact higher-order stencils, output anti-aliasing filters, implicit time integration, spectral/FFT, lattice Boltzmann, procedural/non-PDE, adaptive mesh refinement, low-precision Q7/Q8, embedded industry SOTA, post-process AA.
  • Embeddability scoring matrix per candidate (AVR / Cortex-M0 / Cortex-M4+ / ESP32-S3 / Host) with cycles-per-cell estimates and explicit RAM overhead.
  • Inline citations to ~25 papers + open-source implementations.
  • Explicit non-recommendations with reasons (so future research doesn't re-walk dead ends).

Top 3 recommendations (each PR-able as a focused follow-up)

  1. Compact O(h⁴) 9-point Laplacian — same memory pattern as the existing isotropic 9-point from feat(wave): opt-in 9-point isotropic Laplacian for WaveSimulation2D (closes #3095) #3104, but O(h⁴) accuracy. Drop-in third stencil option at the existing selection switch.
  2. Output Gaussian blur as an alternative to super-sample — addresses super-sample's real motivation (AA on the rendered LED grid) at 1.05–1.2× scalar cost vs 8–512× for SS 2X/4X/8X.
  3. WaveProceduralFx — sum-of-Gerstner-wavelets ripple synthesizer — bypasses the PDE entirely. Zero grid memory, O(N_wavelets) per cell. Especially strong on AVR / Low-memory targets.

Holds reaffirmed

The pending SIMD work (#3106 / #3107 / #3108) stays on hold. Items 1, 2, 4 from the recommendation list each beat SIMD's typical 4–8× speedup, and the algorithmic wins compose with later SIMD tuning.

Validation

bash lint — clean.
Document is markdown-only; no code changes.

Closes #3111
Refs #3098 (parent audit meta — CLOSED), #3104 (9-point Laplacian), #3110 (UI toggle)

Summary by CodeRabbit

  • Documentation
    • Added comprehensive research documentation surveying alternative numerical and rendering techniques for wave simulation optimization, including analysis of visual quality and performance tradeoffs and evaluation of potential implementation approaches.

Delivers the research-bot deliverable specified by #3111: a definitive
recommendation document covering the 10 approach families catalogued in
the issue body (compact higher-order stencils, output anti-aliasing
filters, implicit time integration, spectral/FFT, lattice Boltzmann,
procedural/non-PDE, adaptive mesh refinement, low-precision Q7/Q8
storage, industry SOTA, anti-aliasing post-process).

Each candidate is scored against the FastLED embeddability matrix
(AVR / Cortex-M0 / Cortex-M4+ / ESP32-S3 / Host) with cycles-per-cell
estimates and explicit RAM overhead. Non-recommendations are
catalogued with reasons so future research doesn't re-walk dead ends.

Headline findings, after surveying ~25 papers + open-source impls:

1. Compact O(h^4) 9-point Laplacian (Walstijn-Kowalczyk style; Thampi-
   Ansumali Patra-Karttunen family) — same memory access pattern as
   the existing isotropic 9-point added in #3104, but O(h^4) accuracy
   instead of O(h^2). Drop-in win at the existing stencil-selection
   switch. *Top recommendation.*

2. Output Gaussian blur (separable 3x3) as an explicit alternative to
   super-sample. Super-sample's primary user benefit is AA on the
   rendered LED grid, not better physics — a screen-space blur
   delivers comparable visual quality at 1.05-1.2x scalar cost vs
   8-512x for SuperSample 2X/4X/8X. *Second recommendation.*

3. WaveProceduralFx — a sum-of-Gerstner-wavelets ripple synthesizer
   that bypasses the PDE entirely. For AVR / Low-memory targets where
   neither the scalar PDE nor compact-4 fits well, this is dramatically
   cheaper (zero grid memory, O(N_wavelets) per cell) and visually
   strong. References Finch (NVIDIA GPU Gems Ch.1), Quilez Simple
   Water, and Tessendorf-without-FFT. *Third recommendation.*

Conditional finds (worth implementing only on specific platforms):
- ADI implicit time integration (ESP32-S3 with PSRAM only)
- Tessendorf FFT propagation (ESP32-S3+ only — uses CMSIS-DSP)

Explicit dead ends:
- TAA: no motion vectors in static-camera wave field
- LBM D2Q5: memory cost rules out AVR/M0
- Crank-Nicolson: strictly dominated by ADI for our topology
- SMAA/FXAA: wrong scale (designed for 1080p+, not 16x16)
- 13-point/17-point stencils: diminishing returns past O(h^4)

Also recommends three new sub-issues spawned from items 1/2/3, and
explicitly puts the pending SIMD work (#3106/#3107/#3108) on hold —
items 1, 2, 4 above each beat SIMD's typical 4-8x speedup, and the
algorithmic wins compose with later SIMD tuning.

Document is ~4500 words, 25 inline citations, structured per the
output schema specified in the issue body. Lives at
agents/docs/research/wave_pde_alternatives.md.

Closes #3111
Refs #3098 (parent audit meta), #3104 (9-point Laplacian), #3110
(UI toggle)
@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fcc577ea-0341-495d-a7f6-234a278fa311

📥 Commits

Reviewing files that changed from the base of the PR and between 9bb097d and 0fa2914.

📒 Files selected for processing (1)
  • agents/docs/research/wave_pde_alternatives.md

📝 Walkthrough

Walkthrough

Adds agents/docs/research/wave_pde_alternatives.md, a 343-line research report surveying eight families of numerical and rendering alternatives to the current super-sample leapfrog approach in WaveSimulation2D/WaveFx. The document includes a scoring rubric, candidate analysis, non-recommendations, follow-up sub-issue proposals, and a bibliography. Closes #3111.

Changes

Wave PDE Alternatives Research Report

Layer / File(s) Summary
Mission scope, executive summary, and short-list
agents/docs/research/wave_pde_alternatives.md
Introduces the #3111 research scope, quantifies super-sample cost assumptions, and presents the executive summary table plus three immediate implementation candidates (9-point 4th-order Laplacian, output Gaussian blur, WaveProceduralFx).
Embeddability rubric and candidate analysis: AA, stencils, implicit, FFT
agents/docs/research/wave_pde_alternatives.md
Defines the platform embeddability scoring matrix (AVR, Cortex-M0/M4/M7, ESP32) and evaluates method families A–D with cost estimates, visual quality ratings, and per-method recommendations.
Candidate analysis: LBM, procedural, sparse, fixed-point
agents/docs/research/wave_pde_alternatives.md
Covers method families E–H (Lattice Boltzmann D2Q5, Gerstner/sinusoid wavelets, adaptive sparse updates, low-precision storage) with per-target feasibility ratings and explicit skips.
Non-recommendations and follow-up sub-issues
agents/docs/research/wave_pde_alternatives.md
Enumerates dead ends (SMAA/FXAA, full AMR, etc.) and proposes titled follow-up sub-issues for near-term implementation work.
Bibliography and cross-references
agents/docs/research/wave_pde_alternatives.md
Appends the full bibliography and links to prior related audits, PRs, and issues, closing the research issue.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐇 A rabbit dove deep into wave math one day,
Counting stencils and cycles along the way.
"Super-sample is costly," the bunny declared,
"A Gaussian blur or Gerstner wave — much better prepared!"
With bibliography penned and dead ends crossed out,
The research doc landed — no room left for doubt. 🌊

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch research/3111-wave-pde-alternatives

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit fa59674 into master Jun 15, 2026
1 check passed
@zackees
zackees deleted the research/3111-wave-pde-alternatives branch June 15, 2026 23:07
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 15, 2026
zackees added a commit that referenced this pull request Jun 16, 2026
…efs #3122 A4) (#3145)

A4 of meta #3122. Implements #3112 research doc §A1 recommendation —
addresses super-sample's actual user motivation (LED-grid anti-aliasing
on smooth fields) at ~1.2x scalar cost vs 8-512x for true super-sample.

## API

Two new fields on WaveFxArgs:
  fl::u8 output_blur_amount = 0;  // 0 disables. 32-128 ≈ SUPER_SAMPLE_2X
  fl::u8 output_blur_passes = 1;

Runtime setter on WaveFx (FL_NOEXCEPT):
  void setOutputBlur(fl::u8 amount, fl::u8 passes = 1);
  fl::u8 getOutputBlurAmount() const;
  fl::u8 getOutputBlurPasses() const;

The blur runs in WaveFx::draw() after mCrgbMap->mapWaveToLEDs() via the
existing fl::blur2d (which already takes an XYMap and handles the LED
grid topology including cylindrical / serpentine).

## What's NOT in this PR

Deliberate slicing:
- Defaulting SuperSample to NONE wholesale — that's a wider behavioral
  change that should land separately after users have evaluated the
  blur quality. Today's PR is opt-in (amount=0 is the default).
- New UI checkbox in the example sketches — separate slice; current
  WaveFx users can wire setOutputBlur() into their existing UI loop
  similarly to how #3110 added the stencil toggle.
- Bench numbers from --wave2d-perf — separate slice, requires hardware
  on desk.

## Validation

- bash lint --cpp — clean.
- bash compile wasm --examples Wave2d — build clean.

Cost-vs-quality breakdown vs SuperSample on a 16x16+ grid with gradient
palette (from the #3112 research doc):
  SUPER_SAMPLE_NONE + output_blur=64: ~1.1x baseline cost
  SUPER_SAMPLE_2X (current default):  ~8x baseline cost
  SUPER_SAMPLE_4X:                    ~64x baseline cost

The blur path is roughly comparable visually to SUPER_SAMPLE_2X on
smooth wave fields; super-sample wins on hard edges (e.g. half-duplex
zero floor) but WaveFx is rarely used at hard edges.

Refs #3122 A4, #3112 research doc §A1, #3113 parent meta.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

research: state-of-the-art alternatives to super-sample for visual quality in 2D wave PDE (Wave2d / WaveFx) — define research bot + search catalog

1 participant