Skip to content

TrailView ground plan, step 5: the far look past the mesh, one paint function #3198

Open

Description

@timohueser

Part of #3096, plan after the 2026-11-07 review, step 5. Size: M.
Depends on: step 6 (#3199) for the range, GP11 (#3104) for the piece fragment's inputs. Changes the look half of GP10's hand-over (#3114).

Problem

Past the mesh, the terrain draws the records' paint and moved heights on its own grid (3.25 m at level 17, 6.5 m at level 16). At the mesh's end the geometry, the normals, the walls and the shading all change together:

  • the far look shades with model_road (ground/roads.wgsl:290); the pieces shade with their corridor fragment, another function with other inputs;
  • a wall becomes a saw-tooth slope on the terrain grid; a kerb becomes a smear;
  • the line lies at about 195 m today, three times nearer than develop's 600 m, so it shows in every final frame (the loading review, section 4).

A height grid cannot draw a vertical face. Do not try.

Design

  1. One paint function. The far look and the piece fragment call one paint function with the same inputs: the label, the frame (across, along, half-width, flags), the world position and the normal. model_road and the pieces' corridor fragment become its two callers; each supplies the inputs from its own source (the records per texel, the corner per vertex).
  2. A wall far away is a steep band one terrain grid cell wide, at the wall's line, with the wall's look painted on it. The far height function puts the wall's height change across that band; the paint reads the wall's label there.
  3. A kerb far away is paint only: the kerb's look on the texels of its line, no height step.
  4. The guard rule holds: the far look reads the records only through height_at / model_at, and heights.wgsl gets no term that the Rust heights lack. The wall band is a term of both.

This is sound only where one terrain grid cell is small on the screen: past the level-18 plateau, once step 6 brings the mesh there.

Invariants

  1. Near and far call one paint function with the same inputs; no second road model in the paint.
  2. Away from step edges, the far height equals the near height (one height function).
  3. A wall band is exactly one grid cell of the drawn level wide, so it never grows with distance.
  4. Rust and WGSL give the same heights, the band included (the GPU probe).

Done when

  • GP10's hand-over views at the mesh's end, at four LOD distances around it, develop | new: no jump of shape, line or shade at the hand-over except the band for the wall face.
  • Renders of the owner's views, develop | new, top and eye height, with far views (road-views-far.json).
  • The frame time with GP0's method (walk and drive): the far look's share against develop's.
  • Time to a clean frame, cold and warm, at v17 and m1: no change expected.
  • npx vitest run src/lib/trailview, npm run check, npm run check:wgsl; the GPU probe.

Risks

  • The one paint function can cost more per far texel than model_road. Measure before and after.
  • The piece fragment's inputs change with GP11; land after GP11's look parts, or carry them into the function.

Order

After step 6, or together with it. GP10's hand-over takes this look.

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