Repository navigation
weather: rain, with streaks, shafts, wet ground, rings and fog (O19) - #1315
Merged
Merged
Conversation
…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.
# Conflicts: # docs/ARIADNE.md
… 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.
…er's arrays
The redeployed terrain_lab still ran out in every water draw: headless
Chrome logged 2,318 out-of-units warnings in 75 s once the water came
up. VTK sizes its texture-unit table from GL_MAX_TEXTURE_IMAGE_UNITS,
which is 32 on a desktop GL but 16 in WebGL2. bindShaderTextures first
reserved a fixed 8 units for the low-memory mapper's emulated vertex
arrays, which left a draw 8 for its own textures, and the water binds
10 (three cascades, three coast grids, the wake, the bed, two
cloud-shade textures).
- LowMemoryPolyDataMapper::arrayTextureUnits(): the arrays the draw
under way takes, vtkDrawTexturedElements::Arrays (bound in
RenderPieceStart, before UpdateShaderEvent fires). bindShaderTextures
reserves that many when the drawing mapper (the event's caller, or
the node's own) is one of ours, else 8 as before.
- A texture that still finds no unit is left unbound, so it no longer
sets a -1 sampler, which was a second GL error every draw. cvcGL
names the node and texture once.
- ViewportManager::limitTextureUnits(n) and $CVCGL_TEXTURE_UNITS cap
VTK's table, put back at the start of each render after a GL state
reset. With CVCGL_LOWMEM_MAPPER=force, a native run draws within the
browser's budget. Native terrain_lab that way logged 1,440 warnings
with the fixed reserve ("far" and "near" out of units for uWake: 16
in all, 8 kept, 10 shader textures), and 0 with this change.
- cvcgl_ariadne_realize: the water (with a swell, so the swash and coast
grids are on), cloud_sky's shade and a shadow-casting sun, drawn with
the low-memory mapper at 16 units, log no out-of-units warning. The
count is checked to hear VTK's warning.
- ARIADNE.md: the browser's texture units, natively.
- The comment #1304 added said WebGL2 gives VTK 32 units; it gives 16.
…s wetness (O19) weather::recent gives the cells whose life reached into a window, alive or gone; rain_radius is where a cell's field passes the rain onset; wetness is how long a recent storm's rain lay over a point over a soak time, times its drying since, the CPU twin of the wet ground the sky draws and the friction O20 will read.
… and fog (O19) The weather node hands cloud_sky the recent storms' tracks and the rain's constants (sky.rain, sky.rain_k) and draws the streaks near the camera: a port of ABYSSAL's Rain, drops placed and moved in the vertex shader as a closed form of time, slanted by the scene wind's one accessor. cloud_sky draws rain shafts below the cloud base in its far shells, wets and darkens its receivers along the tracks and dries them after, puts procedural raindrop rings into the water's normal, and thickens a distance fog with the rain at the camera, all as uniforms: no sampler joins the ground, the buildings, the roads, the trees or the water. terrain_lab's sky lists the streaks; the Weather panel has the rain's keys.
… off the terrain cloud_sky looked its receivers up among the scene's top-level names, so the weather's streak mesh (weather_rain, a child of the weather's node) was never wired: it drew without the deck's shade and fog, and in the volume layer before the clouds instead of after them. A receiver is now found anywhere in the scene. The streaks' ground under a camera off the terrain is the height at the terrain's edge, not NaN. cvcgl_ariadne_realize checks that the sky wired the streaks.
…e-1312 # Conflicts: # docs/ARIADNE.md
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).
Conflict: - THIRD_PARTY_NOTICES.md, the ABYSSAL summary line: kept the storms merge's wind gusts and currents, and this branch's rain streaks. water_node.cpp merged cleanly. The water lighting's three O19 swaps still find their lines in #1311's shader, and vWaterRest is still there.
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.
… master's arisrvx build
…realize's Debug timeout
transfix
enabled auto-merge (squash)
November 17, 2026 09:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
O19 of docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md: rain (F3, §10.6). In terrain_lab a storm walks across raining: shafts in the distance, streaks up close, rings on the lakes, wet roads and ground, and fog; then it clears and the ground dries. Stacked on #1312 (O18); this PR's own commits are the ones after its merge commit.
What changed
Model,
cvc::world::weather(inc/cvc/world/weather.h,src/cvc/world/weather.cpp)recent(t, window): the cells whose life reached into the window, alive or gone, so the ground dries along the tracks of storms that have passed.rain_radius(r, I): the radius within which a cell's field passes the rain onset.wetness(t, x, y, soak, dry): how wet a point is. Per recent storm, the time its rain lay over the point (along its track) oversoak, capped at 1, timesexp(-(time since its rain left) / dry). It is the CPU twin of the shader's wet ground, and the friction hook for O20.Weather node (
src/cvcGL/ariadne/weather_node.cpp)sky.rain: the tracks of up to four recent storms;sky.rain_k: the rain's constants (onset, rain_max,soak300 s,dry900 s, and the ring, fog and wet strengths).weather.rain_here, the rain at the camera.weather.streaks,.rings,.fog,.wetand.rain_quality, all on the Weather panel. New props:rain_count,rain_quality,soak,dry.Rain(Precipitation.js:6-265at 849ff7f4, MIT; notices kept).steeringWind(), the one scene-wind accessor that O14 repoints.rain_count(12000) ×rain_quality. There are no drops above the cloud base.cloudShade()) and fogged.cloud_sky (
src/cvcGL/ariadne/lsystem_nodes.cpp): everything here is uniforms; no sampler is added to any receiver.cloudWet()isweather::wetnessper fragment. Wet surfaces go darker, with a grazing-angle sheen and the sun's glint. The normal comes from the fragment's derivatives, so it does not depend on the mapper.sky.fog(a haze of the scene's own, default 0) plus the rain at the camera (0.001/m at 25 mm/h). Its colour moves from a fair grey toward a storm grey with the deck's darkness. It reaches the receivers, the water, the streaks and the far clouds. The scene's gradient background goes toward it and comes back when the rain stops.cloudRainNormal()): hashed 1 m cells, procedural.Water (
src/cvcGL/ariadne/water_node.cpp, kept small):water_light(shaded)gets three string swaps. They add the rings in the normal, the storm's ambient drop (O18's leftover) and the fog. Each swap is skipped if the line it follows has moved.Also in this branch
weather_rainamong the sky's receivers.weather_controls.arihas a Rain section; INDEX is updated.ba9f40b4fis cherry-picked (asbc7d2ee1e) so the 16-unit check runs natively. It will merge away once cvcGL: shader textures fit WebGL2's 16 units: the reserve is the mapper's arrays (terrain_lab's water in the browser) #1313 lands.How it was checked (Windows 11, MSVC Release)
WorldWeather(11):RecentCellsOutliveTheirRain;TheGroundWetsAndDries: under a storm crossing at 4 m/s, wetness climbs while the rain lies on the point, is 0.5 at half the soak, and is soaked when the rain leaves. After that it falls by 1/e everydry, and it is 0 beside the track.cvcgl_ariadne_realize, all checks:sky.rainandsky.rain_k;WorldCloudLayer,World*,AriadneLoaderandAriadneComponentssuites.--set viewers.main.camera.orbit.*):CVCGL_LOWMEM_MAPPER=force CVCGL_TEXTURE_UNITS=16, a 120-frame arigl snapshot of terrain_lab with a storm overhead and the camera in the rain. It logged 0 "no texture unit left" warnings, and the frame shows the fog, the streaks and the wet ground.Frame cost. arigl snapshots of terrain_lab at 1280×720 from a low camera over the city, so the streaks draw. The per-frame time is (720-frame run − 120-frame run) / 600. Three interleaved runs, medians. Three other agents' builds were running, so the numbers are noisy.
weather.streaks/rings/fog/wet = 0)The spread is larger than the differences, so within the noise the rain costs nothing measurable: medians 79 / 83 / 74 ms. By construction the per-frame CPU work is O(cells) (the tracks, ≤ 4). The streaks are one draw of a fixed mesh whose vertex shader drops what it doesn't need. The shafts ride the far shells' existing march. The wet ground, rings and fog are ALU work on uniforms. Not measured: a quiet machine, GPU timer queries, the browser.
Not checked / not done
weather::wetness).arigl snapshot --mp4(arigl snapshot --mp4 FILE --seconds S: record the scene running on its clock #1310) was not used.