Skip to content

Performance: Render dense lines as bands - #260

Merged
emilk merged 9 commits into
mainfrom
emilk/band-shape-lines
Sep 23, 2026
Merged

emilk merged 9 commits into
mainfrom
emilk/band-shape-lines

Conversation

@emilk

@emilk emilk commented Sep 2, 2026 •

Copy link
Copy Markdown
Owner

Agreggate high-resolution plot line series into varying-width "bands".

This greatly lessens the load on the egui tessellator.

In the benchmark I added in #258:

  • Total 10ms -> 3.5ms
  • egui_plot 0.5 ms -> 1.0ms
  • Tessellation 9.5 ms -> 2.5ms

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

View snapshot changes at kitdiff

@emilk emilk changed the title Render dense lines as bands Performance: Render dense lines as bands Sep 2, 2026
@emilk emilk added the enhancement New feature or request label Sep 2, 2026
@emilk emilk mentioned this pull request Sep 2, 2026
@emilk emilk added the include in changelog This change will be included in the changelog label Sep 6, 2026
emilk added a commit to emilk/egui that referenced this pull request Sep 22, 2026
Add `BandShape` to epaint, supporting and varying width band along some
direction.

This can be useful in egui_plot, e.g. for filling the area under a
curve, or for visualizing a audio waveform, for instance.

The band has feathering for the fill, plus an optional stroke that is
just drawn on top of the fill.

This solves a small subset of non-convex polygons (since the general
solution is quite difficult, at least if you want feathered edges).

<img width="493" height="180" alt="Screenshot 2026-09-01 at 20 56 33"
src="https://github.com/user-attachments/assets/f79ae9bc-3512-4c87-b166-d1240a8dd3e4"
/>

Includes an interactive waveform demo and alpha screenshot coverage.

Related work:

- #513
- emilk/egui_plot#260

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Resolve conflicts:
* `Cargo.toml`: point the `egui` patch at `main` (the band-shape work has landed there)
* `Cargo.lock`: take `main`, then update the `egui` git deps
* `series.rs`: keep the existing `Color32` import and drop the now-unused `Id`

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@emilk
emilk marked this pull request as ready for review September 22, 2026 10:41
@emilk
emilk merged commit a9d6c96 into main Sep 23, 2026
10 checks passed
@emilk
emilk deleted the emilk/band-shape-lines branch September 23, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request include in changelog This change will be included in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant