More than 8 distinct z levels breaks paint order, and tiled disagrees with direct #90

Open
opened 2026-10-13 02:28:04 +00:00 by ImBenji · 0 comments
Owner

From the engineering review on 2026-10-13.

Two problems in band merging (lib/models/functions/scene_z_order.dart, around lines 393 to 456).

Phantom bands. perGroup = ceil(n/8) leaves groups unused, and they come back as empty bands with z = 0 (lowestZOfGroup[g] ?? 0 at line 447). The tiled compositor looks pictures up by (tile, band.z), so it replays the real z=0 band on top of everything.

Merged bands lose cross-kind order. A band holds four per-kind lists and always draws halo, segments, blobs, objects, with the grid first. Once two z levels share a band, a z=0 box draws over z=1 track. This hits live, export and tiles alike, while hit testing still uses the true ZKey and so disagrees with what is drawn.

Evidence: test/review_probes/render_phantom_band_tiled_probe.dart and render_band_merge_order_probe.dart (local, untracked). Band z list at 9 levels is [0, 2, 4, 6, 8, 0, 0, 0]. A crossing pixel is red in both paths at 8 levels; at 9 levels direct is rgb(221,34,68) and tiled is rgb(51,102,255).

Fix sketch: drop empty groups, and give merged bands one ordered entry list (or split a group wherever kind order would invert) instead of four lists. Related: #7.

From the engineering review on 2026-10-13. Two problems in band merging (`lib/models/functions/scene_z_order.dart`, around lines 393 to 456). **Phantom bands.** `perGroup = ceil(n/8)` leaves groups unused, and they come back as empty bands with `z = 0` (`lowestZOfGroup[g] ?? 0` at line 447). The tiled compositor looks pictures up by `(tile, band.z)`, so it replays the real z=0 band on top of everything. **Merged bands lose cross-kind order.** A band holds four per-kind lists and always draws halo, segments, blobs, objects, with the grid first. Once two z levels share a band, a z=0 box draws over z=1 track. This hits live, export and tiles alike, while hit testing still uses the true `ZKey` and so disagrees with what is drawn. **Evidence:** `test/review_probes/render_phantom_band_tiled_probe.dart` and `render_band_merge_order_probe.dart` (local, untracked). Band z list at 9 levels is `[0, 2, 4, 6, 8, 0, 0, 0]`. A crossing pixel is red in both paths at 8 levels; at 9 levels direct is `rgb(221,34,68)` and tiled is `rgb(51,102,255)`. **Fix sketch:** drop empty groups, and give merged bands one ordered entry list (or split a group wherever kind order would invert) instead of four lists. Related: #7.
ImBenji added the bugarea:rendering labels 2026-10-13 02:28:04 +00:00
ImBenji added this to the Arcs & Angles project 2026-10-13 02:28:04 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: IMBENJI.NET/Metro-Map-Maker#90