Skip to content

✨ feat(rendering): smooth annotations and refine mask outlines - #132

Merged
cfviotti merged 19 commits into
mainfrom
exp/mask-edge-smoothing
Oct 14, 2026
Merged

cfviotti merged 19 commits into
mainfrom
exp/mask-edge-smoothing

Conversation

@cfviotti

@cfviotti cfviotti commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Horse Trail whole frame and marked ear detail; main, PR AA off and standard FXAA with 2px borders, DPR 1 and settled masks.

The top views locate the foreground horse; the pink box marks its ear edge. In the comparison rows, read left to right: main, this PR with AA off, then standard FXAA. All three use the same Horse frame, a 2px border setting, DPR 1, and settled 758px masks. The bottom row enlarges the same ear edge 8x. This is image zoom; rendering density stays at 1x.

The middle column already uses this PR's corrected border coverage. Compare middle to right for the extra FXAA effect; compare left to middle for the border repair. The video and label text stay outside the FXAA pass.

Original lossless renderer PNGs: main · PR, AA off · PR, standard FXAA.

Description

Add optional annotation smoothing and fix inconsistent mask border thickness, focus dimming over annotation outlines, rectangular anomaly focus cutouts, and square corners on standalone mask labels. Paused mask style changes also recover settled detail after fast scrubbing.

Optional annotation smoothing

Enable standard FXAA across annotation layers, including focus and interaction, with annotationAntialiasing: true. Video pixels stay outside the smoothing pass; label backgrounds are smoothed while glyphs render at output density. Smoothing defaults to off.

The public option is annotationAntialiasing: false | true | 2. See presentation styles. All smoothing screenshots here use standard FXAA, without the optional higher density.

Mask border width and placement

Interpret stroke.width as the total width in CSS pixels, across clip sizes, DPR changes, resize and camera zoom. On main, the same width setting looks thinner on the narrow Horse canvas than on the wide basketball canvas.

Horse and Basketball overviews mark the mask edges; the same 2px setting on main versus this PR at identical 8x detail, with FXAA off.

The pink boxes locate the foreground horse's left mask edge and the center white player's torso. In both detail rows, left is main and right is this PR, with total 2 CSS px and the new Outside default. Both detail rows use the same 8x image zoom, so their border thickness can be compared. The overview sizes differ. This also changes the old border placement.

Support Outside, Center, and Inside placement, with Outside as the default. See mask styles.

Whole Horse frame and marked left mask edge; the same 2px Outside, Center and Inside outlines compared at 8x detail with FXAA off.

The pink box locates the left edge of the foreground horse. In the detail row, all three outlines have the same total 2px width. Outside adds cyan over the background; Inside replaces blue mask fill; Center splits the width across the boundary. These are the same pixel coordinates at 8x image zoom.

AA off bypasses FXAA; the mask border still uses fractional pixel coverage. A straight stroke aligned to the output pixel grid can have crisp, fully opaque border pixels. When an edge falls between pixels or runs diagonally, partly covered pixels blend with the fill or background. A 2px stroke may therefore cover two full pixels, or a shifted stroke may have coverage like ½ + 1 + ½. Its total width remains 2 CSS px. There is no separate hard-edged mask mode in this PR; mask IDs still use nearest sampling.

Focus below annotation outlines

Draw focus dimming below mask and box outlines so their borders retain color and contrast. Keep focus targets tied to the current detection frame.

Whole Horse frame and marked box corner; main dims the cyan outline while this PR preserves it above 40 percent focus dimming, at 8x detail.

The pink box marks the top-right corner of the foreground horse's bounding box. Inspect that corner in the 8x detail row. Main darkens its border along with the background; this PR preserves its brightness. Both sides use the same 40% focus dimming, with FXAA off. The adjacent mask edge also stays above the dimming layer.

Heatmap focus follows visible anomalies

Use visible anomaly pixels, including the configured cutoff and transparency, for the focus opening. Empty heatmaps leave no rectangular opening. Disable rectangle fallback with BaseFocusStyle({ shape: null }); the Pebbles demo uses this setting. See heatmap styles.

Whole Pebbles frame locates the anomalous bolt; four 3x detail panels show rectangular versus anomaly-shaped focus, FXAA, and zero opacity.

The whole-frame overview locates the bolt on the pebbles. In the four detail panels, top left: the unwanted bright rectangle extends beyond the bolt. Top right: this PR limits the opening to visible heat. Bottom left: standard FXAA smooths that same opening. Bottom right: opacity 0 removes heat and leaves no opening. The source video and heatmap are already soft; this 3x image zoom exposes their existing pixels.

Label corners follow the visible box

Round all corners when no visible box touches the label, including standalone mask labels. Square only attached corners: bottom corners above a box, top corners below it. Preserve explicit corner-style overrides. See label styles.

Horse Trail overview and cow inset locate the labels; 5x details compare standalone rounded corners and above or below box attachment.

The overview locates the horse's standalone label; the cow inset shows a label below its box. In the first detail row, the standalone horse label gains rounded bottom corners. In the second detail row, only corners that meet a visible box stay square. The label above a box has square bottom corners; the cow label below a box has square top corners. All four crops use 5x image zoom and FXAA off.

Bounded polygon preparation

Rasterize polygons directly at the bounded target resolution, avoiding full-resolution mask intermediates. Keep prepared polygon outlines consistent with display density and viewport scale.

Whole Basketball frame marks the yellow player's leg; FXAA off versus standard FXAA with 2px polygon strokes, 2x context crops and 8x pixel detail.

The pink box locates the foreground yellow player's legs. Compare the steps in the yellow leg outline with FXAA off, then their blending with standard FXAA. Masks are disabled. The bottom row uses 8x image zoom. This shows rendered appearance; it does not measure preparation speed.

Paused mask style changes recover settled detail

After fast scrubbing, changing a mask's fill or outline while paused can leave the current frame at preview resolution. Rearm its existing 150 ms refinement when the style invalidates the prepared mask. The current frame returns to settled detail, while motion previews and idle behavior remain inexpensive.

Whole Horse frame marks the ear; 8x details show main staying at a 380px preview and this PR returning to 758px after the same paused fill change.

The pink box marks the horse ear used in the 8x detail row. Both pages had settled 758px masks before the same paused fill change, from 55% to 65%. Main stays at a 380px preview; this PR returns to 758px detail. Inspect the larger steps on the left. FXAA is off. This is the only mask comparison intentionally showing preview versus settled detail.

Demo controls

  • Add mask outline alignment in Segmentation and a rectangle-fallback toggle in Focus.
  • Expose heatmap threshold scale, minimum alpha, opacity, maximum score, and color palette in Heatmap and the docs playground, with matching API snippets.
  • Keep the annotation smoothing choice in Quality when switching clips.
Readable native-size demo panel captures for standard FXAA in Quality, border alignment in Segmentation, heatmap appearance, and rectangle fallback in Focus.

These are actual panel captures at their original pixel size. Quality controls global FXAA; Segmentation controls mask detail and border placement; Heatmap controls anomaly appearance; Focus controls rectangle fallback.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation or example update
  • Refactor or maintenance
  • Performance improvement

Validation

  • Tests added or updated where behavior changed
  • Documentation updated where the public API or workflow changed
  • GitHub CI npm run verify on ed0b5e9: 3,489 tests passed, 10 skipped; lint, types, builds and package checks pass
  • Paused-restyle repair: 144 focused tests, web typechecking, lint, formatting and web build; removing the runtime fix makes the regression assertion fail
  • Headed Chrome WebGPU comparisons against main, with matched frames, viewport and DPR, covering all nine visual examples above
  • Paused-restyle browser reproduction: the same fill change on Horse frame 420 leaves main at 380px preview, while this PR returns to 758px settled detail
  • Mega Review converged after four published rounds on ed0b5e9; no open PR findings
  • Full final-head WebGL and WebGPU checks for annotation pixels, label text, focus, masks, and unchanged media
  • Complete Spring depth demo checks
  • Screenshots or recording attached for visual changes

Notes For Reviewers

Before/after screenshots compare main code at 466a2c7 with this PR at ed0b5e9, in headed Chrome using WebGPU. Within each comparison, frame, viewport and relevant settings match. Page DPR and renderer DPR are both 1. Mask examples use settled fitted rasters, except the explicitly labeled main paused-restyle failure. All smoothing examples use standard FXAA.

Every comparison is a lossless 640px-wide PNG. Renderer images come directly from the canvas before browser compositing. Reduced whole-frame overviews and pink crop markers locate the subject; actual-size insets retain the captured pixels. Detail comparisons use labeled integer nearest-neighbor magnification, so image zoom does not add blur or change rendering density. Panel captures are unresized. These screenshots show visual behavior, not performance measurements.

Mask borders may move outward because width now means total CSS-pixel thickness and the default alignment is Outside. Fractional pixel coverage also changes AA-off edges. Outline work is bounded to 16 mask texels per side, which can limit thickness at very small fitted sizes.

Smoothing is opt-in. The optional annotationAntialiasing: 2 increases preparation work, cache bytes, and GPU memory use; capture sizes stay within the renderer's texture limit. Real-renderer checks live in tools/annotation-aa.

Smooth overlays and label backgrounds while keeping media and text pixels intact. Mask outlines keep their screen width and heatmap focus follows visible anomaly coverage.
Offer Off, FXAA and FXAA + 2x in one persistent quality selector. Expose heatmap colours, threshold and opacity beside their rendered layer.
Document the annotation smoothing control, sharp labels, screen-space mask outlines and heatmap focus behavior.
Check unchanged media and glyph pixels, smoothed label chips, aligned focus coverage, screen-space borders and resource disposal in the owned headed browser. Retain the playback and human-scrub cost instruments.
@cfviotti

cfviotti commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Mega Review

Status: NOT CLEAN @ 729a824 · round 1 · full delta

Eight Warnings block. Review-clean does not replace tests, typecheck or CI.

Blocking

What is wrong Where
Warning Inside-aligned interaction outlines disappear on WebGPU because CPU uniform insertion order differs from WGSL. pixi-interaction-presentation-layer.ts:689 · new
Warning Hover and selection label text enters the FXAA capture. pixi-annotation-antialias-layer.ts:47 · new
Warning Prepared polygon outlines use media units where the shader now expects CSS pixels, and miss capture-density forwarding. pixi-polygon-layer.ts:229 · new
Warning Changing DPR on a paused native source leaves the active outline shader at the old density. pixi-mask-layer.ts:462 · new
Warning AA opening tests can pass after renderer initialization fails because the container mock lacks removeChildren. media-session.test.ts:46 · new
Warning The committed cost benchmark imports private dated notes and requires a DPR 2 display. cost-driver.mjs:22 · new
Warning Zoom evicts visible RGBA fallback masks before replacements arrive and also re-cooks unstroked fills. prepared-render-window.ts:1022 · new
Warning Enabling masks after zoom gives RGBA fallback outlines the fitted width rather than the current viewport width. pixi-media-scene.ts:1978 · new

Non-blocking

Four Minors

Caveats

Static review of the exact pushed head. No builds or tests were run by this review. All branch fixes and features remain in scope. Ticket compliance was not requested.

Review Ledger

Open findings

  • packages/web/src/renderers/pixi-interaction-presentation-layer.ts:689:INTERACTION-WGSL-UNIFORM-ORDER | Warning | packages/web/src/renderers/pixi-interaction-presentation-layer.ts:689 | Inside-aligned interaction outlines disappear on WebGPU because CPU uniform insertion order differs from WGSL.
  • packages/web/src/renderers/pixi-annotation-antialias-layer.ts:47:INTERACTION-LABELS-IN-FXAA | Warning | packages/web/src/renderers/pixi-annotation-antialias-layer.ts:47 | Hover and selection label text enters the FXAA capture.
  • packages/web/src/renderers/pixi-polygon-layer.ts:229:MASK-POLYGON-CSS-WIDTH | Warning | packages/web/src/renderers/pixi-polygon-layer.ts:229 | Prepared polygon outlines use media units where the shader now expects CSS pixels, and miss capture-density forwarding.
  • packages/web/src/renderers/pixi-mask-layer.ts:462:MASK-QUALITY-STROKE-DENSITY | Warning | packages/web/src/renderers/pixi-mask-layer.ts:462 | Changing DPR on a paused native source leaves the active outline shader at the old density.
  • packages/web/src/sessions/media-session.test.ts:46:AA-SESSION-OPEN-PROOF | Warning | packages/web/src/sessions/media-session.test.ts:46 | AA opening tests can pass after renderer initialization fails because the container mock lacks removeChildren.
  • tools/annotation-aa/cost-driver.mjs:22:AA-REPRODUCIBILITY-01 | Warning | tools/annotation-aa/cost-driver.mjs:22 | The committed cost benchmark imports private dated notes and requires a DPR 2 display.
  • packages/web/src/render-preparation/prepared-render-window.ts:1022:ZOOM-RGBA-EVICT | Warning | packages/web/src/render-preparation/prepared-render-window.ts:1022 | Zoom evicts visible RGBA fallback masks before replacements arrive and also re-cooks unstroked fills.
  • packages/web/src/render-preparation/prepared-render-window.ts:252:MASK-CACHE-ALIGNMENT-BYTES | Minor | packages/web/src/render-preparation/prepared-render-window.ts:252 | Cache byte accounting omits the retained alignment buffer.
  • packages/web/src/renderers/pixi-media-scene.ts:945:AA-RES-CLAMP | Minor | packages/web/src/renderers/pixi-media-scene.ts:945 | At the GPU cap, capture density follows the camera and the mask density clamp can disagree with the actual target.
  • tools/annotation-aa/summarize.mjs:12:AA-SUMMARY-01 | Minor | tools/annotation-aa/summarize.mjs:12 | Generated summaries claim pixel invariants passed even when the input report failed.
  • packages/web/src/renderers/pixi-media-scene.ts:1978:SCENE-LATE-MASK-SCALE | Warning | packages/web/src/renderers/pixi-media-scene.ts:1978 | Enabling masks after zoom gives RGBA fallback outlines the fitted width rather than the current viewport width.
  • packages/web/src/renderers/pixi-region-coverage-mask.ts:215:REGION-CHANNEL-DOUBLE-RECORD | Minor | packages/web/src/renderers/pixi-region-coverage-mask.ts:215 | Region coverage communicates the AA channel through a mutable Pixi field that the mask pipeline overwrites.

Prior key statuses

None.

Unresolved prior open findings

None.

Deliberate tradeoffs

None.

Refuted

  • All heatmap settings and mask alignment must persist between clips: the required persistence is for annotation AA; base useDemoRenderer.ts already resets other styles per fixture, and AA remains preserved through the actual selector path.
  • IdPolygonInstruction is a dead public export: it names the new supported argument shape of publicly exported createIdMaskFrame, alongside IdMaskInstruction in core/src/index.ts:262. Absence of internal consumers of the barrel alias is not a defect and removal would narrow the public type surface.
  • Depth and heatmap rasters should be excluded from AA: user explicitly requested all Pixi annotation layers; media-frame pixels remain excluded.

Implausible

None.

Pre-existing

  • Non-AA styles reset on fixture selection in pinned-base useDemoRenderer.ts; no demonstrated aggravation.

Masks stay visible while zoom updates their screen-pixel borders. Keep the current same-frame artifact prepared until its stroked RGBA replacement is ready, and reuse fills and ID rasters across display-width changes.

Preserve fine raster quality during replacement and count retained stroke alignment storage toward the cache byte limit.
@cfviotti

cfviotti commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Mega Review

Status: REVIEW-CLEAN @ c838627 · round 2 · narrowed to 729a824..c838627

All twelve prior findings are resolved. No Criticals or Warnings. Two Minors will be addressed before finishing the convergence loop.
Review-clean does not replace typecheck, tests or CI.

Fixed since last round

  • Interaction labels keep sharp glyphs, and WebGPU inside outlines use the correct packed uniforms.
  • Mask and polygon widths track live density and zoom; lazy masks receive the current viewport scale.
  • Zoom keeps visible RGBA masks until their replacements arrive and avoids recooking unstroked fills.
  • Cache accounting includes alignment buffers; AA opening tests require a healthy session.
  • Region coverage uses the display-owned channel; private measurement wrappers are outside the PR.

Non-blocking

Caveats

This round reviewed the repair delta and all carried keys. Untouched parts were reviewed at 729a824, so coverage accumulates across rounds. Four Codex search lanes covered all 29 delta files; Claude examined the assigned production surfaces and selected test context. Historical reads reused byte-identical spans and inspected all differences. The review executed no tests or builds. Fresh real-browser pixel checks are pending replacement of the closed reserved Chrome window. Ticket compliance was not requested.

Review Ledger

Open findings

  • packages/web/src/renderers/pixi-media-scene.ts:953:INTERACTION-DENSITY-RESIZE-STALE | Minor | packages/web/src/renderers/pixi-media-scene.ts:953 | Paused interaction outlines retain old capture density after a wide height-limited container resize.
  • packages/web/src/renderers/pixi-media-scene.ts:1306:SCENE-INTERACTION-LABEL-SLOT-UNTESTED | Minor | packages/web/src/renderers/pixi-media-scene.ts:1306 | The new production interaction-label attachment has no integration assertion; removing its attachment hides labels without failing existing checks.

Prior key statuses

  • packages/web/src/renderers/pixi-interaction-presentation-layer.ts:689:INTERACTION-WGSL-UNIFORM-ORDER | resolved | pixi-interaction-presentation-layer.ts:702-704 now matches WGSL field order; real Pixi packed-offset assertions protect the layout.
  • packages/web/src/renderers/pixi-annotation-antialias-layer.ts:47:INTERACTION-LABELS-IN-FXAA | resolved | interaction labels occupy a separate Label slot at order 700; shared filtering reaches backgrounds while glyphs stay outside annotation capture.
  • packages/web/src/renderers/pixi-polygon-layer.ts:229:MASK-POLYGON-CSS-WIDTH | resolved | polygon instructions retain CSS widths and Center alignment; actual scene forwards capture density and viewport scale to the raster owner.
  • packages/web/src/renderers/pixi-mask-layer.ts:462:MASK-QUALITY-STROKE-DENSITY | resolved | setRasterDisplay updates the active shader uniform before raster-cap invalidation, including ratios below one.
  • packages/web/src/sessions/media-session.test.ts:46:AA-SESSION-OPEN-PROOF | resolved | opening and AA toggles now require Ready status; shared Container mock supplies removeChildren.
  • tools/annotation-aa/cost-driver.mjs:22:AA-REPRODUCIBILITY-01 | resolved | private cost driver and support wrappers removed with no remaining imports; portable renderer probes remain.
  • packages/web/src/render-preparation/prepared-render-window.ts:1022:ZOOM-RGBA-EVICT | resolved | visible artifacts remain cached until valid replacements arrive; only stroked RGBA artifacts owe display-width recooking and cached fine quality remains fine.
  • packages/web/src/render-preparation/prepared-render-window.ts:252:MASK-CACHE-ALIGNMENT-BYTES | resolved | strokeAlignments byteLength is included in the budget; a boundary eviction assertion distinguishes omission.
  • packages/web/src/renderers/pixi-media-scene.ts:945:AA-RES-CLAMP | resolved | capture cap uses stable container dimensions and forwards the actual fractional capture/output ratio.
  • tools/annotation-aa/summarize.mjs:12:AA-SUMMARY-01 | resolved | unconditional formatter removed; remaining report aggregation derives failed or complete from collected errors.
  • packages/web/src/renderers/pixi-media-scene.ts:1978:SCENE-LATE-MASK-SCALE | resolved | lazy masks receive current viewportScale before presentation; public-entry test distinguishes current zoom width from fitted width.
  • packages/web/src/renderers/pixi-region-coverage-mask.ts:215:REGION-CHANNEL-DOUBLE-RECORD | resolved | coverage render returns alpha-coverage boolean to the real consumer, which sets the display-owned channel.

Unresolved prior open findings

None.

Deliberate tradeoffs

None.

Refuted

  • All heatmap settings and mask alignment must persist between clips: the required persistence is for annotation AA; base useDemoRenderer.ts already resets other styles per fixture, and AA remains preserved through the actual selector path.
  • IdPolygonInstruction is a dead public export: it names the new supported argument shape of publicly exported createIdMaskFrame, alongside IdMaskInstruction in core/src/index.ts:262. Absence of internal consumers of the barrel alias is not a defect and removal would narrow the public type surface.
  • Depth and heatmap rasters should be excluded from AA: user explicitly requested all Pixi annotation layers; media-frame pixels remain excluded.

Implausible

None.

Pre-existing

  • Non-AA styles reset on fixture selection in pinned-base useDemoRenderer.ts; no demonstrated aggravation.

@cfviotti

cfviotti commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Mega Review

Status: REVIEW-CLEAN @ ae5536c · converged after 3 rounds · narrowed to c838627..ae5536c

No open findings. Both prior Minors are resolved; earlier resolved keys remain closed.
Review-clean does not replace typecheck, tests or CI.

Fixed since last round

  • Selected mask outlines refresh their capture density immediately when a paused container resizes.
  • A public-renderer regression checks selected labels stay attached, keep sharp glyphs, share background smoothing and preserve paint order.

Caveats

This round reviewed the 225-line repair delta in three files plus both carried keys. The untouched PR was reviewed in earlier rounds, so the clean verdict covers the accumulated rounds rather than a fresh full pass. Two Codex search lanes, one Claude lane and a bounded carried-key verifier completed static inspection; all changed files were read in full. Historical comparisons reused byte-identical current spans. The review executed no tests or builds. Fresh real-browser pixel checks remain pending replacement of the closed reserved Chrome window. Ticket compliance was not requested.

Review Ledger

Open findings

None.

Prior key statuses

  • packages/web/src/renderers/pixi-interaction-presentation-layer.ts:689:INTERACTION-WGSL-UNIFORM-ORDER | resolved | pixi-interaction-presentation-layer.ts:702-704 now matches WGSL field order; real Pixi packed-offset assertions protect the layout.

  • packages/web/src/renderers/pixi-annotation-antialias-layer.ts:47:INTERACTION-LABELS-IN-FXAA | resolved | interaction labels occupy a separate Label slot at order 700; shared filtering reaches backgrounds while glyphs stay outside annotation capture.

  • packages/web/src/renderers/pixi-polygon-layer.ts:229:MASK-POLYGON-CSS-WIDTH | resolved | polygon instructions retain CSS widths and Center alignment; actual scene forwards capture density and viewport scale to the raster owner.

  • packages/web/src/renderers/pixi-mask-layer.ts:462:MASK-QUALITY-STROKE-DENSITY | resolved | setRasterDisplay updates the active shader uniform before raster-cap invalidation, including ratios below one.

  • packages/web/src/sessions/media-session.test.ts:46:AA-SESSION-OPEN-PROOF | resolved | opening and AA toggles now require Ready status; shared Container mock supplies removeChildren.

  • tools/annotation-aa/cost-driver.mjs:22:AA-REPRODUCIBILITY-01 | resolved | private cost driver and support wrappers removed with no remaining imports; portable renderer probes remain.

  • packages/web/src/render-preparation/prepared-render-window.ts:1022:ZOOM-RGBA-EVICT | resolved | visible artifacts remain cached until valid replacements arrive; only stroked RGBA artifacts owe display-width recooking and cached fine quality remains fine.

  • packages/web/src/render-preparation/prepared-render-window.ts:252:MASK-CACHE-ALIGNMENT-BYTES | resolved | strokeAlignments byteLength is included in the budget; a boundary eviction assertion distinguishes omission.

  • packages/web/src/renderers/pixi-media-scene.ts:945:AA-RES-CLAMP | resolved | capture cap uses stable container dimensions and forwards the actual fractional capture/output ratio.

  • tools/annotation-aa/summarize.mjs:12:AA-SUMMARY-01 | resolved | unconditional formatter removed; remaining report aggregation derives failed or complete from collected errors.

  • packages/web/src/renderers/pixi-media-scene.ts:1978:SCENE-LATE-MASK-SCALE | resolved | lazy masks receive current viewportScale before presentation; public-entry test distinguishes current zoom width from fitted width.

  • packages/web/src/renderers/pixi-region-coverage-mask.ts:215:REGION-CHANNEL-DOUBLE-RECORD | resolved | coverage render returns alpha-coverage boolean to the real consumer, which sets the display-owned channel.

  • packages/web/src/renderers/pixi-media-scene.ts:953:INTERACTION-DENSITY-RESIZE-STALE | resolved | observer redraw at pixi-media-scene.ts:1048 forwards the updated capture density; native-mask resize test retains frame/texture identity while requiring an immediate interaction redraw.

  • packages/web/src/renderers/pixi-media-scene.ts:1306:SCENE-INTERACTION-LABEL-SLOT-UNTESTED | resolved | public renderer test at index.test.ts:1431 checks selected-label attachment, unfiltered glyph ancestry, shared background filtering and selected-label/handles/main-label paint order.

Unresolved prior open findings

None.

Deliberate tradeoffs

None.

Refuted

  • All heatmap settings and mask alignment must persist between clips: the required persistence is for annotation AA; base useDemoRenderer.ts already resets other styles per fixture, and AA remains preserved through the actual selector path.
  • IdPolygonInstruction is a dead public export: it names the new supported argument shape of publicly exported createIdMaskFrame, alongside IdMaskInstruction in core/src/index.ts:262. Absence of internal consumers of the barrel alias is not a defect and removal would narrow the public type surface.
  • Depth and heatmap rasters should be excluded from AA: user explicitly requested all Pixi annotation layers; media-frame pixels remain excluded.

Implausible

None.

Pre-existing

  • Non-AA styles reset on fixture selection in pinned-base useDemoRenderer.ts; no demonstrated aggravation.

@cfviotti cfviotti added the LGTMegaReview 🤖 Approved by Jarbas Mega Review label Oct 8, 2026
Changing mask styles after a fast scrub could leave the current paused frame at preview resolution indefinitely. Rearm its existing one-shot refinement when the style invalidates that artifact, while preserving inexpensive motion previews and disabled or disposed inactivity.

Extend the existing tier regression test with repeated paused restyles, frame identity, and idle work checks. Verified the proof fails with the refinement rearm removed; all 144 affected tests, web typechecking, ESLint, and formatting pass.
@cfviotti cfviotti removed the LGTMegaReview 🤖 Approved by Jarbas Mega Review label Oct 8, 2026
@cfviotti

cfviotti commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Mega Review

Status: REVIEW-CLEAN @ ed0b5e9 · converged after 4 rounds · narrowed to ae5536c..ed0b5e9

No open PR findings. All fourteen previous keys remain closed, and this repair introduces no Criticals or Warnings.
Review-clean does not replace typecheck, tests or CI.

Fixed since last round

  • Paused masks regain full fitted detail after an invalidating style change, including repeated changes after a fling and resize, through the existing 150 ms settle timer.

Non-blocking

  • Pre-existing: a source revision at the same frame key after a settled fling can leave its mask at preview detail until the playhead moves. The same invalidation path exists at the pinned base and this repair does not aggravate it. prepared-render-window.ts:789.

Caveats

This round reviewed the 48-line repair delta in two files, their complete current contents and dependent call chains. Untouched PR surfaces retain the earlier rounds' verdicts, so the clean verdict covers the accumulated rounds. One fresh Codex lane, one Claude lane and the orchestrator completed the static review across all thirteen lenses. No tests, builds, browsers or performance benchmarks were run by this review. Ticket compliance was not requested.

Review Ledger

Open findings

None.

Prior key statuses

  • packages/web/src/renderers/pixi-interaction-presentation-layer.ts:689:INTERACTION-WGSL-UNIFORM-ORDER | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. pixi-interaction-presentation-layer.ts:702-704 now matches WGSL field order; real Pixi packed-offset assertions protect the layout.
  • packages/web/src/renderers/pixi-annotation-antialias-layer.ts:47:INTERACTION-LABELS-IN-FXAA | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. interaction labels occupy a separate Label slot at order 700; shared filtering reaches backgrounds while glyphs stay outside annotation capture.
  • packages/web/src/renderers/pixi-polygon-layer.ts:229:MASK-POLYGON-CSS-WIDTH | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. polygon instructions retain CSS widths and Center alignment; actual scene forwards capture density and viewport scale to the raster owner.
  • packages/web/src/renderers/pixi-mask-layer.ts:462:MASK-QUALITY-STROKE-DENSITY | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. setRasterDisplay updates the active shader uniform before raster-cap invalidation, including ratios below one.
  • packages/web/src/sessions/media-session.test.ts:46:AA-SESSION-OPEN-PROOF | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. opening and AA toggles now require Ready status; shared Container mock supplies removeChildren.
  • tools/annotation-aa/cost-driver.mjs:22:AA-REPRODUCIBILITY-01 | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. private cost driver and support wrappers removed with no remaining imports; portable renderer probes remain.
  • packages/web/src/render-preparation/prepared-render-window.ts:1022:ZOOM-RGBA-EVICT | resolved | rechecked at ed0b5e9: display-width replacements retain cached artifacts until a valid result lands and preserve their Fine tier (prepared-render-window.ts:383-399,559-609); the new timer affects artifact-invalidating restyles.
  • packages/web/src/render-preparation/prepared-render-window.ts:252:MASK-CACHE-ALIGNMENT-BYTES | resolved | rechecked at ed0b5e9: strokeAlignments.byteLength remains included at prepared-render-window.ts:253; byte charging, release and cache limits are unchanged.
  • packages/web/src/renderers/pixi-media-scene.ts:945:AA-RES-CLAMP | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. capture cap uses stable container dimensions and forwards the actual fractional capture/output ratio.
  • tools/annotation-aa/summarize.mjs:12:AA-SUMMARY-01 | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. unconditional formatter removed; remaining report aggregation derives failed or complete from collected errors.
  • packages/web/src/renderers/pixi-media-scene.ts:1978:SCENE-LATE-MASK-SCALE | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. lazy masks receive current viewportScale before presentation; public-entry test distinguishes current zoom width from fitted width.
  • packages/web/src/renderers/pixi-region-coverage-mask.ts:215:REGION-CHANNEL-DOUBLE-RECORD | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. coverage render returns alpha-coverage boolean to the real consumer, which sets the display-owned channel.
  • packages/web/src/renderers/pixi-media-scene.ts:953:INTERACTION-DENSITY-RESIZE-STALE | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. observer redraw at pixi-media-scene.ts:1048 forwards the updated capture density; native-mask resize test retains frame/texture identity while requiring an immediate interaction redraw.
  • packages/web/src/renderers/pixi-media-scene.ts:1306:SCENE-INTERACTION-LABEL-SLOT-UNTESTED | resolved | inherited closure from round 3; the adjudicated spot is unchanged in ae5536c..ed0b5e9. public renderer test at index.test.ts:1431 checks selected-label attachment, unfiltered glyph ancestry, shared background filtering and selected-label/handles/main-label paint order.

Unresolved prior open findings

None.

Deliberate tradeoffs

None.

Refuted

  • All heatmap settings and mask alignment must persist between clips: the required persistence is for annotation AA; base useDemoRenderer.ts already resets other styles per fixture, and AA remains preserved through the actual selector path.
  • IdPolygonInstruction is a dead public export: it names the new supported argument shape of publicly exported createIdMaskFrame, alongside IdMaskInstruction in core/src/index.ts:262. Absence of internal consumers of the barrel alias is not a defect and removal would narrow the public type surface.
  • Depth and heatmap rasters should be excluded from AA: user explicitly requested all Pixi annotation layers; media-frame pixels remain excluded.

Implausible

None.

Pre-existing

  • Non-AA styles reset on fixture selection in pinned-base demo/src/hooks/useDemoRenderer.ts:894-912; annotation AA remains preserved at the current selector and this delta does not aggravate other style resets.
  • Same-key detection-frame revisions after a settled fling can recook at Coarse without another settle timer: observeMaskFrame/invalidateMaskFrame exist unchanged at pinned-base prepared-render-window.ts:724-765, and same-time redraws retain fast-motion state. Writable source identity revisions are supported at writable-detection-frame-source.ts:480-486, also unchanged from the pinned base; this style-only timer repair adds no new revision path.

@cfviotti cfviotti added the LGTMegaReview 🤖 Approved by Jarbas Mega Review label Oct 8, 2026
@cfviotti
cfviotti requested a review from joaomarcoscrs October 9, 2026 15:30
@cfviotti
cfviotti marked this pull request as ready for review October 9, 2026 15:30
@cfviotti
cfviotti requested a review from a team as a code owner October 9, 2026 15:30
Keep annotation smoothing, sharp labels, consistent default outlines and
paused mask refinement alongside current viewport, editing and still-image
rendering behavior.

Retain explicit mask and screen outline units with alignment-aware contours,
and reuse bounded polygon rasters when preparing those contours.

Validation: npm run verify passes, including 270 files and 3,560 tests. Compare
the merged tree against both parents and retain all PR-only source files.
Keep Outside and Inside outlines on the correct side of mask holes when using
explicit outline units. Pixi aligns each closed path to its own enclosed area,
so inner contours need the opposite alignment.

Use at most two stroke groups per detection and retain the centered batch.
The default raster-shader path is unchanged.

Validation: real Pixi line geometry for all three alignments; removing the
hole reversal fails the Outside and Inside assertions. npm run verify passes
270 files and 3,563 tests.
Comment thread packages/web/src/render-preparation/prepared-render-window.ts
Zooming an RGBA fallback mask with vector outlines was scheduling an
unnecessary raster rebuild. Only borders baked into the raster depend on
its display width, so exclude explicit screen/mask-unit outlines from
that invalidation flag.

Extend the existing zoom tests for both vector outline units, covering
cached frames and preparation that completes after a zoom change. The
four new cases fail before the fix and pass after it; baked-border
replacement remains covered by the existing cases.
Keep annotation smoothing compatible with current multi-selection and
media display controls. Include upstream selection preservation, gamma,
still-image auto contrast, and the 0.2.8 release update.

Retain both annotation and media-filter cleanup. The shared scene test
supports their uniform groups while preserving texture resources.

@joaomarcoscrs joaomarcoscrs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@cfviotti
cfviotti merged commit 1e7325d into main Oct 14, 2026
3 checks passed
@cfviotti
cfviotti deleted the exp/mask-edge-smoothing branch October 14, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTMegaReview 🤖 Approved by Jarbas Mega Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants