Skip to content

weather: storm cells, storm decks and dark bases; live cloud base/top and darkness (O18) - #1312

Merged
transfix merged 14 commits into
masterfrom
feat/weather-storms
Nov 17, 2026
Merged

transfix merged 14 commits into
masterfrom
feat/weather-storms

Conversation

@transfix

@transfix transfix commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

O18 of docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md: the weather model, storm cells and dark bases (F2, §10.7), plus O17's leftovers (live cloud base / top, and darkness). A storm builds upwind, darkens the sky and the ground under it, and clears.

What changed

The weather model: cvc::world::weather (inc/cvc/world/weather.h, src/cvc/world/weather.cpp)

  • Standard library only, GL-free, in cvc::world beside cloud_layer, so a headless scene, pycvc or arisrv can run it (roadmap §11.1, item 4).
  • A pure function of its parameters (the seed among them), the world time and authored events (D5, F7). at(t) computes the live cells from scratch; nothing is stepped or remembered. A frame's call is about 2.4 µs with 32 events (O(cells + events), nothing per texel).
  • States: clear, building, storm, clearing (the strongest live cell's phase).
  • Cells: a birthplace, a radius and a peak. Each grows (smoothstep), holds and decays over 20 to 60 weather minutes, its centre riding the steering wind.
  • Scheduled storms: weather time is cut into hashed slots. A storm never outlives its slot, so scheduled storms never overlap, and each is born upwind, timed to cross the world in its prime.
  • Authored events (weather.events, text that reads back exactly): storm, steer, rate (a time-lapse of the storms alone) and calm. compact(t) keeps the list short without changing the weather from t on.
  • Hooks for O19 and O20: the cell list (with phase and motion), intensity(x, y) and rain_rate(x, y) in mm/h.
  • A weather stream is appended to lsys::stream, so existing salts do not move.

The steering wind is the scene's one wind. The weather node's single accessor, steeringWind(), reads cloud_sky's wind (sky.wind_az at the deck's drift speed). O14 repoints it at wind.speed / wind.dir. A settled change is logged as a steer event.

cloud_layer (inc/cvc/world/cloud_layer.h, src/cvc/world/cloud_layer.cpp)

  • set_storms(discs): each cell takes the storms' field over it. A stormy cell is fed like a windward flank, held besides the fair-weather coverage (the footprint closes up), and its shade and far opacity deepen.
  • set_deck(base, top, nz, far_layers): live heights, rebuilt as set_sun does. It equals a deck built that way, both ways.
  • A deck deeper than its cumulus grows cumulonimbus maps: the cumulus at the bottom, a tower from its core, an anvil under the top (ABYSSAL's height profile, MIT notice kept). Its self-shade marches the sun through the tower.
  • Storm decks are built off the frame: prepare_deck, then run (any thread) or step(job, budget) (a few units at a time), then adopt_deck. A stale job is refused. A deck built in steps is bit-identical to one built at once. The cumulus source fields are kept, so terrain_lab's 3 km deck builds in about 150 ms and goes back in about 30 ms, instead of re-growing the grammar (seconds).
  • cell_up_tau: the optical depth straight up, for dark bases.

cloud_sky (src/cvcGL/ariadne/lsystem_nodes.cpp)

  • New live keys sky.base, sky.top, sky.darkness and sky.storms.
  • A new deck is built as a sliced task (cvc/core/sliced_task.h, the mechanism generated_world: rebuild and repaint as sliced tasks, not in the frame #984 gave generated_world's rebuilds) and swapped in when done. Natively it runs on the background pool. In single-threaded wasm (the Pages gallery, arigl-web), where std::async cannot start a thread, it runs a few milliseconds a frame on the scheduler thread via cloud_layer::step. deck_threading: cooperative forces the sliced path natively (threaded and automatic are the others; CVC_SLICED_THREADING=cooperative also applies). There is no std::async left.
  • After a swap, the near volumes are re-boxed, with their opacity corrected for the taller box's opacity unit.
  • darkness moves the colour ramp toward a storm ramp. Where a cloud is darkened, its light dims as the cloud above hides the sky (ABYSSAL's skyVis: cell_up_tau in the near volumes, two taps up in the far shells). Tower bases go dark and cumulus bases stay light. At darkness 0 nothing changes.
  • A storm deck's far march is finer and its light march is cut at two cloud widths (without that the far towers were faceted and banded).
  • No new volumes (the storm deck lives in the same near volumes and far shells) and no new samplers anywhere. Up to four storm discs and the darkness reach the far shells and the receivers as uniforms (cloudStorm0..3, cloudDark, cloudMarchN, cloudLightReach). A receiver's ambient drops by up to 0.55 under a storm (cloudAmbient).

The weather node (src/cvcGL/ariadne/weather_node.cpp, registered in the cvcGL extension bundle)

  • It owns the model over its ground: node's extent.
  • It drives the cloud_sky named by sky:: sky.storms; sky.top toward storm_top in four steps while a storm is within reach of the ground (so the tall maps exist only while a storm is about); sky.darkness.
  • It publishes weather.state / .storminess / .cells / .storms / .rain / .deck.
  • weather.request takes upwind, overhead or calm; weather.time_scale sets the time-lapse.

Documents

  • weather_controls.ari: the weather now, Storm upwind, Storm overhead, Clear sky, Time scale. INDEX entry.
  • sky_controls.ari: a Darkness slider.
  • terrain_lab.ari: a weather node, its window and its menu item.
  • docs/ARIADNE.md: cloud_sky's storms and new keys, and the weather node.
  • The roadmap: "As built (O18)" under F2, and F1's "Not done" updated.
  • THIRD_PARTY_NOTICES.md: the ported parts of ABYSSAL's Clouds.js.

How it was checked (Windows 11, MSVC Release)

  • WorldWeather.* (9):
    • determinism and a golden hash (19e696666ebdfd0d);
    • a scheduled storm runs clear → building → storm → clearing → clear on schedule;
    • upwind birth and the crossing;
    • an authored storm and a calm;
    • cells riding a turning wind, a time-lapse, rate 0;
    • the rain;
    • the events' text round trip and its errors;
    • compact (28 events to 7, the weather from then on unchanged);
    • the per-frame cost.
  • WorldCloudLayer.* (22):
    • all 17 existing pass unchanged; a fair deck builds bit-identically to before;
    • a storm closes the deck: 8 cells under it all held, 20 of 36 against 11; the shade 3.6× and the far opacity 2.7× the fair deck's; back to 11 when it passes;
    • a deck changed live equals one built so, both ways and across a thread; a stale job is refused;
    • a deck built one unit at a time (the sliced path) is bit-identical to one built at once; its phases come in order and its progress climbs to 1;
    • a storm deck towers and darkens its base: the base's optical depth toward the sun is 2.9 to 6× a cumulus base's, and upward 70 to 90×;
    • the build's timing.
  • cvcgl_ariadne_realize, all checks, including a new weather section, run twice: once with the deck built automatic (the pool) and once cooperative (a share a frame, as single-threaded wasm builds it; the build takes several frames):
    • an overhead storm reaches the sky's keys and the uniforms;
    • the storm deck comes in off the frame (the near volumes' box rises to 600 m);
    • a settled wind change becomes a steer event;
    • a calm clears it and the cumulus deck comes back.
  • ariadne_loader_test (weather_controls takes its node as an arg; INDEX lists it).
  • Also passing: every built World* test (116), Lsys* (26, the appended stream moves no salt), AriadneLoader* (38), AriadneComponents* (10), cvcgl_tree_version, and arigl check terrain_lab.ari.
  • The sliced path in the real app: an arigl snapshot of terrain_lab with CVC_SLICED_THREADING=cooperative and a storm overhead. The storm deck came in (frame looked at), placed with --set viewers.main.camera.orbit.* now that arigl: --set's camera keys hold over the scene's first framing #1307 holds them.
  • Offscreen frames of terrain_lab (arigl snapshots at 1280×720), looked at: clear; a storm overhead (the deck dark slate, the ground under it dimmed), from the opening view and from the side; a storm building upwind (the deck risen and lighter).

Frame cost (arigl snapshots of terrain_lab at 1280×720, RTX 4070 Laptop, the per-frame time being (the 720-frame run − the 120-frame run) / 600, three runs of each, interleaved, medians; the machine was running three other agents' builds, so absolute numbers are inflated and noisy):

run 1 run 2 run 3 median
master (8b2d2ff) 374 96 148 148 ms
this branch, clear sky 141 83 94 94 ms
this branch, storm overhead (--set weather.request=overhead) 93 94 153 94 ms

The spread swamps any difference (the frames ran about twice O15's 55 ms), so read this as: within the noise, neither the clear sky nor the storm costs more than master. By construction:

  • no new volume or sampler;
  • the weather is O(cells) a frame (2.4 µs);
  • the storm deck is built on a worker (about 150 ms) and swapped in;
  • the far shells' storm march takes at most CLOUD_SAMPLES per slab, as before, and their two upward taps run only where a cloud is darkened.

A quiet-machine run and GPU timer queries would firm this up.

Merge with master

origin/master (with #1304, #1307 and the others) was merged in, not rebased. The one conflict was the custom node list in docs/ARIADNE.md; both sides were kept. The delta over master is still only this PR's 23 files.

Not checked / not done

  • The browser (WebGL2) build, Linux and macOS (CI will run the tests; the golden hash was measured on Windows). The sliced path was run natively (deck_threading: cooperative), not yet in the wasm gallery.
  • The water's ambient under a storm. Its own lighting uses cloudShade() only, and water_node.cpp belongs to the foam/shading PR in flight.
  • The towers are columns of stacked cumulus puffs, and every cloud in view becomes one while a storm is about (per-cell towers would need a second map set or per-cell boxes).
  • The deck's pattern repeats every ~3 km on terrain_lab, which limits how local a storm can look.
  • Rain (O19), and the gust front, lightning and friction (O20), are later PRs.

…ts (O18)

cvc::world::weather is a pure function of its parameters, the world time and
authored events (storm, steer, rate, calm): storms on hashed slots run clear,
building, storm, clearing and clear, born upwind and timed to cross the area in
their prime, riding the steering wind. It publishes the cells, the storm field
and a rain rate for O19 and O20. A weather stream is appended to lsys::stream.
…aps built off the frame

set_storms gives each cell a storm share that feeds it, holds it besides the
fair-weather coverage and deepens its shade and far opacity. set_deck makes the
maps again for new heights; a deck deeper than its cumulus grows cumulonimbus
(ABYSSAL's height profile) whose self-shade marches the sun through the tower.
prepare_deck / run / adopt_deck build it on another thread, and the cumulus the
maps grow from is kept, so a storm deck comes in in about 150 ms. cell_up_tau is
the optical depth straight up, for dark bases.
…rrain_lab

cloud_sky reads sky.base, sky.top, sky.darkness and sky.storms live: a storm deck
is built off the frame and swapped into the same near volumes and far shells, the
ramp darkens toward a storm's, a darkened cloud's light dims as the cloud above
hides the sky, and the storms reach the far shells and the receivers as uniforms
(no new sampler). The weather node owns the model over its ground, drives the sky
and publishes weather.*; its steering wind is the sky's until O14's scene wind.
weather_controls.ari, terrain_lab's weather node, docs and the roadmap's as built.
… there are no threads

std::async cannot start a thread in single-threaded wasm (the Pages gallery,
arigl-web), so a storm coming into reach would have aborted the page. The deck's
build is now a cvc::sliced_job on the app's scheduler, as generated_world's
rebuilds are (#984): on the background pool natively, a few milliseconds a frame
on the scheduler thread where there are no threads. cloud_layer::step builds a
deck a unit at a time (a variant's map, one layer of its self-shade, one row of
its shade), bit-identical to building it at once. deck_threading: cooperative
forces the sliced path natively; cvcgl_ariadne_realize runs the storm both ways.
Conflicts:
- THIRD_PARTY_NOTICES.md: both sides extended the ABYSSAL paragraph after
  OceanFFT.js. Kept master's gusts and currents sentence, then the storm
  deck's and the weather model's. The summary line now names the wind's
  gusts and currents (wind_field.h, current.h) beside the storm maps.
- src/cvc/tests/CMakeLists.txt: both test loops list world_weather_test
  (this branch) and ocean_wind_test (master).
master fails to build arisrvx's python_engine.cpp: #1302 (bridged users)
added room(), bridge_presence(), bridge_absent(), bridge_post() and
listen_chat() calling server_link() with no argument, written against the
process-wide server link that the P0a cleanup replaced with the module's
own state, server_link(PyObject *self). Each of the five now names its
module argument self and passes it, as the other server ops (lent(),
publish(), ...) already do.

Found in #1324's pycvc-linux / cp312 job (run 43956686020),
which builds the PR merged with master.
…ther-storms

# Conflicts:
#	src/cvcGL/test/cvcgl_ariadne_realize.cpp
The realize suite runs every node type's checks in one process. In a
Linux Debug job (Xvfb, llvmpipe) it took 250.6 s, 50 s under the 300 s a
test without a TIMEOUT gets; on a slower runner (#1309's Debug job, where
PhConvoy and Ewave also ran about 1.3x longer) it timed out on all three
attempts. As cvcgl_ewave, cvcgl_wake and cvcgl_volren_node have, it gets
a budget of its own with headroom, so only a real hang fails it.
@transfix
transfix merged commit 6ba52b7 into master Nov 17, 2026
28 of 29 checks passed
@transfix
transfix deleted the feat/weather-storms branch November 17, 2026 09:40
transfix added a commit that referenced this pull request Nov 17, 2026
Merged on #1312's final head (a6c28ab) as the base, so the squash's copy of #1312 meets this
branch's and only the rain's own changes are applied over master.
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