Skip to content

terrain_lab: the sun lights a large world to its edges, roads cut through hills, cloud shadows change smoothly - #1047

Merged
transfix merged 5 commits into
masterfrom
fix/sun-roads-cloudshadow
Nov 8, 2026
Merged

transfix merged 5 commits into
masterfrom
fix/sun-roads-cloudshadow

Conversation

@transfix

@transfix transfix commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Joe raised three issues on the deployed terrain lab:

  • On a large map, zoomed out, the sunlight doesn't cover the whole area, leaving a circle of shade around the edges.
  • Roads over hills leave weird carved-out hills with the roads up on top. A road on a steep hill should cut through to keep its grade, and a gentle hill needs little or no cut.
  • The clouds move smoothly but their shadows are jerky.

The sun covers the whole world

  • terrain_lab's key light was a spot aimed at an 850 m stage. Its cone ended about 3.5 km out, so a larger world was in shade past that circle.
  • StageLighting::setSun(true) (state sun; the .ari rig's sun: true; a Sun checkbox in the Stage lighting panel) makes the key and back directional, from the key's azimuth and elevation.
    • The fill and environment move far off (60 stage radii), so they light the world as evenly as the sun does.
    • They stay positional with a wide cone, so they still cast no shadow.
    • The scene's shadow focus aims the sun's parallel shadow map at what the camera sees.
  • terrain_lab sets it.
  • Native snapshots of the 11.2 km world zoomed out: before, a lit disc in the middle with the rest in shade; after, the whole world lit evenly.

Roads cut through hills instead of riding over them

Three causes:

  • Long segments. Street segments are 7 m on the 1.2 km world, 32 m at 5.3 km and 67 m at 11.2 km. A segment's surface is straight, so on a larger world it bridged dips and cut hills whole, and the road mesh, with vertices only at the network's points, did the same.
    • The grade stage now grades a copy of the network split to about a mesh cell and a half (subdivide_roads).
    • extrude_roads samples the ground every 4 m along each road (road_mesh_params::sample_step).
  • Over-smoothing. The profile was relaxed by 60 passes regardless of spacing, which on long segments spread over kilometres: fills up to 74 m at 250 m relief.
    • Now only what breaks a limit moves. The grade is held to 12% (5% into a junction) and its change to max_curvature, 0.015 per metre (a vehicle at 15 m/s feels at most 3.4 m/s² over a crest). A gentle hill is followed as it is; a steep one is cut through.
    • A climb that is too steep comes three quarters off its top (cut_share 0.75), so roads sit in cuts rather than up on banks.
  • Pits beside roads. The ground blended toward each road with a shoulder as narrow as 2 m where the road was at grade. A lower road's wide cut nearby then dug the ground beside it below it, leaving the road up on a ridge.
    • Now the ground beside a road keeps its own height unless it rises above that road's cut or falls below its bank: side slope 0.5, steeper if needed to meet the ground within 40 m.
    • Where two roads' cuts and banks can't both hold, the ground settles between them, nearer the nearer road's.

Measured with the roadcheck harness on the terrain mesh, every 2 m along every road:

world tilt across p95 grade p95 grade change per 2 m p95 under water largest fill
1.2 km before 0.036 0.127 0.042 0 7.2 m
1.2 km after 0.032 0.116 0.031 0 11.7 m
5.3 km before 0.009 0.060 0.007 0 12.1 m
5.3 km after 0.015 0.112 0.013 0 4.1 m
  • On 5.3 km, the old "before" fill is at the old 32 m segment ends; between them the road ran straight through the ground. Graded on 6 m nodes with an even cut and fill split, the largest fill there would be 47.6 m; taking three quarters off the top brings it to 4.1 m.
  • The 1.2 km world has steep, short hills: it now cuts more (node cut p95 6.8 m, was 3.5 m), because roads take hills by cutting rather than banking.
  • A street the generator laid up a steep slope (it allows 35%) still needs a long cut to come down to 12%. The deepest is on the 5.3 km world, 29 m, where a plateau's streets come down to the shore; the snapshot shows a junction in a smooth-banked basin.

Cloud shadows change smoothly

  • The cloud shade is re-composited every 60 frames as the clouds change shape, and each new one replaced the last at once.
  • The receivers now crossfade from the last composite (cloudShadePrev) to the newest over the 60 frames to the next (cloudShadeMix). The wind's drift was already smooth per frame.

Tests

  • world_roads_test:
    • AGentleHillIsFollowedAndASteepOneIsCut: a 4 m rise is followed to 5 cm; a 30 m hill rising at up to 30% is held to 12%, cut more than 5 m at the crest, with less than half that banked at its foot.
    • TheGroundBesideARoadIsCutOrBankedNeverDug: a road along a ridge leaves the slopes as they are; a road 10 m down in a hill has its sides climb at 0.5 to meet it, never below the road.
    • SubdivideSplitsLongSegmentsOnly.
    • The smooth-road test's distance-from-ground bound is 2.5 m (was 2.0): through 1.5 m bumps the road now sits a little low.
  • world_road_mesh_test: ALongStraightFollowsTheGroundBetweenItsPoints; the counting tests set sample_step = 0.
  • cvcgl_stage_caster_truth: under the sun, key and back are directional and still the only casters; off again, the key is a spot.
  • ariadne_loader_test: the rig's sun: true parses.
  • cvcgl_ariadne_realize: the first shade shows at once; a new one starts its crossfade from the one shown; the mix climbs frame by frame. GeometryNode::sharedShaderInputs(key) reads the inputs back.
  • The world, LOD, ariadne and road subset passes locally on Windows Release.

Not checked: the browser build (the new sampler and the directional sun in WebGL2). It goes with the next gallery deploy.

terrain_lab's key was a spot aimed at an 850 m stage; its cone ended
about 3.5 km out, leaving a circle of shade on a larger world zoomed out.
setSun(true) (state sun, the rig's sun: key, a Sun checkbox) makes the
key and back directional from the key's bearing, and moves the fill and
environment far off so they fall as evenly; they stay positional with a
wide cone, so still cast nothing. terrain_lab sets it; its shadow focus
aims the sun's parallel map.
…s beside them

Grade a copy of the network split to about a mesh cell and a half
(subdivide_roads): larger worlds' segments are 32-67 m and a segment's
surface is straight. The road mesh samples the ground every 4 m.
The profile moves only what breaks a limit: 12% grade and a grade
change of max_curvature (0.015/m), a too-steep climb coming 3/4 off its
top (cut_share). The ground beside a road stays between that road's
cut and bank instead of blending toward every road nearby, so a lower
road's cut no longer digs the ground beside a road at grade.
The shade is re-composited every 60 frames and each new one replaced
the last at once, so the cloud shadows jumped. Receivers now mix the
last composite (cloudShadePrev) into the newest over the frames to the
next (cloudShadeMix). GeometryNode::sharedShaderInputs reads the inputs
back for the test.
A whole-file clang-format re-aligned the async_lane.h comment with its
neighbour; formatted as a changed line on its own (the CI check), it
wants one space.
…RARY_PATH

imagemagick cvc.25 (cy-pca/cvcpkg#551) pulled cvcpkg's GNU libiconv
into the deps prefix. The builder puts the prefix lib on
DYLD_LIBRARY_PATH, which dyld searches by leaf name before a library's
own path, so Homebrew's cmake loaded it for /usr/lib/libiconv.2.dylib
and aborted (Symbol not found: _iconv) before configuring: every PR's
macOS recipe lanes fail since. The recipe script moves those dirs to
DYLD_FALLBACK_LIBRARY_PATH, searched only when a library is not where it
is named; the smoke test step uses it too.
@transfix
transfix merged commit 7a09366 into master Nov 8, 2026
26 of 28 checks passed
@transfix
transfix deleted the fix/sun-roads-cloudshadow branch November 8, 2026 04:49
transfix added a commit that referenced this pull request Nov 8, 2026
#1047 added `sun: true` to a rig light: the key (and back) become a
directional sun over the whole world instead of spots on the stage. The
room's wire carries a rig's tuning knobs, so a world document's rig with
sun: true lost it on the way to the clients. scene.env.lights.<id>.sun now
holds "1", "0" or empty for unset, like the other knobs, and a plain light
clears it.

RigKnobsRoundTrip and RoomWorldFromSceneCarriesWhatTheWireHolds cover it.
transfix added a commit that referenced this pull request Nov 8, 2026
…1049)

WD0 and WD1 of ARIADNE_WORLDS.md: every room's world, and its look, now comes from a world
document.

- WD1: arisrv runs cvc://worlds/default.ari (the 20 m room), or cvc://worlds/large.ari with
  --scene large. Both live in the new src/cvc/ariadne/worlds/, installed beside components/.
  A --doc whose document has a scene: with nodes or lights is the world instead; --scene with
  such a --doc exits 2.
- The relay publishes the world as one revision (conference::write_room_world): every field and
  the soft removals first, scene.rev once and last. conference::room_world_from_scene turns a
  document's scene into what the room's wire holds: background, chrome, shadows, every light
  (rigs included), and each top-level plane, box, sphere or mesh-by-URI node with its fit:,
  transform and plain material. What it leaves out is warned about at start-up. Every body is
  published as a static (server-dynamic entities are WD3's); physics: waits for the headless
  world runtime (L0, section 14).
- The look is the world's (Q1). The three_point rig and its shadows move from
  conference_roster.ari into the world document. The wire gains the rig's tuning knobs (stage,
  key, fill, back, warmth, environment, ambient, wash, and #1047's sun) under
  scene.env.lights.<id>, and scene.env.shadows.interval.
- default_world() and large_world() are C++ twins of the two documents, seeded when the world
  file can't be found; StockWorldsMatchTheirTwins pins each pair to the same leaves.
- ServerDocument::read() keeps the parsed scene, so the world is published before the
  document's init: runs.
- WD0: --set comes after the world and the room's policies, so it overrides them, but before a
  server document's init:, so ariadne.limits.* still bound init:.
- Tests: RoomSceneTest.RigKnobsRoundTrip, RoomWorldIsOneRevision,
  RoomWorldFromSceneCarriesWhatTheWireHolds, StockWorldsMatchTheirTwins; ServerDocumentTest
  checks read() keeps the scene; ctests arisrv_world_from_doc, arisrv_world_doc_and_scene,
  arisrv_set_after_world.
- No CI change: #1050 fixed the macOS recipe lane on master, and the merge of master takes its
  side. The recipe lanes' Homebrew-free build tools are #1054's.
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.

1 participant