Skip to content

TrailView ground plan GP8: the far stamp, one stamp function in every page on the new path, no snap #3102

Closed

Description

@timohueser

Scope now (the owner's targets of #3096, comment 6670626340)

This section replaces the older text below where they differ. Draft PR: #3161.

In this item:

  1. The heights of the records in the stamp: each near page takes height_at per texel over the water and structure stamps; a page waits for its cell's records.
  2. B's paint: the stamp writes the feature mask (core distance), B's paint texture (the paved labels and the rail beds) and the move texture; road_at paints from them on ground=plan.
  3. I1 as one probe run (label-probe.mjs), not a CI test.

Dropped or deferred: the far layers and the tiers (distant roads past the masks), debug=exact and the 32/255 quality gate, the records-end fade, old-path byte-equal shots, the stand-in frame gate and the toggle tooling. The frame is one measurement of the whole road share against develop on the real viewer.

Deviations, changed in implementation:

  • The records are the near level for every cell under the wanted near pages, in one texture of RECORDS_MB = 32 MiB. The far level is not used. The town views of the fixture want about 2.4 km of cells and fit.
  • A separate records worker builds the records (the plan bridge's records()). GP9 joins it with the plan worker, so a cell in the mesh range builds once.
  • The move texture holds the move only (8 MiB). The shaped zone ends where the heights moved the ground by more than MOVED_M; there is no slope-layer share.
  • height_at computes relative to a whole-metre base (GP6 review item 7).
  • No WALL flag on the new path; no free bits for GP10's step rule (see ground-plan GP8: the far look B, heights from the records in the stamp #3161).
  • No mouths and no shoulder paint in B's paint yet.
  • Corridors neither draw nor allocate pools on the new path.

Rewritten to the one road model (#3096); the previous body is in this issue's edit history.

Status: approved
Part of #3096. One pull request into ground-plan.
Depends on: #3135 (GP3R: the records, model_at, the far level with its height lists), #3113 (GP6: heights.wgsl), #3100 (GP5 phase B: the records of a cell from the plan worker).
Entry gate of GP9: the frame and quality gates of Verification hold before GP9 starts.

TL;DR

Goal: Behind the switch (ground=plan), every terrain page takes the heights and the masks of its ways from the records of its cells, once per texel when the page is made. The look paints the ways from those masks (variant B), with the same labels and the same heights as GP9's near mesh. The records' far range shrinks to a memory budget. Distant roads are a setting per tier. On the low tier first, the road share of a frame with GP9's stand-ins (develop's corridor share for the pieces, WAYS = false nearer than 560 m for the lean pipeline) is no larger than develop's whole road share, in interleaved runs scaled to one GPU clock. Without the switch every pixel stays as before.

Problem: The previous body builds a second road model in WGSL: its own segment records, its stroke rules, a TypeScript cross-section reader, and later FILLET records and class priorities (held decisions). The owner rejects two road systems and adopted one source (owner decisions). The prototype round measured the far look of the records (variant B, the look once per page): with fixed ground terms and the one-walk stamp it is a little faster than develop's whole road cost past 560 m, before GP9's pieces. A model stamp job still costs several develop jobs.

Decision:

  • One record walk per texel in the stamp pass: model_at gives the label, the core distance, the band distances, the paved label across the nearest edge and the slope layer's distance; height_at starts at the bin's height lists that model_at found.
  • One feature mask for every reader (snap, plants, water, ground terms): the core distance, never the paint's distance. B's paint has a texture of its own in the mask's format. The move of the heights and the shaped share have a texture of their own.
  • The ground terms are one function (model_ground) for every look. The shaped zone ends at each line's own slope layer and fades over its outer SHAPED_FADE_M, with no class switch, or where the heights moved the ground (owner rule (c)).
  • Records on the device by distance: the near level near the eye, the far level beyond, in one GPU buffer of RECORDS_MB per tier, nearest cells first, so a town shrinks the radius (owner).
  • Distant roads per tier (owner): the high tier keeps a far layer of B's paint for the drawn pages past the masks; the low tier does not.
  • The snap moves terrain vertices onto the model's core outline (owner-approved snap). GP9 adds its fade past the floors.
  • Today's water and structure stamps stay and bound the model until GP12 and GP14 make them records. The corridors do not draw on the new path.

Rejected:

  • The previous far stamp (its own records, stroke rules and cross-section reader) and the held FILLET records and class priorities: a second road model.
  • The page cache with an exact fallback, and with the far cache: about twice develop's whole share (shapes/budget/). The paint of the cache is most of it.
  • The look per fragment everywhere (variant A): several ms per frame.
  • model_road in the detail pipeline for distant roads: its presence alone costs about 1 ms on every detail fragment (shapes/bquality/ section 2).
  • The paint's distance and code in the mask that the snap and the ground terms read: the snap creased the mesh on the wrong line, and the kind cut-off ran in texel stairs (farb/ item 1).
  • A shaped zone by class (10 m for a road, 3 m for a path, a select at a half-width of 1.2 m): a case distinction that gives a texel stair where a path leaves a road and speckles at a track's zone edge (shapes/owner2/INDEX.md, "Still wrong").
  • A shaped share from the core distance (core / (core − d_slope)): a bin lists only the edges near it, so the core distance is not exact far out, and the share jumps at bin lines (shapes/owner2/reach/).
  • Two record walks per texel: the second walk is a fifth of a drive job (shapes/bquality/ section 3).
  • A baked records file: the fixture's records are about 50 MB against 296 kB of feature tiles.

Systems: trailview
Contracts: none (no tile, format or bake change)
Size: L (the stamp's model path, the look's B path and model_ground, the record store and its uploads, the far layers, the test toggle; about 1,000 to 1,400 changed lines)

Facts

Paths under builder/web/src/lib/trailview/ unless they start with host/, data/ or tests/. Evidence paths are on timosPC under /media/timo/OSM1/tmp/ground-plan/one-model/.

  • Today: the stamp pass runs stamp_at per texel of each new page, then the snap pass from the mask just written (terrain/terrain.ts:494-503, terrain/stamp.wgsl:103-140, :184-252). The mask is rgba8, levels 16 to 18: edge distance (asinh code, ±MASK_M = 12.75 m), sidewalk byte, across, and one byte with the surface code in its low 4 bits and the flags WALL, CONFLICT, FORDED, TAKEN in its high 4 bits (terrain/stamp.wgsl:127, terrain/features.wgsl:18-29).
  • The snap moves a mesh vertex onto a road edge within SNAP_TEXELS = 3 texels of its level inside, 3.75 outside (terrain/stamp.wgsl:59-62).
  • Develop's paint fades at the masks' LOD band (level 16 to 15), so develop shows no road past about 1,500 m.
  • Prototype: scratch/one-model-proto (53048a9: tiers, RECORDS_MB = 64 in terrain/model.ts; terrain/model.wgsl, ground/roads.wgsl; 4b21851: the shaped zone at the slope layer), scratch/one-model-farb (fb68806: the WAYS override and the toggle; 76c2f36: one feature mask, B's paint texture, model_ground; 5fb2251: the one-walk stamp). Not for merge.
  • The prototype's stamp keeps the far stamp of the previous GP8 for water and structures, and bounds the model's heights by them: a water's core bounds them; off the paved area a bore's cover and a deck's underside do too, so a road runs on onto its deck (terrain/stamp.wgsl on scratch/one-model-proto).
  • Frame of B with fixed ground terms and the one-walk stamp (farb/cost/INDEX.md, GTX 1660 SUPER, 2560 × 1600, low tier, B past 560 m, no pieces): walk and drive a little faster than develop's whole road cost; with distant roads (far layers) about equal on the drive. GP9's near pieces are not in these numbers. The GPU clock moved between runs; the scaled shares and the unscaled ones differ by about twice the run-to-run spread.
  • Develop's road share (shapes/budget/): corridors about a quarter to a third of it, the mask paint most of the rest. The road terms' code costs every detail fragment: B with no paint against B is the most that a lean pipeline near the eye can save (about a third of B's share).
  • Stamp job (shapes/bquality/ section 3, drive, before the one walk): the heights take at least half of a job (the ablation makes the far stamp draw its own roads). The one walk saves about a fifth of a job (farb/cost/).
  • Quality of B against the per-fragment look (farb/, farb/cost/, 22 views, > 32/255 per band): after the fix of the ground terms, under 0.02 % from 560 to 1,500 m; past 1,500 m the far layers bring the same level. The noise of two per-fragment shots is of the same order past 1,100 m. The crops show no stair, tooth, blob or shard; thin ways are a little paler, and B's paint has no mouths of a lesser way's material and no model shoulders yet.
  • Shaped zone (shapes/owner2/INDEX.md, 4b21851): near = smoothstep(0, 1, share), share = clamp(−d_slope / 2.5 m, 0, 1), d_slope the distance to the slope layer's outer edge (the union of every line's slope reach, Line word 6), share 1 on the core. The stair and the speckles of the class switch are gone. The stamp writes the share next to the move: 16 MB for 128 pages.
  • Records (shapes/far/): per km² at the fixture's mix, near compact 0.68 MB, far compact 0.445 MB, the far level without height lists. A disc of 2 km: 5.9–7.2 MB; 5 km: 35–37 MB; all town: about 26 MB at 2 km and 166 MB at 5 km. 64 MB holds about 2.3 km of town without the far height lists. Build per cell, one thread, WASM: graph 0.81 ms, near records 3.34 ms, far records 2.13 ms (median); fill after a jump, far records only, one worker: 2 km in 0.45 s, 5 km in 2.8 s, 5 km of town in 16 s.
  • The far level of the prototype has no band layers and no height lists (records::records_far). GP3R adds the height lists (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135, request 3, in its scope).
  • The production layout is GP3R's (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135, PR ground-plan GP3R: the records of a cell (one source for near and far) #3137, MAGIC 0x4f425201), not the prototype's: head and candidate hold 11 words each, with no metres-per-unit word (a reader takes the scale at the point from the cell's zoom-16 row); a line holds 14 words, with no marked flag (a look rule, GP11); candidate items hold exact vertex runs, not clipped i16 edges; find returns only the label. A point on an edge reads as moved by (ε, ε²) in frame axes, exact for points on a grid of 1/1024 unit. The prototype's GPU model_at and CPU find differ on 226 of 33,750 probe points (farb/cost/gpu/labels-aa0.json).
  • Owner rules for the look (owner decisions and the morning pages): one asphalt colour; a junction face takes the material of its highest-class arm; dirt mouths; shoulder paint as develop's (dusty asphalt on paved shoulders, else gravel; dustier only where an edge line divides it from the carriageway); the shaped zone ends where the heights moved the ground; distant roads per tier; the far cache on by default on the high tier; a memory budget that shrinks the radius; the model about as fast as develop, ideally a little faster, with no per-system budget numbers.

Design

1. The stamp per texel

On the new path, for each texel of a new page whose cells hold records:

  1. The block: a texel reads the block of the cell that holds the texel centre. An apron texel of a page lies in the next cell and reads that cell's block.
  2. One walk: model_at_lod(p, aa = 2 texels, lod = false), GP8's WGSL port of find on the production layout, gives the label, the core distance (the least of the paved distance and the band layers' outline distances), the band distances (the slope layer's d_slope among them), the paved label across the nearest change within 2 texels, and ModelPoint.heights (the first word of the bin's height lists). Band layers are never "near" candidates, so the reach changes neither the label nor the core.
  3. Height: h = height_at(block, q, label, base, ModelPoint.heights) (GP6), where base is the page's plain terrain after today's water and structure stamps. h stays inside their bounds (a water's core; off the paved area, a bore's cover and a deck's underside).
  4. Feature mask (today's rgba8 format and readers): the core distance (asinh code), the walk byte, the metres across (the side's sign, magnitude core + half-width), the surface code (a way of the model alone counts as code 1), the flags (WALL from the no-room rule, TAKEN from water and buildings, FORDED). The snap, the plants, the water and the ground terms read only this mask. GP8 lists the mask's bits on the new path and reserves two of them for GP10's step rule (STEP_E, STEP_S); if no two bits are free, the PR says so, and GP10 takes another texture.
  5. Move and share: |h − base| (0 to 0.5 m in 2 mm steps) and the shaped share of section 2, in an rgba8unorm texture of half the mask's width (two texels of a row in one texel, each as move and share; WebGPU has no rg8unorm storage), 16 MB for the 128 mask pages. A late mask takes its plain terrain from the bicubic that made its page (stored_base).
  6. B's paint texture, in the mask's format: the paved distance (asinh code), the walk byte or a track's sleepers, the paved label's host metres across, the paved label's finish code (code 2 as 1; 0 for none). The paved label is the texel's own where it is a carriageway, else the label across the nearest change within 2 texels. 4 bytes per texel: 32 MB for the 128 mask pages.
  7. Snap words from the feature mask's core distance: the snap moves terrain vertices onto the model's core outline (paved area ∪ paved shoulder, shoulder, verge). Until GP9 it acts at every distance; GP9 makes it 0 within the floors' range.

The side test on the GPU. model_at must not decide the side of a point near an edge, or of the bin's reference point, in f32: find decides it exactly, with the (ε, ε²) tie rule. GP8's rule matches it: the texel centre snaps to the 1/1024-unit grid, each edge test is an exact integer orientation (a 64-bit product from two u32 words; WGSL has no i64), and a tie takes the (ε, ε²) rule of find. The winding at the bin's reference point comes from the candidate item, not from a test. GP8 writes this design into this issue before coding, with its cost per stamp job; I1 proves it.

Kept from today's stamp, unchanged: lakes, the sea and their edges (the shore ramp ends at SHORE_REACH_M = 15 m), river cores and banks, platform pads, areas and buildings (TAKEN), the ground under a deck past its abutments, the cover over a bore past its portals, galleries, fords. On the new path bins.ts bins these records and no record of a way that the records hold: the model shapes and paints every such way. A way kind that the records do not hold yet keeps today's record; the PR lists such kinds (none expected: roads, tracks, paths and rail lines are record lines). GP12 and GP14 replace the kept stamps with records.

2. The look past the mesh (B)

On the new path, road_at (ground/roads.wgsl) reads B's paint texture, the feature mask and the move-and-share texture, all filtered as metres or shares, so bilinear filtering gives no stair:

  • Paint: develop's road_surface on the model's fields: one asphalt colour, the finish of the paved label, lines from the host's across. Whether a line carries markings is a look rule, not a record word: marked (today terrain/bins.ts:174) becomes one function of the line's words (class rank, finish code), which GP11 owns and both looks call.
  • Ground terms, one function model_ground for every look (the mesh's ground faces in GP11 call the same function):
    • wall: where the mask's WALL flag is set and the code is a road's or a track's;
    • shaped ground: shaped = max(near, moved), faded out before MASK_M of the core distance. near = smoothstep(0, 1, share), share = clamp(−d_slope / SHAPED_FADE_M, 0, 1) with SHAPED_FADE_M = 2.5 m, and share = 1 on the core. So the zone ends at each line's own slope reach and fades over its outer 2.5 m: one continuous field, no line id, no class. moved = smoothstep(0.05 m, 0.15 m) of the move (MOVED_M = 0.1 m);
    • cuts: shaped where the half-width is at least PATH_HALF_M (a case distinction that remains, below).
  • Early exit: a fragment whose core distance less the walk passes w + 0.5 m reads no paint texel.
  • Until GP9 B paints at every distance on the new path. GP9 stops it where pieces draw. For the entry gate, the test parameter farfrom=560 stops B's paint nearer than 560 m, as GP9's range does.
  • Mouths and shoulders: the owner asked for dirt mouths and develop's shoulder paint. GP8 writes the mouth's finish and the shoulder share into B's paint texture by the near look's rules (model_paint, model_shouldered, model_lined_shoulder on scratch/one-model-proto), and the hand-over shots of GP10 compare them.

3. Records on the device

  • The plan worker builds a cell's records by distance: the near level (band layers, height lists) within the near range, the far level (height lists, no band layers) beyond (GP3R's encoders). GP5 phase B carries them out of the worker per cell. The near block of a cell in the mesh range is the one that GP7 reads (one build).
  • terrain/model.ts keeps the blocks in one GPU storage buffer of RECORDS_MB, a tier value (high: 64 MB, the prototype's value; low: 64 MB until GP9's phone measurement sets it), the cells nearest the eye first, and a cell index per page. A town shrinks the radius. The far height lists change the radius; GP8 measures it again with them.
  • A page waits for its records: a page is stamped when every cell that it covers within the records' radius has its block. Until then the coarser page draws, as GP9's edge case 7. The wait is part of GP9's plan.ready. When a block arrives or leaves, the pages over its cell are stamped again, nearest first. So after the records settle, a page depends on its node, its tiles and the records' radius only, and two shots of a view are equal.
  • The end of the records: past the radius no way shapes or paints the ground. Proposed: B's paint and the ground terms fade over the last RECORDS_FADE_M (400 m, about one cell) of the radius, by a uniform; the heights past the radius are the plain terrain. Question 2.

4. Distant roads per tier

  • High tier (the default on the GTX and the M1 Pro): each drawn page past the masks (the 64 nearest, the old far cache's pool) gets a far layer in B's paint texture (+16 MB), written by a far job with model_at's level of detail at a 2-texel reach. B's paint reads it where no mask page holds the point. The near paint then does not fade at the masks' LOD band. This is the far cache in B's form (owner: on by default on the high tier).
  • Low tier: no far layer; the paint fades at the masks' LOD band, as develop's.
  • The switch is the tier's farRoads (tier=low in the address).
  • No model_road in the detail pipeline. The per-fragment look stays as a debug view (debug=exact) in a pipeline of its own, as the reference of the quality gate.

5. Memory

Pool Bytes Tier
records RECORDS_MB: 64 MB (radius shrinks) both (a tier value)
B's paint texture 32 MB (128 mask pages) both
far layers 16 MB (64 pages) high
move and share 16 MB (128 mask pages) both

New on the high tier: 128 MB of GPU memory; on the low tier 112 MB (with 64 MB of records). The corridor pools (27 + 20 MiB) go at GP19. Question 3. GP9 measures the phone (GP9, Verification).

6. The viewer on the new path

  • Roads gets no feature tiles: no corridor, rail, sleeper or corridor deck builds or draws, and held is 0 (Roads.write() returns 0 without tiles). If GP5 already does it, keep GP5's code.
  • structures/bridges.ts draws every bridge (the decks are the one exception of the model until GP12). The water mesh, its ribbons and the culvert mouths stay.
  • Two shots of a view are byte-equal once the records settle (section 3).

7. Test tooling: the fair frame toggle

GP0's alternate-frame toggle, extended (prototype fb68806): flight.mjs --toggle ways draws, on odd frames, no corridors, no pieces and no casters of either, and the terrain with the override WAYS = false (an all-zero road: no paint, no wall, no shaped ground, no cuts). Those frames are the flight with no ways. The road share is the terrain median (on) − (off) of one run, plus the shadow passes' (on) − (off), plus the stamp per frame. --toggle none is the control.

  • The clock rule (for GP8, GP9 and GP10): the GPU clock is not held (no root on the test machine). The runs of one comparison are interleaved in one session (develop, new, develop, new). flight.mjs prints the median clock of each run and the share scaled to the session's median clock (the method of scripts/clocks.py in the evidence folder farb/cost/). The spread is the difference of develop's two scaled runs. A gate compares scaled shares: new ≤ develop + the spread.
  • --lean FARFROM: the stand-in for GP9's lean pipeline: terrain nodes nearer than FARFROM draw with WAYS = false.

Case distinctions that remain

  • cuts selects on the half-width ≥ PATH_HALF_M: a path has a bench, no cut face.
  • The tier switch farRoads: the far layers cost memory and frame time that the low tier does not have.
  • The kept water and structure stamps bound the model's heights until GP12 and GP14.

Invariants and how each is proven

Invariant How it holds Proof
I1. GPU label = CPU label, far = near the same records and decide; the side test of section 1 matches find's exact rule; the far level keeps every paved candidate GP3R's agreement tests; GP8's probe: model_at in the stamp's path against find, fixture-wide and at points on and 1/1024 unit beside the edges: 0 differences
I2. Page height = height_at the stamp calls it GP6's native = GPU test through the stamp's path: ≤ 2 mm where no kept stamp bounds the point
I3. One walk = two walks band layers are never near candidates; height_at from start reads the same lists a probe test: label, core and height of the one walk against model_at without reach and height_at with start = 0, bit-equal
I4. The same page each time section 3 two shots of every new-path view, byte-equal
I5. The snap moves vertices only onto the core outline the snap reads only the feature mask's core distance the PR's shots of main-road-15m and valley-eye (Pictures); GP9's strip count
I6. Pages agree at node borders a texel reads the block of the cell that holds its centre (section 1) the audit's apron check: heights within 1 mm at node borders
I7. The old path no switch, no new branch old-path shots byte-equal to the merge base's

Interfaces with the other items

  • GP3R (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135) gives the blocks (near and far, with the far height lists) and find. GP8 ports find to WGSL as model_at and model_at_lod, with a GPU = CPU test on the fixture (I1).
  • GP6 gives heights.wgsl with start, and ModelPoint.heights.
  • GP5 phase B gives the records of each cell from the worker.
  • GP9 takes the snap words, B past R_eff, B at every distance where no piece draws (R = 0), the WAYS override, the toggle with its clock rule, and the phone measurement of the memory.
  • GP10 takes the feature mask with its two reserved bits, the move texture and the pages' heights for its readers.
  • GP11 takes model_ground and the paint rules, so the mesh paints by the same rules.
  • GP12 and GP14 replace the kept stamps with records. GP19 deletes today's stamp's road branches, the snap's old words and the corridors.

Edge cases

  • A page whose records have not arrived: the coarser page draws; the page is stamped when the blocks arrive (section 3).
  • A texel in an apron: it reads the next cell's block (section 1).
  • Past the records' radius: plain terrain, with the fade of section 3.
  • A water or structure stamp under a way: it bounds the way's height (section 1, step 3).

Plan

  1. terrain/bins.ts: a plan branch that bins only the kept water, structure and building records.
  2. terrain/model.wgsl: the port of find on the production layout, with the side test of section 1 (its design on this issue first). terrain/stamp.wgsl: the model path of section 1 (the block per texel, one walk, height_at, the three textures, the snap words); terrain/heights.wgsl from GP6.
  3. terrain/model.ts: the record store, RECORDS_MB per tier, the cell index per page, the uploads; page jobs that wait for records and stamp again on change.
  4. ground/roads.wgsl: B's paint, model_ground with the slope-layer share, the early exit; terrain/features.wgsl: the paint texture, the move-and-share texture, the reserved bits.
  5. ground/look.wgsl: the override WAYS. tests/browser/trailview/flight.mjs: --toggle ways|roads|none, --lean, the clock and the scaled share.
  6. The frame gate on the low tier (Verification). If it fails, the levers in this order: a cheaper heights path in the stamp (for example no heights for texels past every line's reach), then a report to the owner.
  7. The far layers and the tier switch, with their own number; the debug=exact reference pipeline.
  8. Shots, flights and tables of Verification.

Files

  • terrain/stamp.wgsl, terrain/bins.ts, terrain/terrain.ts, terrain/stamps.ts, terrain/stamp-worker.ts: change.
  • terrain/model.ts, terrain/model.test.ts, terrain/model.wgsl: create.
  • terrain/features.wgsl, ground/roads.wgsl, ground/look.wgsl: change.
  • tests/browser/trailview/flight.mjs, shoot.mjs: change: the toggle, the clock, the share, farfrom, --lean. tests/browser/trailview/road-views-far.json: create (the 18 far views of bquality) and low-views.json (its 4 low views).
  • No change: terrain/stamp-core.wgsl (the kept stamps), the specs, the docs.

Verification

  • Checks:
    • cd builder/web && npx vitest run src/lib/trailview: model.test.ts (nearest cells first within the budget; a block that arrives marks exactly the pages over its cell; the radius over town and country), the plan branch of bins.ts (no record of a way that the records hold), the existing tests unchanged.
    • npm run check, npm run check:wgsl.
    • Probe tests I1 to I3 (flock /tmp/trailview-gpu.lock).
    • Old path byte-equal; new path twice byte-equal (shoot.mjs --gpu, 1920 × 960).
    • The audit's apron check on the new path: heights within 1 mm at node borders, and the masks' codes equal except where the kept water code differs today.
  • Entry gate: frame, low tier first. flight.mjs --gpu --toggle ways, walk and valley-drive, 2560 × 1600, GTX 1660 SUPER, by the clock rule (section 7): develop, new, develop, new in one session. Runs: develop (the old path of the same build, which is pixel-equal to develop) and --toggle roads on develop for its corridor share; the new path with farfrom=560, --lean 560 and tier=low. Gate: on both flights, the new path's scaled road share plus develop's scaled corridor share is at most develop's scaled whole road share plus the spread. Reason: the owner's frame decision ("about as fast as develop, ideally a little faster; do not hold to the per-system numbers"); the corridors stand in for GP9's pieces and --lean for GP9's lean pipeline, so the gate compares what GP9 will draw. GP9 gates the whole with the real pieces.
  • High tier, its own number: the same runs with the far layers. The PR reports the far layers' cost (high − low, scaled) per flight; the owner decides with it (distant roads are a setting per tier).
  • Entry gate: quality (proposed tolerance, question 4): exact (debug=exact) − B over the 22 views, per band, after the mouths and the shoulders are in B's paint (they change it). Proposed gate: > 32/255 at most 0.02 % of the terrain pixels in each band from 560 to 1,500 m. At ≥ 1,500 m on the high tier against exact with far roads: reported. The implementer looks at the worst crops of each band: no stair, tooth, blob or shard.
  • Measurements:
    • Stamp per job and per frame by kind (heights and mask, mask only, far layers, stamps again after records arrive), median and p95; the shares of the heights, the walk and the rest; the GPU cost of the heights per stamp job and per frame (from GP6).
    • Records: the radius in each view and along the flights, with the far height lists; the far level's bytes per km² with them; the four pools' largest use.
    • Build: near and far records per cell, native and WASM; fill after a jump with near and far records.
  • Pictures (one slider page, develop and the new path, 1920 × 960, --gpu; the implementer looks at each):
    • the 18 far views and the 4 low views, high and low tier;
    • from above: junction0-top, j-tt-a-top, t-tertiary-top, x-tertiary-top, i07-hairpin-top, b45-bridge-junction-top, mouth-stream-top, also with debug=mask;
    • main-road-15m and valley-eye (I5: the snap on the model's core outline, no wobble of edge lines);
    • conn-road-into-path-eye and d-hairpin-15m with the terms view: the zone's edge one smooth curve, no stair, no speckles;
    • named steps past the mesh range: the Engelberg rail–road wall and one bridge end from 600 to 1,000 m. At 600 m a pixel is about 0.27 m and a texel 0.8 to 1.6 m, so a step can show as a stair of 3–6 px (question 5);
    • band layers past the mesh range: a town street at 600 m (question 6);
    • the end of the records: a view across the radius, high tier;
    • the owner looks for: smooth road edges and lines at every distance, no flicker of paint between levels, no stair, tooth or blob in the shaped zone, the same junction shapes as the near views, roads that end softly where the records end.

Done when

  • The entry gates hold (frame on the low tier, quality), or the owner decides on the measured numbers; the high tier's own number is in the PR.
  • The checks pass; I1 to I7 are proven as stated.
  • The PR has the tables, the slider page and the owner's answers to questions 1 to 3.
  • The PR has merged into ground-plan.

Out of scope

  • Pieces, floors, the strip, the range, the snap's fade, B's stop where pieces draw, the lean pipeline itself, the phone: GP9.
  • Readers and the hand-over at R_eff: GP10. The mesh's looks: GP11.
  • Decks, portals, abutments: GP12. Water records: GP14.
  • The records themselves: GP3R. Heights: GP6.

Questions for the owner

  1. GP8's held decisions (comment 6639067392): the snap past the floors stays, now onto the model's core outline; the FILLET records and the class priority go, because the records carry GP3's corners and priorities; the finer across code stays on the new path. Recommendation: release them so.
  2. The end of the records' radius: B's paint and the ground terms fade over the last 400 m; the heights past the radius are the plain terrain. Recommendation: accept; the PR shows it at the radius.
  3. Memory: 128 MB of new GPU memory on the high tier, 112 MB on the low tier (section 5). Recommendation: accept for the GTX and the M1 Pro; GP9 measures the phone and sets the low tier's RECORDS_MB.
  4. The far look's tolerance (item 14 of the round): the proposed 0.02 % per band, measured after the mouths and shoulders. Recommendation: accept, or set the value from the PR's table.
  5. Named steps past the mesh range: after the wall and bridge-end shots, keep the texel stair or add one far rule for steps (for example the far heights ramp a step over one texel and the look paints the wall from the WALL flag). Recommendation: decide from the shots.
  6. Band layers past the mesh range (item 11 of the round): (a) the far level keeps each band layer while its width resolves, or (b) accept that they stop at the hand-over. Recommendation: decide from the town street at 600 m.

What changed from the previous body, and why

  • The far stamp goes. terrain/far-stamp.wgsl, its segment records and stroke rules, terrain/cross-section.ts and its vector, the steps audit, the held FILLET records and class priorities: a second road model, which the owner rejects. The stamp calls model_at and height_at over the records.
  • New: one walk per texel, one feature mask, B's paint texture, the move-and-share texture, model_ground with the slope-layer zone, the record store with its budget per tier, pages that wait for their records, distant roads per tier, the fair toggle with the clock rule.
  • The snap (approved later in 6639067392) stays, onto the model's core outline.
  • Kept: corridors off on the new path, today's water and structure stamps with the shore ramp at 15 m, the old path pixel-equal, the same shot each time.
  • Gates: the previous per-job stamp gate (not above the old path) goes. The frame gate is the owner's whole-road rule with GP9's stand-ins, low tier first; the quality gate is new.
  • Dependencies: GP3R, GP6 and GP5 phase B, not GP5 alone.

Generated by Claude Code

Activity

  1. timohueser commented on Nov 4, 2026

    @timohueser
    OwnerAuthor

    Start-here note for a fresh session (orchestrating session, 2026-11-04):

  2. timohueser commented on Nov 4, 2026

    @timohueser
    OwnerAuthor

    Design check against the owner's rules (no special cases; thin parts are valid; GP3's strokes). The body now has these changes, each marked "changed after the owner's rules":

    1. One stroke rule for every way. Core, cones and paint measure seg, the distance to the segment (a capsule), inside the segment's mitre quad and past a round line end. So every bend gets a round join on its outer side and every line end a round cap. Heights keep the mitre-quad parameter t, so the quads of a line still meet on the mitre line with the same height, bank and distance (I3, I3b).
    2. Removed: the pick of one round JOIN end per joint (larger c, a tie by sort), the separate rule for two path ends, the JOIN and END bits, the RECT zone at every flat end, and the mitre corner of I1 (6.6 m past a round band at a 90° vertex).
    3. One distinction stays: a structure's end is flat (bridges, tunnels, galleries, and a way's end that meets one), because a round end reaches under the deck or into the bore's cover. GP3 keeps the same distinction (square at a level change). New bits: CAP_A/CAP_B (2/4) and FLAT_A/FLAT_B (8/16).
    4. Streams: TAKEN where seg ≤ max(h, 0.5 × texel), so round joins and ends too.
    5. The yield of soil ways (YIELD_CELLS) goes: its reason was the snap, which the new path does not run.
    6. I1 is now a round stroke: every point within c + reach_m of a segment. The greatest reach from a centre line is 25.6 m, with no 1 / cos(θ/2).
    7. Step count: FarStamp carries the winner's record and line. A span is checked where both ends have no core, or cores of one segment or of two consecutive segments of one line. So the medial step between two legs of one line's hairpin (I4) is not counted, and the continuity across each mitre line is.
    8. GP1 has no verge_m: Section has none, and edge is shoulder_m.
    9. Overlaps by the paint's rank stay; they match GP3's priority labels.

    The new section "Case distinctions that remain" lists every distinction with its reason. Comments go to GP6 (I1's footprint) and GP10 (the stream gate). GP9 does not change: I5 and I6 hold as written.


    Generated by Claude Code

  3. timohueser commented on Nov 4, 2026

    @timohueser
    OwnerAuthor

    Two changes found in implementation. The body takes them with the next edit, marked "changed in implementation":

    1. Mitres are the chords' bisectors. On the plan's path, records 9 and 10 hold the bisector of the two chords at an inner vertex, and the chord's direction at a line end. They never hold the alignment's tangent, which mitre() gives today. The tangent differs from the bisector where two chords differ in length. Then the distance to the line, and with it the edge and centre lines of the paint, jumps across the mitre line. The jump is about 0.2 m, seen from above at the junction of valley-eye. With the bisector, I3 holds exactly: on the inner side both chords measure the same lateral on the mitre line.
    2. Corrected fact: Roads.write() returns 600 m without tiles, not 0. It returns its built, which is RANGE_M (600 m). So within 600 m the paint left the soil ways (gravel, dirt, grass, path) to corridors that never drew: the track and the meadow path of mouth-stream-top were missing on the plan's path. Fix: write() returns 0 when the road worker has no tiles. The old path always has tiles, so it does not change.

    Generated by Claude Code

  4. timohueser commented on Nov 4, 2026

    @timohueser
    OwnerAuthor

    GP8 handover

    Head: claude/gp8-far-stamp at b6345e8. Pushed, nothing uncommitted. origin/ground-plan (d2a17de) is merged in. There is no PR.

    Done

    • Design: checked against the owner's rules. The body and its comments hold the changes:

      • one stroke rule (capsule distance, round joins and round ends);
      • a flat end only at a structure;
      • CAP and FLAT bits;
      • I1 as a round stroke;
      • the steps audit by segment.
    • Shader: terrain/far-stamp.wgsl (far_stamp_at, stamp_of, FAR_STAMP, SHORE_REACH_M). stamp.wgsl and audit.wgsl call stamp_of, and audit.wgsl has a steps entry. stamp-core.wgsl, corners.ts and approaches.ts are unchanged.

    • bins.ts plan branches:

      • widths from the new cross-section.ts;
      • no town pieces, no junction planes, no JUNCTION or CORNER records;
      • STREAM records from level 16;
      • CAP and FLAT end bits, and no zero-length segments;
      • mitres are the chords' bisectors;
      • profileTable(true).
    • Wiring: plan goes through the stamp worker, stamps.ts, the audit samples, the water mesh and the structure node functions. In terrain.ts: the far stamp and far audit pipelines, no snap pass, no corridors, and the steps count in the audit result.

    • Paint fix in roads.ts: Roads.write() returns 0 without tiles.

    • Vector and views: host/obc-ground-plan/tests/cross-section.json (80 rows), asserted by tests/cross_section.rs and cross-section.test.ts. road-views-far.json (18 views).

    • Checks that pass:

      • full vitest src/lib/trailview: 401 tests;
      • npm run check:wgsl;
      • npm run check: one error only, the missing test-support/flat-device/pkg, which this machine could not build (not GP8);
      • cargo test -p obc-ground-plan --test cross_section;
      • clippy -p obc-ground-plan --all-targets -D warnings;
      • cargo fmt --check.
    • Binning (relative, CPU shared with SwiftShader): 588 nodes (every level-16 node of the fixture, and the level-17 and 18 nodes of the six junction places).

      Path Words Largest node Records Time sum Time p95
      Old 3,215,966 73,157 124,025 11.9 s 73.6 ms
      Plan 2,674,399 59,899 124,675 10.4 s 60.2 ms

    Not verified

    • The audit has not run: the steps count, the apron and the conflicts.
    • Determinism (two shots byte-equal) and old-path byte-equality are not shot.
    • No flights and no GPU stamp time.
    • The far views are not shot.
    • No picture shows the two fixes below; the 14 pictures in the first set are from 796e474, before them.

    Open faults and what I know of their causes

    1. mouth-stream-top: track and meadow path missing on the plan path. Cause found: without tiles Roads.write() returned built (600 m), so held was 600 m. road_at then left every soil way (gravel, dirt, grass, path) to corridors that never drew. Fixed in a4d9a6e. Not seen again in a picture.
    2. valley-eye: centre-line jump. It is at the junction vertex where the side road starts. A shot from 20 m above (valley-junction-top-plan-before-mitre-fix.png) shows 0.2 m jogs in the centre and edge lines at two mitre lines.
      • Cause: mitre() gives the alignment's tangent, not the chords' bisector. Where two chords differ in length, the distance to the line jumps across the mitre line.
      • Fixed in b6345e8: the plan path uses chord bisectors, and a test asserts them. Not seen again in a picture.
      • The same shot shows the guest's paint as a wedge into the through road up to the bisectors. That is the approved rank rule, and it looks bad.

    Owner's verdict on the first pictures

    1. The wobble of the road lines and edges is a showstopper. Roads must be perfectly smooth, at every distance.
    2. The terrain artefacts beside the road in main-road-15m must go: rough, jagged slope strips left and right of the road.
    3. In t-tertiary the join on the left looks bad, and the sharp junction corners look worse than develop. The far stamp needs corner radii.
    4. My view of the wobble's cause:
      • The main cause is the dropped snap. No terrain vertex lies on the road's edge or on the foot of the slope. So level-18 triangles 1.7 m wide span the core, the shoulder and the cut. The plane of the painted surface then bends at the edges and slopes, and the jagged slope strips come from the same cause.
      • Two things add to it:
        • the core holds the base only within ±tol (2 cm). Seen at eye height, 2 to 4 cm of noise from vertex to vertex shows as a zigzag on a receding line;
        • before b6345e8, the tangent mitres added jogs of up to 0.2 m at the mitre lines.
      • The cure for the wobble is a mesh that follows the edges. GP9's pieces do that near the eye. Far from it, a flatter core (tol 0, or the core plane in place of the clamp) or a snap of the mesh, or both, is needed. Pictures on the GTX box decide which.

    Scratch tools on this machine

    • Shoot script: a copy of shoot.mjs with TIMEOUT_MS = SHOOT_TIMEOUT_MS ?? 120000, run with 3,000,000 ms. SwiftShader needs about 11 minutes per view at 1920 × 960, and the old path is as slow.
    • wasm-pack: cargo install wasm-pack --version 0.15.0 --locked and cargo install wasm-bindgen-cli --version 0.2.125 --locked. The bridges were built with wasm-pack build … --no-opt, because the binaryen download is blocked. Neither tool is committed.
    • Pictures: /home/user/gp-pictures/gp8/ with INDEX.md on this machine.

    Generated by Claude Code

  5. timohueser commented on Nov 4, 2026

    @timohueser
    OwnerAuthor

    Owner decisions on the GP8 design step (orchestrating session on timosPC)

    The design probe is on scratch/gp8-smooth-probe (e266592, not for merge). The proposal and the GPU pictures are in /media/timo/OSM1/tmp/ground-plan/gp8/ (gpu-baseline/, diagnosis/, candidates/, corners/, design/PROPOSAL.md).

    Causes (measured on the GPU)

    • Wobble of the edge lines: no mesh vertex lies on the crease between the flat core and the cut or fill. A snap onto the core edge brings the line residual down to the floor of the method (0.77 → 0.42 px rms). The core tol has no measurable share.
    • Wobble of the centre line: the paint's across code, 8 bits over ±12.75 m, so 0.1 m steps. The mesh has no share.
    • Jagged slope strips at 15 m and the bands at 300 m: the same crease, seen as shading and as the cliff light.
    • Centre-line jump in valley-eye: the guest's carriageway ranks deeper inside the through road.

    Decisions

    1. Snap past the floors (candidate A): approved. On the new path, the snap pass runs and moves vertices onto the core edge (h + shoulder). snap() takes the factor smoothstep(floor_range, plan_range, distance): 0 where GP9's floors hold, 1 past R_eff, and 1 everywhere when R = 0. I6 becomes: "No vertex within floor_range moves. No strip vertex moves." A count proves the second sentence. The epic's section 8 changes the same way (proposal on EPIC — TrailView ground plan: one engine for ways and water near the eye #3096).
    2. Corners: approved, all three parts.
      • FILLET records. A point with three or more arms takes the lesser corner_radius_m of the two arms; a point with two arms takes the lesser inner_radius_m. The values are GP3's, from roads.json. A fillet acts only on its two arms' own segments, so it never joins hairpin legs.
      • Class priority in carriageway overlaps, the same order as in GP3's overlay. Between arms of one class, the depth rank stays.
      • A smooth boundary where two finishes meet: no stair of texel size.
    3. across code (orchestrator's choice): the finer asinh scale applies only on the new path, behind the switch. The old path keeps its pixels and its byte-equal gate.

    Open for the implementation

    • The cones of a fillet can reach up to r (≤ 9 m) past an arm's own footprint. GP6's owned region (I1) must cover this, or the cones stop at the arms' footprint. This needs a check.
    • j-tt-a-far-1400 and t-tertiary-far-1400 put the eye outside the fixture, and need new eyes.

    Generated by Claude Code

  6. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    DRAFT for review: a new body of GP8 for the one road model. This comment does not change the issue body. An independent reviewer reads it before the owner does.

    Sources: the round's proposal (#3096 (comment)), its review (#3096 (comment)), the owner's decisions of 2026-11-05 (#3096 (comment)), GP8's held decisions (#3102 (comment)), and on timosPC /media/timo/OSM1/tmp/ground-plan/one-model/: farb/INDEX.md (the far-B port note), shapes/budget/, shapes/bquality/, shapes/far/, shapes/farcache/, shapes/owner1/, shapes/owner2/, PROPOSAL-shapes.md sections 6–10. Paths of evidence below are relative to that folder.


    TrailView ground plan GP8: the far look of the records: one record walk per texel, one feature mask, B's paint, distant roads per tier

    Status: draft (one road model)
    Part of #3096. One pull request into ground-plan.
    Depends on: GP3R ("the records of a cell", the sub-issue that is being filed) (the records, model_at, the far level), #3113 (GP6: heights.wgsl), #3100 (GP5 phase B: the records of a cell from the plan worker).
    Entry gate of GP9: the frame and quality gates of Verification hold before GP9 starts.

    TL;DR

    Goal: Behind the switch (ground=plan), every terrain page takes the heights and the masks of its ways from the records of its cells, once per texel when the page is made. The look paints the ways from those masks (variant B), with the same labels and the same heights as GP9's near mesh. The records' far range shrinks to a memory budget. Distant roads are a setting per tier. The road share of a frame, with develop's corridor share as the stand-in for GP9's pieces, is no larger than develop's whole road share, measured with GP0's alternate-frame method against the flight with no ways. Without the switch every pixel stays as before.

    Problem: The approved body builds a second road model in WGSL: its own segment records, its stroke rules, a TypeScript cross-section reader, and later FILLET records and class priorities (held decisions). The owner rejects two road systems and adopted one source on 2026-11-05. The prototype round measured the far look of the records: variant B (the look once per page) costs 0.69 / 0.87 ms (walk / drive) past 560 m against develop's 0.96 / 1.07 ms for all of its roads. B's first form had stair borders, teeth and blobs in the ground terms, and its stamp job costs about 4× a develop job.

    Decision:

    • One record walk per texel in the stamp pass: model_at gives the label, the core distance, the band distances and the paved label across the nearest edge; height_at starts at the bin's height lists that model_at found.
    • One feature mask for every reader (snap, plants, water, ground terms): the core distance, never the paint's distance. B's paint has a texture of its own in the mask's format. The move of the heights has its own byte.
    • The ground terms are one function (model_ground) for every look; the shaped zone follows the owner's rule (c) and develop's distance.
    • Records on the device by distance: the near level near the eye, the far level beyond, in one GPU buffer of 64 MB, nearest cells first, so a town shrinks the radius (owner).
    • Distant roads per tier (owner): the high tier keeps a far layer of B's paint for the drawn pages past the masks; the low tier does not.
    • The snap moves terrain vertices onto the model's core outline (owner-approved snap). GP9 adds its fade past the floors.
    • Today's water and structure stamps stay and bound the model until GP12 and GP14 make them records. The corridors do not draw on the new path.

    Rejected:

    • The approved far stamp (its own records, stroke rules and cross-section reader) and the held FILLET records and class priorities: a second road model.
    • The page cache with an exact fallback, and with the far cache: 1.81 / 1.76 ms and 1.94 / 2.00 ms, over develop's whole share (shapes/budget/). The paint of the cache is most of it.
    • The look per fragment everywhere (variant A): +6.5 to +7 ms.
    • model_road in the detail pipeline for distant roads: its presence alone costs +1.09 / +0.97 ms on every detail fragment (shapes/bquality/ section 2).
    • The paint's distance and code in the mask that the snap and the ground terms read: the snap creased the mesh on the wrong line, and the kind cut-off ran in texel stairs (farb/ item 1).
    • Two record walks per texel: the second walk costs 0.16 ms of a 0.77 ms drive job.
    • A baked records file: the fixture's records are 52.1 MB against 296 kB of feature tiles.

    Systems: trailview
    Contracts: none (no tile, format or bake change)
    Size: L (the stamp's model path, the look's B path and model_ground, the record store and its uploads, the far layers, the test toggle; about 1,000 to 1,400 changed lines)

    Facts

    Paths under builder/web/src/lib/trailview/ unless they start with host/, data/ or tests/.

    • Today: the stamp pass runs stamp_at per texel of each new page, then the snap pass from the mask just written (terrain/terrain.ts:494-503, terrain/stamp.wgsl:103-140, :184-252). The mask is rgba8, levels 16 to 18: edge distance (asinh code, ±MASK_M = 12.75 m), sidewalk byte, across, surface code and flags (terrain/stamp.wgsl:127, terrain/features.wgsl:25-29).
    • Develop's paint fades at the masks' LOD band (level 16 to 15), so develop shows no road past about 1,500 m.
    • Prototype: scratch/one-model-proto (53048a9: tiers, RECORDS_MB = 64 in terrain/model.ts; terrain/model.wgsl, ground/roads.wgsl), scratch/one-model-farb (fb68806: the WAYS override and the toggle; 76c2f36: one feature mask, B's paint texture, model_ground, far layers not verified; farb/scripts/one-walk.diff: one walk, not measured). Not for merge.
    • The prototype's stamp keeps the far stamp of the approved GP8 for water and structures, and bounds the model's heights by them: a water's core bounds them; off the paved area a bore's cover and a deck's underside do too, so a road runs on onto its deck (terrain/stamp.wgsl on scratch/one-model-proto).
    • Frame (shapes/budget/, GTX 1660 SUPER, 2560 × 1600, mean of two runs, walk / drive, ms; in brackets scaled to 1920 MHz): develop's whole road share 0.96 / 1.07 (0.89 / 0.98), of which corridors 0.25 / 0.34, mask paint 0.69 / 0.64, stamp 0.02 / 0.08. B past 560 m, far roads off: 0.69 / 0.87 (0.63 / 0.85), of which the stamp 0.09 / 0.37. Two runs agree within 0.03 / 0.045 ms. The road terms' code costs every detail fragment: at most 0.33 / 0.26 ms of B (B with no paint against B).
    • Stamp job (shapes/bquality/ section 3, drive): heights 0.39 ms (51 %), first walk 0.15, second walk 0.16, the rest 0.07; 4.1× a develop job (0.19 ms). With the heights free, B's share is 0.69 / 0.69 ms.
    • Quality of B against the per-fragment look (farb/, 22 views, > 32/255 per band): before item 1, 0.214 / 0.301 / 0.212 / 0.150 % at 560–800 / 800–1,100 / 1,100–1,500 / ≥ 1,500 m; after item 1, 0.014 / 0.015 / 0.004 / 0.159 %. The noise of two per-fragment shots: 0.004 % at 1,100–1,500 m, 0.034 % at ≥ 1,500 m. The rest at ≥ 1,500 m is streets that B drops past the masks with far roads off. The crops after item 1 show no stair, tooth, blob or shard; thin ways are a little paler, and B's paint has no mouths of a lesser way's material.
    • Records (shapes/far/): per km² at the fixture's mix, near compact 0.68 MB, far compact 0.445 MB. A disc of 2 km: 5.9–7.2 MB; 5 km: 35–37 MB; all town: about 26 MB at 2 km and 166 MB at 5 km. 64 MB holds about 2.3 km of town. Build per cell, one thread, WASM: graph 0.81 ms, near records 3.34 ms, far records 2.13 ms (median); fill after a jump, far records only, one worker: 2 km in 0.45 s, 5 km in 2.8 s, 5 km of town in 16 s.
    • The far level of the prototype has no band layers and no heights' lists (records::records_far). The fixture's file holds near blocks for every cell, so no shot met a far block's heights.
    • Owner rules for the look (2026-11-05 and the morning pages): one asphalt colour; a junction face takes the material of its highest-class arm; dirt mouths; shoulder paint as develop's (dusty asphalt on paved shoulders, else gravel; dustier only where an edge line divides it from the carriageway); the shaped zone ends where the heights moved the ground, and also takes develop's distance (shapes/owner1/, shapes/owner2/); distant roads per tier; the far cache on by default on the high tier; a memory budget that shrinks the radius.

    Design

    1. The stamp per texel

    On the new path, for each texel of a new page whose cells hold records:

    1. One walk: model_at_lod(p, aa = 2 texels, lod = false) gives the label, the core distance (the least of the paved distance and the band layers' outline distances), the band distances, the paved label across the nearest change within 2 texels, and ModelPoint.heights (the first word of the bin's height lists). Band layers are never "near" candidates, so the reach changes neither the label nor the core.
    2. Height: h = height_at(block, q, label, base, ModelPoint.heights) (GP6), where base is the page's plain terrain after today's water and structure stamps. h stays inside their bounds (a water's core; off the paved area, a bore's cover and a deck's underside).
    3. Feature mask (today's rgba8 format and readers): the core distance (asinh code), the walk byte, the metres across (the side's sign, magnitude core + half-width), the surface code (a way of the model alone counts as code 1), the flags (WALL from the no-room rule, TAKEN from water and buildings, FORDED). The snap, the plants, the water and the ground terms read only this mask.
    4. Moved byte: |h − base|, 0 to 0.5 m in 2 mm steps, in an rgba8unorm texture of a quarter of the mask's width (four texels of a row in one texel; WebGPU has no r8unorm storage), 8 MB for the 128 mask pages. A late mask takes its plain terrain from the bicubic that made its page (stored_base).
    5. B's paint texture, in the mask's format: the paved distance (asinh code), the walk byte or a track's sleepers, the paved label's host metres across, the paved label's finish code (code 2 as 1; 0 for none). The paved label is the texel's own where it is a carriageway, else the label across the nearest change within 2 texels. 4 bytes per texel: 32 MB for the 128 mask pages.
    6. Snap words from the feature mask's core distance: the snap moves terrain vertices onto the model's core outline (paved area ∪ paved shoulder, shoulder, verge). Until GP9 it acts at every distance; GP9 makes it 0 within the floors' range.

    Kept from today's stamp, unchanged: lakes, the sea and their edges (the shore ramp ends at SHORE_REACH_M = 15 m, as approved), river cores and banks, platform pads, areas and buildings (TAKEN), the ground under a deck past its abutments, the cover over a bore past its portals, galleries, fords. On the new path bins.ts bins these records and no record of a way that the records hold: the model shapes and paints every such way. A way kind that the records do not hold yet keeps today's record; the PR lists such kinds (none expected: roads, tracks, paths and rail lines are record lines). GP12 and GP14 replace the kept stamps with records.

    2. The look past the mesh (B)

    On the new path, road_at (ground/roads.wgsl) reads B's paint texture and the feature mask, both filtered as metres, so bilinear filtering gives no stair:

    • Paint: develop's road_surface on the model's fields: one asphalt colour, the finish of the paved label, lines from the host's across.
    • Ground terms, one function model_ground for every look (the mesh's ground faces in GP11 call the same rule):
      • wall: where the mask's WALL flag is set and the code is a road's or a track's;
      • shaped ground: shaped = max(near, moved); near = 1 − smoothstep(0.75 · shaped_m, shaped_m, core distance), shaped_m 10 m for a road and 3 m for a path; moved = smoothstep(0.05 m, 0.15 m) of the moved byte (MOVED_M = 0.1 m), faded out before MASK_M of the core distance;
      • cuts: shaped where the half-width is at least PATH_HALF_M.
    • Early exit: a fragment whose core distance less the walk passes w + 0.5 m reads no paint texel.
    • Until GP9 B paints at every distance on the new path. GP9 stops it where pieces draw. For the entry gate, the test parameter farfrom=560 stops B's paint nearer than 560 m, as GP9's range does.
    • Mouths and shoulders: B's paint has no mouths of a lesser way's material and no model shoulders (farb/ "Unproven"). The owner asked for dirt mouths and develop's shoulder paint. GP8 writes the mouth's finish and the shoulder share into B's paint texture by the near look's rules (model_paint, model_shouldered, model_lined_shoulder on scratch/one-model-proto), and the hand-over shots of GP10 compare them.

    3. Records on the device

    • The plan worker builds a cell's records by distance: the near level (band layers, heights' lists) within the near range, the far level beyond (GP3R's encoders and compact layout). GP5 phase B carries them out of the worker per cell.
    • terrain/model.ts keeps the blocks in one GPU storage buffer of RECORDS_MB = 64 MB, the cells nearest the eye first, and a cell index per page. A town shrinks the radius (about 2.3 km for all town).
    • A page waits for its records: a page is stamped when every cell that it covers within the records' radius has its block. When a block arrives or leaves, the pages over its cell are stamped again, nearest first. So after the records settle, a page depends on its node, its tiles and the records' radius only, and two shots of a view are equal.
    • Heights past the near level: the prototype's far level has no heights' lists, so height_at has nothing to read there. Rule (a request to GP3R): the far level keeps the heights' lists of the lines it holds, so the heights are the same near and far. GP8 measures the bytes per km² with them.
    • The end of the records: past the radius no way shapes or paints the ground. Proposed: B's paint and the ground terms fade over the last RECORDS_FADE_M (400 m, about one cell) of the radius, by a uniform; the heights past the radius are the plain terrain. Question 2.

    4. Distant roads per tier

    • High tier (the default on the GTX and the M1 Pro): each drawn page past the masks (the 64 nearest, the old far cache's pool) gets a far layer in B's paint texture (+16 MB), written by a far job with model_at's level of detail at a 2-texel reach. B's paint reads it where no mask page holds the point. The near paint then does not fade at the masks' LOD band. This is the far cache in B's form (owner: on by default on the high tier).
    • Low tier: no far layer; the paint fades at the masks' LOD band, as develop's.
    • The switch is the tier's farRoads (tier=low in the address).
    • No model_road in the detail pipeline. The per-fragment look stays as a debug view (debug=exact) in a pipeline of its own, as the reference of the quality gate.

    5. Memory

    Pool Bytes Tier
    records 64 MB (radius shrinks) both
    B's paint texture 32 MB (128 mask pages) both
    far layers 16 MB (64 pages) high
    moved byte 8 MB both

    New on the high tier: 120 MB of GPU memory; on the low tier 104 MB. The corridor pools (27 + 20 MiB) go at GP19. Question 3.

    6. The viewer on the new path

    • Roads gets no feature tiles: no corridor, rail, sleeper or corridor deck builds or draws, and held is 0 (Roads.write() returns 0 without tiles). If GP5 already does it, keep GP5's code.
    • structures/bridges.ts draws every bridge (the decks are the one exception of the model until GP12). The water mesh, its ribbons and the culvert mouths stay.
    • Two shots of a view are byte-equal once the records settle (section 3).

    7. Test tooling: the fair frame toggle

    GP0's alternate-frame toggle, extended (prototype fb68806): flight.mjs --toggle ways draws, on odd frames, no corridors, no pieces and no casters of either, and the terrain with the override WAYS = false (an all-zero road: no paint, no wall, no shaped ground, no cuts). Those frames are the flight with no ways. The road share is the terrain median (on) − (off) of one run, plus the shadow passes' (on) − (off), plus the stamp per frame. The script prints the clock per run. --toggle none is the control.

    Invariants and how each is proven

    Invariant How it holds Proof
    I1. Far label = near label the same records and decide; the far level keeps every paved candidate GP3R's agreement tests; GP8's probe: model_at in the stamp's path against find, fixture-wide (the prototype: 7,403 of 7,403)
    I2. Page height = height_at the stamp calls it GP6's native = GPU test through the stamp's path: ≤ 2 mm where no kept stamp bounds the point
    I3. One walk = two walks band layers are never near candidates; height_at from start reads the same lists a probe test: label, core and height of the one walk against model_at without reach and height_at with start = 0, bit-equal
    I4. The same page each time section 3 two shots of every new-path view, byte-equal
    I5. The snap moves vertices only onto the core outline the snap reads only the feature mask's core distance farb item 1's crops; GP9's strip count
    I6. The old path no switch, no new branch old-path shots byte-equal to the merge base's

    Interfaces with the other items

    • GP3R gives the blocks (near and far), model_at and model_at_lod in WGSL, and the far level's heights' lists (section 3).
    • GP6 gives heights.wgsl with start.
    • GP5 phase B gives the records of each cell from the worker.
    • GP9 takes the snap words, B past R_eff, B at every distance where no piece draws (R = 0), the WAYS override and the toggle.
    • GP10 takes the feature mask, the moved byte and the pages' heights for its readers.
    • GP11 takes model_ground and the paint rules, so the mesh paints by the same rules.
    • GP12 and GP14 replace the kept stamps with records. GP19 deletes today's stamp's road branches, the snap's old words and the corridors.

    Plan

    1. terrain/bins.ts: a plan branch that bins only the kept water, structure and building records.
    2. terrain/stamp.wgsl: the model path of section 1 (one walk, height_at, the three textures, the snap words); terrain/model.wgsl from GP3R, terrain/heights.wgsl from GP6.
    3. terrain/model.ts: the record store, RECORDS_MB, the cell index per page, the uploads; page jobs that wait for records and stamp again on change.
    4. ground/roads.wgsl: B's paint, model_ground, the early exit; terrain/features.wgsl: the paint texture and the moved byte.
    5. The far layers and the tier switch; the debug=exact reference pipeline.
    6. ground/look.wgsl: the override WAYS. tests/browser/trailview/flight.mjs: --toggle ways|roads|none, the clock, the share.
    7. Shots, flights and tables of Verification.

    Files

    • terrain/stamp.wgsl, terrain/bins.ts, terrain/terrain.ts, terrain/stamps.ts, terrain/stamp-worker.ts: change.
    • terrain/model.ts, terrain/model.test.ts: create.
    • terrain/features.wgsl, ground/roads.wgsl, ground/look.wgsl: change.
    • tests/browser/trailview/flight.mjs, shoot.mjs: change: the toggle, the share, farfrom. tests/browser/trailview/road-views-far.json: create (the 18 far views of bquality) and low-views.json (its 4 low views).
    • No change: terrain/stamp-core.wgsl (the kept stamps), the specs, the docs.

    Verification

    • Checks:
      • cd builder/web && npx vitest run src/lib/trailview: model.test.ts (nearest cells first within the budget; a block that arrives marks exactly the pages over its cell; the radius over town and country), the plan branch of bins.ts (no record of a way that the records hold), the existing tests unchanged.
      • npm run check, npm run check:wgsl.
      • Probe tests I1 to I3 (flock /tmp/trailview-gpu.lock).
      • Old path byte-equal; new path twice byte-equal (shoot.mjs --gpu, 1920 × 960).
      • The audit's apron check on the new path: 0 differing texels at node borders, or at most the old path's count where the kept water code differs today.
    • Entry gate: frame. flight.mjs --gpu --toggle ways and --toggle roads, walk and valley-drive, 2560 × 1600, GTX 1660 SUPER, two runs each, one session, clocks reported. Runs: develop (the old path of the same build, which is pixel-equal to develop); the new path with farfrom=560 on the high tier and on the low tier. Gate: on both flights and both tiers, B's road share plus develop's corridor share of the same session (--toggle roads on develop) is at most develop's whole road share, within the run-to-run spread. Reason: the owner's frame decision ("about as fast as develop, ideally a little faster; do not hold to the per-system numbers"). GP9's pieces take the corridors' place, and GP9 gates the whole with them.
    • Entry gate: quality (proposed tolerance, question 4): exact (debug=exact) − B over the 22 views, per band. Gate: > 32/255 at most 0.02 % of the terrain pixels in each band from 560 to 1,500 m (B after item 1: 0.014 / 0.015 / 0.004 %). At ≥ 1,500 m on the high tier against exact with far roads: reported. The implementer looks at the worst crops of each band: no stair, tooth, blob or shard.
    • Measurements:
      • Stamp per job and per frame by kind (heights and mask, mask only, far layers, stamps again after records arrive), median and p95; the shares of the heights, the walk and the rest.
      • Records: the radius in each view and along the flights; the far level's bytes per km² with heights' lists; the four pools' largest use.
      • Build: near and far records per cell, native and WASM; fill after a jump with near and far records.
      • Phone (the owner): GP5's timing page with records, and one far view; the PR gives the link and the steps. Not gated; the owner reads it before GP9.
    • Pictures (one slider page, develop and the new path, 1920 × 960, --gpu; the implementer looks at each):
      • the 18 far views and the 4 low views, high and low tier;
      • from above: junction0-top, j-tt-a-top, t-tertiary-top, x-tertiary-top, i07-hairpin-top, b45-bridge-junction-top, mouth-stream-top, also with debug=mask;
      • main-road-15m and valley-eye (the snap on the model's core outline: no wobble of edge lines);
      • named steps past the mesh range: the Engelberg rail–road wall and one bridge end from 600 to 1,000 m. At 600 m a pixel is about 0.27 m and a texel 0.8 to 1.6 m, so a step can show as a stair of 3–6 px (question 5);
      • band layers past the mesh range: a town street at 600 m (question 6);
      • the end of the records: a view across the radius, high tier;
      • the owner looks for: smooth road edges and lines at every distance, no flicker of paint between levels, no stair, tooth or blob in the shaped zone, the same junction shapes as the near views, roads that end softly where the records end.

    Done when

    • The entry gates hold (frame and quality), or the owner decides on the measured numbers.
    • The checks pass; I1 to I6 are proven as stated.
    • The PR has the tables, the slider page and the owner's answers to questions 1 to 3.
    • The PR has merged into ground-plan.

    Out of scope

    • Pieces, floors, the strip, the range, the snap's fade, B's stop where pieces draw: GP9.
    • Readers and the hand-over at R_eff: GP10. The mesh's looks: GP11.
    • Decks, portals, abutments: GP12. Water records: GP14.
    • The records themselves: GP3R. Heights: GP6.

    Questions for the owner

    1. GP8's held decisions (comment 6639067392): the snap past the floors stays, now onto the model's core outline; the FILLET records and the class priority go, because the records carry GP3's corners and priorities; the finer across code stays on the new path. Recommendation: release them so.
    2. The end of the records' radius: B's paint and the ground terms fade over the last 400 m; the heights past the radius are the plain terrain. Recommendation: accept; the PR shows it at the radius.
    3. Memory: 120 MB of new GPU memory on the high tier, 104 MB on the low tier (section 5). Recommendation: accept for the GTX and the M1 Pro; GP9 measures the phone.
    4. The far look's tolerance (item 14 of the round): the gate above. Recommendation: accept.
    5. Named steps past the mesh range: after the wall and bridge-end shots, keep the texel stair or add one far rule for steps (for example the far heights ramp a step over one texel and the look paints the wall from the WALL flag). Recommendation: decide from the shots.
    6. Band layers past the mesh range (item 11 of the round): (a) the far level keeps each band layer while its width resolves, or (b) accept that they stop at the hand-over. Recommendation: decide from the town street at 600 m.

    What changed from the approved body, and why

    • The far stamp goes. terrain/far-stamp.wgsl, its segment records and stroke rules, terrain/cross-section.ts and its vector, the steps audit, the held FILLET records and class priorities: a second road model, which the owner rejects. The stamp calls model_at and height_at over the records.
    • New: one walk per texel, one feature mask, B's paint texture, the moved byte, model_ground, the record store with its budget, pages that wait for their records, distant roads per tier, the fair toggle.
    • The snap (approved later in 6639067392) stays, onto the model's core outline.
    • Kept: corridors off on the new path, today's water and structure stamps with the shore ramp at 15 m, the old path pixel-equal, the same shot each time.
    • Gates: the approved per-job stamp gate (not above the old path) goes. The frame gate is the owner's whole-road rule; the quality gate is new.
    • Dependencies: GP3R, GP6 and GP5 phase B, not GP5 alone.

    Generated by Claude Code

  7. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    Requirement for GP8 from the GP3R review (#3137 comment 6655161502, M2), to add to the GPU model_at design before coding: do not compute the side of a bin's reference point in f32. find computes it again for every edge; the doubled products reach about 2^40, so f32 fails on long edges near the reference point, which is the prototype's 101-point fault.

    • Either the encoder stores each edge's reference side in the block, or the GPU uses an exact integer side test (the body's 64-bit product from two u32 words).
    • Compute each run vertex's side once and use it for both of the vertex's edges, or a hairline streak can appear across a bin.
    • The GPU = CPU label test needs a stated tolerance at the boundaries of past, the disc test and way_glob, or an exact port of them.

    Generated by Claude Code

  8. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    Interface note from GP6 (draft PR #3140), for this sub-issue:

    • terrain/heights.wgsl: fn height_at(block: u32, q: vec2f, label: u32, t: f32, start: u32) -> vec2f (h, kind 0 terrain, 1 slope, 2 paved). start is the first word of the bin's height segment items; with 0 the function walks the bin. model_at can give it as ModelPoint.heights.
    • terrain/records.wgsl holds the block's layout and word reads (mw, mf, mi, M_*, m_cand, m_label, m_extras, m_bin_head, m_skip_item); model.wgsl should include it, not repeat it. terrain/model-words.wgsl holds the binding model_words (texture_2d<u32>, MODEL_ROW 4096 words per row); a pass swaps that file for its own binding.
    • The heights' rule values are words of the block (after the head), not WGSL constants. H_SLOTS is 10.
    • The records changed (MAGIC 0x4f425203): a line has 16 words.
    • tests/browser/trailview/model-probe.mjs checks the WGSL against Rust from debug heights --gpu-check; it passes the label from Rust, so it does not test model_at.

    Generated by Claude Code

  9. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    GP8 port status (draft PR #3161, branch claude/gp8-far, merged with ground-plan at fb991e0):

    • Ported: the records on the device, model_at (exact integer side tests), height_at per texel in the stamp, B's paint, model_ground. Behind ground=plan.
    • I1: 619,341 whole-unit points (on and beside every candidate edge of 12 cells): 0 labels differ. Heights GPU = Rust: max 0.121 mm over 183,984 points.
    • Frame (GTX, 2560 × 1600, interleaved): the whole frame is 0.1 ms faster on the walk and equal on the valley drive. The look is cheaper, the stamp dearer (a job about 3.5 × develop's, max 4.5 ms).
    • GPU memory: +25 MiB against develop (features 34 → 74, records 0 → 32, corridor pools 47 → 0).
    • Pictures and the faults: /media/timo/OSM1/tmp/ground-plan/gp8/port/INDEX.md.

    The deviations are in the new first section of the body. For GP9 (#3103): join the records worker with the plan worker; the terrain grid near the eye tears at steps between ways. For GP10 (#3114): the feature mask has no two free bits for STEP_E/STEP_S. For GP11 (#3104): B has no mouths, shoulder paint or retaining walls (no WALL flag on the new path).


    Generated by Claude Code

  10. timohueser commented on Nov 6, 2026

    @timohueser
    OwnerAuthor

    GP8 landed in ground-plan with PR #3161. The adversarial review and its fixes are on the PR. Frame time equals develop; GPU memory is +25 MiB. The stamp pass (up to 4.4 ms, p95 2.0 ms per frame) is a GP9 budget item.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions