Skip to content

feat(wave): output Gaussian-style blur as super-sample alternative (refs #3122 A4) - #3145

Merged
zackees merged 1 commit into
masterfrom
feat/3122-a4-output-blur
Jun 16, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/3122-a4-output-blur

Conversation

@zackees

@zackees zackees commented Jun 16, 2026 •

Copy link
Copy Markdown
Member

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

API

// On WaveFxArgs:
fl::u8 output_blur_amount = 0;   // 0 disables. 32-128 ≈ SUPER_SAMPLE_2X
fl::u8 output_blur_passes = 1;

// On WaveFx (FL_NOEXCEPT):
void setOutputBlur(fl::u8 amount, fl::u8 passes = 1);
fl::u8 getOutputBlurAmount() const;
fl::u8 getOutputBlurPasses() const;

Runs in WaveFx::draw() after mCrgbMap->mapWaveToLEDs() via fl::blur2d (which already handles the LED grid topology including serpentine).

Cost comparison

Mode Cost vs scalar Visual quality
SuperSample::NONE + output_blur=64 ~1.1× comparable to SS-2X on smooth fields
SuperSample::SUPER_SAMPLE_2X (current default) ~8× smooth
SuperSample::SUPER_SAMPLE_4X ~64× very smooth
SuperSample::SUPER_SAMPLE_8X ~512× overkill

Per the research doc: super-sample wins on hard edges (half-duplex zero floor) but WaveFx is rarely used at hard edges.

What's NOT in this PR

Deliberate slicing:

Validation

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

Refs #3122 A4, #3112 research doc §A1, #3113 parent meta.

Summary by CodeRabbit

  • New Features
    • Wave effect now supports optional post-process blur for smoother output. Configure blur amount and number of passes as a lightweight alternative to supersampling.

…efs #3122 A4)

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.
@coderabbitai

coderabbitai Bot commented Jun 16, 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: 13e48654-ab1d-41fe-826e-55c8af556e34

📥 Commits

Reviewing files that changed from the base of the PR and between b239334 and fee7c24.

📒 Files selected for processing (1)
  • src/fl/fx/2d/wave.h

📝 Walkthrough

Walkthrough

WaveFx gains optional post-render output blur. WaveFxArgs adds output_blur_amount and output_blur_passes fields. The constructor wires these into a new setOutputBlur() method; draw() conditionally runs fl::blur2d over the LED buffer for the configured number of passes when blur amount is nonzero.

Changes

WaveFx Output Blur

Layer / File(s) Summary
Blur config fields and member storage
src/fl/fx/2d/wave.h
Adds fl/gfx/blur.h include, output_blur_amount and output_blur_passes fields to WaveFxArgs, and private mOutputBlurAmount/mOutputBlurPasses members with default values.
setOutputBlur API and draw() integration
src/fl/fx/2d/wave.h
Constructor applies args via setOutputBlur(); adds public setOutputBlur(), getOutputBlurAmount(), and getOutputBlurPasses(); draw() runs fl::blur2d on context.leds for mOutputBlurPasses iterations when mOutputBlurAmount > 0.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A wave rolls in with colors bright,
Then blur smooths out each pixel's light.
Two passes, one—the rabbit picks,
No supersampling needed tricks!
🐇✨ Soft edges bloom across the grid.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/3122-a4-output-blur

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.

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.

1 participant