Skip to content

trailview: a coarser far terrain on the phone (#3779) - #3791

Merged
timohueser merged 4 commits into
developfrom
claude/trailview-3779-far-terrain
Nov 21, 2026
Merged

timohueser merged 4 commits into
developfrom
claude/trailview-3779-far-terrain

Conversation

@timohueser

@timohueser timohueser commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Mode: change #3779
Requirements: none
Public docs: no

Closes #3779. Part of #3656.

What changed

  • budget.ts: each tier has a lod row: the least and the most terrain range in node sizes, and the morph band in levels. Desktop: 4.6, 8, 0.3 (the old RANGE and MORPH). Phone: 3.7, 3.7, 0.15.
  • terrain/lod.ts: cdlod takes the morph band, and Rule carries it. MORPH and RANGE are gone.
  • terrain/terrain.ts: bestRange, qualitySteps and the rule take the limits of the tier. The surface uniform has a new last field, morph (432 bytes).
  • drawn-height.wgsl, plan/cells.wgsl, roads/corridor.wgsl read surface.morph. plan/pieces.ts reads rule.morph.
  • terrain/lod.test.ts: the selection test runs at the least and the most range of each tier, with the morph band of the tier (desktop 4.6 and 8, phone 3.7).
  • The comment of PROBE_ABOVE_M: the bound is now at most D / (morph · above · ln 2). The eye's point morphs only above the start of the band of the finest level: 3.3 level-18 nodes on the phone, at least 166 m up to 71° N, where the bound is 0.06 D. At a walk's eye height the point is on the plateau of the finest level, so the answer does not move.
  • The comment of DETAIL in ground/look.wgsl: the phone's 3.7 nodes keep the fade of the blades and the dots. Its largest frame, an iPad of 2752 pixels in portrait (3:4), gives about 0.22 m at a corner, so the 64° N of rules.py still holds.
  • Why 3.7: on the iPhone 13 (TrailView on the iPhone: the terrain draws broken, the new roads do not start, and the first picture takes long #3656, preset P), the range × 0.8 saved 4.5 ms of GPU time per frame, and the frames over 33 ms went from 64 % to 27 %. The phone's least and most are equal, so its range does not follow the render size.

Checks

In builder/web:

  • npx vitest run src/lib/trailview: 69 files, 490 tests pass.
  • npm run check: 0 errors, 0 warnings.
  • npm run check:wgsl: pass.
  • obc prose --check, cairn check: pass.

The crack flight, M1 Pro, headless Chromium on Metal (channel: 'chromium' through OBC_BROWSER_WS), the box data (box-terrain.mbtiles, ground, box features), flight.mjs --gpu --cracks 10 --flights cracks.json:

Tier climb-ground-to-60km oblique-pass Nodes (median, oblique) Terrain pass (median, oblique)
desktop 0 red pixels in 13 frames 0 in 13 54 1.65 ms
tier=phone 0 in 13 0 in 13 36 1.15 ms

Over the small test fixture, both tiers show the same large red counts: the flight leaves the fixture's box. The box data is the right input for this flight.

Gallery (owner approval on #3779)

Headless Chromium on Metal, 390 × 844 CSS pixels at DPR 2 (780 × 1688), the T1 kit with two more scenes: walk-plan and valley-drive-plan (ground=plan), for the near meshes of the new roads. Variants: the desktop tier, the desktop tier with only this cut, and the whole phone tier. Share of pixels that differ from the desktop by more than 8/255:

Scene noise cut only whole phone tier
far-north 0.00 % 2.63 % 2.63 %
far-south 0.00 % 4.24 % 4.24 %
zoom-out 0.00 % 1.88 % 1.88 %
bridge-tunnel 0.07 % 0.79 % 0.78 %
walk 0.00 % 0.01 % 0.01 %
valley-drive 0.00 % 0.03 % 0.03 %
walk-plan 0.00 % 0.01 % 0.01 % (empty device cache, see below)
valley-drive-plan 0.00 % 0.03 % 0.03 %

The far views change in the middle distance: soft shading and a slightly coarser silhouette. The near meshes of the roads end at about 350 m in place of about 390 m (46.8° N); no start view shows it.

Finding outside this change

On the phone tier with a warm device cache, waitForIdle() could return before the near road meshes draw, so the walk-plan shot showed the road under the eye flat grey. The cause is not the tier crossing: after a rest the meshes wait 120 calm frames (4 s at 30 fps), and Terrain.idle did not wait for them. Fixed in #3795. The gallery's walk-plan phone picture uses an empty cache, which this fault does not reach.

Owner steps

  1. The gallery: approve it in a comment on TrailView phone tier: a coarser far terrain whose nodes still meet #3779.
  2. One walk at tier=phone in one viewer window: the shorter morph shows only in motion.

Review: one round, nothing blocking; three comment fixes (the iPad corner pixel, a past measurement in budget.ts, a long line).

Time spent measuring: about 20 minutes (crack flights 3, gallery 5, the cache fault 10, tests and checks 2).

🤖 Generated with Claude Code

timohueser and others added 2 commits November 21, 2026 21:35
…3.7 and 0.15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1f934c5-aff7-4306-a06b-9552945ae6c0
Commits

Reviewing files that changed from the base of the PR and between c6bd745 and 2fcae73.

Files selected for processing: 13

  • builder/web/src/lib/trailview/README.md
  • builder/web/src/lib/trailview/budget.ts
  • builder/web/src/lib/trailview/ground/look.wgsl
  • builder/web/src/lib/trailview/plan/cells.wgsl
  • builder/web/src/lib/trailview/plan/pieces.test.ts
  • builder/web/src/lib/trailview/plan/pieces.ts
  • builder/web/src/lib/trailview/roads/corridor.wgsl
  • builder/web/src/lib/trailview/terrain/drawn-height.wgsl
  • builder/web/src/lib/trailview/terrain/lod.test.ts
  • builder/web/src/lib/trailview/terrain/lod.ts
  • builder/web/src/lib/trailview/terrain/pages.test.ts
  • builder/web/src/lib/trailview/terrain/terrain.test.ts
  • builder/web/src/lib/trailview/terrain/terrain.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@timohueser
timohueser marked this pull request as ready for review November 21, 2026 21:04
…779-far-terrain

# Conflicts:
#	builder/web/src/lib/trailview/budget.ts
@timohueser
timohueser merged commit a341416 into develop Nov 21, 2026
24 checks passed
@timohueser
timohueser deleted the claude/trailview-3779-far-terrain branch November 21, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TrailView phone tier: a coarser far terrain whose nodes still meet

1 participant