Skip to content

ambient: the page wash dithers on every frame, at ~60 fps - #142

Merged
GLinnik21 merged 2 commits into
mainfrom
land/ambient-dither
Sep 19, 2026
Merged

GLinnik21 merged 2 commits into
mainfrom
land/ambient-dither

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

ambient: the page wash dithers on every frame, at ~60 fps

The owner reported banding on the ambient background during animations.
gfx::page_wash_dither read the frame's global motion verdict, and every
spring reports to it, including AmbientWash::step's own twelve corner
springs. As a result the wash drew undithered for its whole colour dissolve
and for every focus pop, shelf scroll and press dip on the page.

The gate is gone. The wash dithers on every frame, and the cost that
originally justified the gate was removed at its sources:

  • dither.glsl: the noise tile coordinate is a varying from the paired
    vertex shader (glsl_vs_dithered!, PLX_DITHER_NC). It is no longer a
    highp multiply of gl_FragCoord per fragment.
  • dither.glsl: the prelude is straight-line code. The uniform branch cost
    +5.8M arithmetic words a frame on a scrolling Library. The "dither off"
    case uses a plain twin program.
  • fs_img: card interiors beyond the rim's reach return the texel before
    the rounded-rect SDF runs (u_inner, gfx::card_inner).
  • fs_ambient: the bilinear field is evaluated per vertex of a 16x16-cell
    mesh (gfx::field_mesh, error under half a code). Per fragment, the
    wash is now one varying plus the dither.

Deleted: gfx::page_wash_dither, idle::underlay_moving and
note_underlay_motion. draw_ambient, Painter::ambient and
AmbientWash no longer take a dither flag. Detail's TextView wrap goes
through the global wrap_memo when the measurer's font is live.

Measured on the TV, two runs each: hero 60, fold 57 (robust min 55),
grid 58/57, detail 59/58, settings 60, library 60, account glass 58.
Capture taken mid-dive: the band under Home's hero has an adjacent-pixel
change of ~0.70 with dither, against 0.023 with the old gate (flat
plateaus). The census is in docs/backdrop-blur-profiling.md.

First of the ambient layers: dither fix, then the underlay field, modal dims, the stress bench, panel material, and transition hitches.

🤖 Generated with Claude Code

The owner reported banding on the ambient background during animations.
`gfx::page_wash_dither` read the frame's global motion verdict, and every
spring reports to it, including `AmbientWash::step`'s own twelve corner
springs. As a result the wash drew undithered for its whole colour dissolve
and for every focus pop, shelf scroll and press dip on the page.

The gate is gone. The wash dithers on every frame, and the cost that
originally justified the gate was removed at its sources:

- dither.glsl: the noise tile coordinate is a varying from the paired
  vertex shader (`glsl_vs_dithered!`, `PLX_DITHER_NC`). It is no longer a
  highp multiply of `gl_FragCoord` per fragment.
- dither.glsl: the prelude is straight-line code. The uniform branch cost
  +5.8M arithmetic words a frame on a scrolling Library. The "dither off"
  case uses a plain twin program.
- fs_img: card interiors beyond the rim's reach return the texel before
  the rounded-rect SDF runs (`u_inner`, `gfx::card_inner`).
- fs_ambient: the bilinear field is evaluated per vertex of a 16x16-cell
  mesh (`gfx::field_mesh`, error under half a code). Per fragment, the
  wash is now one varying plus the dither.

Deleted: `gfx::page_wash_dither`, `idle::underlay_moving` and
`note_underlay_motion`. `draw_ambient`, `Painter::ambient` and
`AmbientWash` no longer take a dither flag. Detail's TextView wrap goes
through the global `wrap_memo` when the measurer's font is live.

Measured on the TV, two runs each: hero 60, fold 57 (robust min 55),
grid 58/57, detail 59/58, settings 60, library 60, account glass 58.
Capture taken mid-dive: the band under Home's hero has an adjacent-pixel
change of ~0.70 with dither, against 0.023 with the old gate (flat
plateaus). The census is in docs/backdrop-blur-profiling.md.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 19, 2026 05:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Correct physical-coordinate handling for supersampled rendering and the live-font wrap documentation still need updates.

Review effort: Lite
Findings: None

What changed in this PR

This PR removes motion-based dithering gates for ambient washes, reduces rendering cost, and memoizes live-font text wrapping.

Changes:

  • Always dither ambient washes.
  • Move dithering and ambient-field work to vertex/mesh paths.
  • Optimize card interiors and update live-font wrapping.
File Summary
rust-modules/​src/​ui/​widgets.rs Simplifies ambient wash drawing and capability handling.
rust-modules/​src/​ui/​text_view.rs Adds live-font wrap memoization; documentation needs the live-font exception.
rust-modules/​src/​ui/​rec.rs Propagates measurement capabilities.
rust-modules/​src/​ui/​popover.rs Removes underlay-motion publication.
rust-modules/​src/​ui/​mod.rs Simplifies the ambient painter API.
rust-modules/​src/​ui/​machine.rs Adds Measure::live_font.
rust-modules/​src/​ui/​idle.rs Removes obsolete underlay-motion state.
rust-modules/​src/​ui/​CLAUDE.md Updates dithering guidance.
rust-modules/​src/​text.rs Marks TTF measurement as live.
rust-modules/​src/​shaders/​vs_img.vert Adds dither coordinates; physical render-scale handling needs correction.
rust-modules/​src/​shaders/​vs_ambient.vert Adds mesh-field and dither varyings; physical viewport handling needs correction.
rust-modules/​src/​shaders/​fs_img.frag Adds the card-interior fast path.
rust-modules/​src/​shaders/​fs_glass.frag Updates dither documentation.
rust-modules/​src/​shaders/​fs_ambient.frag Uses interpolated field colors.
rust-modules/​src/​shaders/​dither.glsl Removes branching and fragment-coordinate arithmetic; coordinate scaling needs correction.
rust-modules/​src/​shaders/​dither_stub.glsl Updates plain-program behavior.
rust-modules/​src/​screens/​home/​mod.rs Removes the wash gate and related plumbing.
rust-modules/​src/​screens/​detail/​mod.rs Removes detail wash gating.
rust-modules/​src/​gfx.rs Adds field meshes, shader variants, and card optimization.
rust-modules/​src/​app/​run.rs Removes obsolete motion-gate documentation.
docs/​backdrop-blur-profiling.md Records performance measurements and rationale.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@GLinnik21
GLinnik21 merged commit ba7aebb into main Sep 19, 2026
5 checks passed
@GLinnik21
GLinnik21 deleted the land/ambient-dither branch September 19, 2026 06:16
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.

2 participants