Skip to content

water: persistent foam, the A4 shading, level of detail and packed samplers (O5, O21) - #1314

Merged
transfix merged 19 commits into
masterfrom
feat/ocean-foam
Nov 17, 2026
Merged

transfix merged 19 commits into
masterfrom
feat/ocean-foam

Conversation

@transfix

@transfix transfix commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

This PR now also carries #1321's water frame-cost work, its packed samplers above all, so that it passes on its own. Since #1313 (WebGL2's 16 texture units) landed on master, cvcgl_ariadne_realize checks that no water draw runs out of the 16 units a WebGL2 draw has. With the foam's atlas, this PR alone was one sampler over (60 out-of-units warnings, the flood that locked up terrain_lab in the browser). #1321's packing (the cascades in one atlas, the coast and the fetch maps in another) brings the water back under: 0 warnings. feat/ocean-foam was fast-forwarded to feat/water-lod, which already held all of this PR. #1321 is closed as folded in here.

Both parts were reviewed separately (this PR's foam and shading, then #1321's own changes: no global state, adaptive quality per runtime, drawing only, physics untouched). Locally on Windows Release at #1321's head 3686724: cvcgl_ariadne_realize (all of it, the 16-unit check included), cvcgl_ocean_fft, cvcgl_ari_switch, cvcgl_ariadne_physics, ariadne_scene_quality_test and ariadne_scene_world_test pass. One behaviour change to know: adaptive quality (quality.adaptive) is on by default at 30 fps, so on a slow GPU the water drops tiers unless it is set to 0.

Part 1: persistent foam and the A4 shading (O5)

The rest of O5 (OCEAN-AND-WEATHER-ROADMAP.md): persistent foam (§10.2) and the water's shading (A4, §10.11), in the Ariadne water node and in lsystem_coast, with distance-based level of detail on every new per-fragment cost.

What changed

Persistent foam (§10.2).

  • cvc::ocean (inc/cvc/ocean/whitecaps.h): foam_step, the turbulence update (foam builds at 4/s while a texel folds and decays as exp(-t / foam_decay) after; bubbles, crest and spray channels as ABYSSAL keeps them), foam_look, the windrow carve, and foam_history, which evolves the cascades' h0 on the CPU over a few seconds, integrates the foam texel by texel and finds two biases for Monahan's share: the aging foam alone takes 0.6 of it, the whitecaps the rest.
  • src/cvcGL/ocean/OceanFoam.{h,cpp}: the long and middle cascades' turbulence in one 512 x 256 RGBA32F atlas (two 256^2 tiles, sized to the cascades), ping-ponged; one pass a frame, no copy. OceanFoamCalibration runs foam_history as a sliced task, so the thresholds are found off the frame (natively on the pool; a slice a frame in single-threaded wasm).
  • The short cascade's foam does not persist (a deviation from §10.2): its folds flicker in a fraction of a second, and integrated they whitened the sea evenly and printed its 29 m tile. It keeps the instantaneous whitecaps. ABYSSAL de-weights its short cascade for the same reason.
  • The wake's and the shore's foam do not feed the persistent field: they are not periodic, so they would need a window-space texture, which the one-texture budget did not leave room for.

Shading (A4). One piece of GLSL in OceanFoam.cpp, shared by both hosts: GGX with height-correlated Smith visibility and the sun's disc; Fresnel (F0 0.02) softened as the surface roughens; roughness from Cox-Munk's slopes for the wind, for what the normal and the pixel's footprint leave out; part of it as short ripples in the normal so the sun glitters (the footprint roughness alone washed the glitter out); light through backlit crests; the bubbles brighten the body; lit foam. Ported from ABYSSAL (MIT, 849ff7f4), notices in the source headers and THIRD_PARTY_NOTICES.md.

Level of detail.

  • water.lod_shade (1500 m): the A4 shading within it, the O15 Fresnel water past it.
  • water.lod_foam (150 m): the foam's atlas is read and carved on the near grid within it; past it, and on the whole far grid, the water takes the sea's mean whitecap cover and reads no foam texels.
  • Both are live keys, named for the later geometric-LOD / adaptive-quality PR to drive; 0 turns each off everywhere. lsystem_coast: coast.water.lod_foam / lod_shade.

Keys. New: water.foam_decay (2.5 s; 0 = the whitecaps alone, as before), water.lod_foam, water.lod_shade, on water_controls.ari. All existing keys keep working (foam_bias still fixes the whitecaps' threshold).

Samplers (WebGL2 texture units). The node's vertex stage reads 8 samplers (the three cascades, the bed, the shore distance, the shore layer's two planes, the wake), as before. Its fragment stage reads those 8 and the foam atlas: 9 where it read 8, or 11 where it read 10 with a cloud_sky's shade (two more), as in terrain_lab. lsystem_coast's sea: the vertex stage 8, as before; the fragment stage 3 (the bed, the wake, the atlas) where it read 2. The foam pass's own program reads 3 (two cascades and the last atlas).

Docs: the roadmap's "As built (O5)" under §10.2 and A4 (the Status line untouched), docs/ARIADNE.md's water paragraph, THIRD_PARTY_NOTICES.md.

How it was checked

  • ocean_spectrum_test OceanFoam.*: foam builds and decays at its rate (e^-1 after 2.5 s at 60 or 25 fps, to 1e-9), a stall's step is capped, the look thins into streaks, the history is bit-identical however it is stepped, the biases give Monahan's share at 4, 9, 15 and 25 m/s (drawn within 2 %, the aging foam within 3 % of its 0.6), and the 0.4 s history's aging foam is within 1 % of a 0.1 s one's (0.413 vs 0.416 % at 9 m/s). The existing OceanWhitecaps.* numbers are unchanged.
  • cvcgl_ocean_fft: the GPU pass against foam_step frame by frame (a disc folds for 0.5 s, then the foam decays to e^-1 in 2.5 s: GPU 0.36788, CPU 0.36788), no foam where nothing folds, clear(), a storm's foam within [0, 1].
  • cvcgl_ariadne_realize: the new keys seeded; one 512 x 256 atlas on both meshes, stepping with the clock; the far grid draws the mean cover only; the thresholds land off the frame (33 frames) and replace the guess; the LOD keys are live; foam_decay 0 stops the atlas and gives the whitecaps' threshold alone (0.806 against 0.770 with persistence at 12 m/s).
  • ctest over the ocean, ewave, physics-ocean, Ariadne loader/components/scene-world, world water and cvcgl ocean/ariadne suites: 201 passed, 1 skipped (as on master).
  • Offscreen frames of terrain_lab (arigl snapshot) and lsystem_coast, before and after, looked at by eye.

Frame cost. Measured in one process, so the machine's load drifts out: a scratch harness drew terrain_lab's 1.2 km world (no props) and its water at 1280 x 720 offscreen, the camera 14 m over the crate lake so the water fills most of the frame, each frame a render, a glFinish and the scene's tick. Five configurations alternated 16 times, 30 frames each; the figure is the median over the rounds of each round's difference from the same round's baseline. On the RTX 4070 laptop, with three other agents' builds and benchmarks running: the defaults cost 1.75 ms a frame (quartiles 1.54-2.27) over lod_shade 0 with foam_decay 0, which is O15's shading and whitecaps. The shading alone costs 1.06 ms and the persistent foam alone (its pass, the atlas reads, the windrows) 0.87 ms; the water's whole draw before O5 was 1.55 ms there. lod_shade 0 and foam_decay 0 turn each off. arigl snapshots of terrain_lab across processes (unpaced, 420 frames less 120, medians of 3) swung by ±50 ms with the other benchmarks on the same GPU (115 ms before, 76 after, 45 without the water node), too noisy to show 1-2 ms. At its default 20 fps a snapshot paces its frames to 50 ms, which hides any cost under that; #1264's numbers sat at or near that floor. Not measured: the browser.

Not checked

  • The browser (WebGL2): not run. The GLSL is ES 3.0 (texelFetch only, no float filtering, constant loops), but it has not been compiled by a browser.
  • Linux and macOS: CI only.
  • GPU timer queries per pass.

Part 2: the water's frame cost (from #1321)

The water node profiled, its geometric level of detail, fewer samplers, and O21's adaptive quality (OCEAN-AND-WEATHER-ROADMAP.md §10.10, §10.11, D9).

What changed

Profiling. water.profile (0): 1 times the node's work each frame, section by section, into water.stats.<section>_ms; 2 also waits for the GPU after each section. What it found on terrain_lab (1280 x 720 offscreen, the laptop's Intel Arc iGPU):

  • The largest cost is the physics step's CPU, about 16 ms a frame, most of it the water's fluid field sampling the sea for every immersed cell. Adaptive quality may not touch the physics sea, so this is left as a follow-up.
  • On the GPU, with fences: the three cascades took about 5 ms, the wake's window 2.4 ms and the persistent foam 0.9 ms. The water's own CPU work was under 1 ms.
  • Of the draw, the wake's per-pixel reads were the largest piece.

The cascades in one set of passes (src/cvcGL/ocean/OceanCascades.{h,cpp}, OceanButterfly over tiles).

  • The three cascades' textures are atlases and every pass does all of them: 18 passes a frame instead of 105.
  • The output is texel for texel three OceanFFTs' (worst difference 0).
  • setActive(k) drops the short cascade's passes at the low tiers.
  • The persistent foam reads its Jacobians from the displacement atlas.

Geometric level of detail (D9 (b)'s near part, §10.11).

  • The near grid is three rings: 2, 4 and 8 m at the defaults, about 2.9 times fewer vertices. They snap by the coarsest spacing, so nothing swims.
  • The far grid's vertex shader reads nothing.
  • The short cascade fades out by water.lod_waves (150 m) and is not read past it. A cascade with no weight at a point is never read.
  • The wake is read only inside its window. Its slope reads 12 cells, not 20. A vertex outside the window takes no taps.

Samplers (WebGL2's 16 a draw, shared with the low-memory mapper's arrays).

  • The cascades are one sampler (uDisp).
  • The coast is one (uCoast): the shore distance and depth, then the shore layer's two planes. It replaces the shore grid, the two shore-layer planes and the bed's height field.
  • Per stage, before → after:
    • vertex: 8 → 3 (the cascades, the coast, the wake);
    • fragment: 9 → 4, or 11 → 6 with a cloud_sky's shade;
    • the foam pass: 3 → 2.
  • No sampler added. The cloud shade's previous map is still bound outside a crossfade: at 6 there is no need.

O21 adaptive quality (inc/cvc/ariadne/scene_quality.h, ABYSSAL's Quality.tick at 849ff7f4, MIT notice in the header and THIRD_PARTY_NOTICES.md).

  • AdaptiveQuality is the loop. AriRuntime::frame ticks it on the wall time between frames, and only off the fixed clock, so arigl snapshot and the tests stay at tier 0 and reproducible.
  • Keys under the scene's prefix: quality.adaptive (1) and quality.target_fps (30). The loop writes quality.tier (0–4), quality.scale (0.5–1) and quality.frame_ms.
  • It is ABYSSAL's window, median panic, mean bands, scale steps and cooldowns, with three deviations:
    • No render scale: the scale moves the tiers' distances.
    • So the panic is at 2x target, not 4x. At 4x, the 15 fps model took 29 s to a playable frame.
    • Tiers come back after a 5 s calm spell. That spell doubles each time a tier is lost again within 10 s of returning, so a slow start does not cost the session its quality and an edge machine does not swing.
  • The water's tiers (water_quality; the node's water.quality key, -1 by default, pins one). Drawing only: the physics sea reads none of it.
    • 1: the A4 shading and the persistent foam to half their distance; the wake's window 128² (64 m).
    • 2: the shading to a quarter, the short cascade and the far normal to half, no persistent foam. The whitecaps take the bias that covers Monahan's share alone; the calibration finds it with the other two, off the frame.
    • 3: the plain Fresnel sea, no wake, two cascades (the short one neither transformed nor read).
    • 4: the far normal to a quarter.
  • Not stepped:
    • the near grid's density: its vertices are about 3 % of the water's reads after the rings, by count, and 4 m spacing aliases the middle cascade's 7 m waves;
    • the FFT resolution: it needs bilinear reads and a recalibrated foam.

Docs.

  • The roadmap: "As built (O21)" under §10.10; the water's level of detail under §10.11; D9's row. The Status line is untouched.
  • O5's notes: their GPU was the Intel Arc iGPU, not the RTX 4070. cvcGL's offscreen contexts run there (arigl info), and the same slip is in water: persistent foam, the A4 shading, level of detail and packed samplers (O5, O21) #1314's PR text.
  • docs/ARIADNE.md: the new keys and an adaptive-quality paragraph.
  • water_controls.ari: sliders for lod_waves and quality.

How it was checked

  • ariadne_scene_quality_test (new; 11 cases):
    • ABYSSAL's quality-sim cases: machines at 1, 4 and 15 fps reach a playable frame within 12 s on its cost model.
    • On a model where the scale buys a fifth, the hopeless machines reach the last tier in 12 s.
    • A healthy 60 fps is left alone, and a 2 s hitch drops nothing.
    • Windows close at 24 frames or 400 ms, and the start's cooldown holds.
    • A tier comes back after a calm spell, and an edge machine changes tier at most 20 times in 10 minutes.
    • The same frames give the same moves, and the tier table only takes away.
  • cvcgl_ari_switch:
    • On the fixed clock the loop does not run.
    • 150 ms frames drop to tier 2 at half scale within 3.2 s, and quality.frame_ms reads 156 ms.
    • quality.adaptive 0 holds a hand-set tier.
  • cvcgl_ariadne_realize:
    • The cascades are one 768 x 256 atlas, and the coast is one atlas; no per-cascade, shore-grid or bed sampler is bound.
    • water.quality is seeded at -1.
    • Tier 1 at half scale gives the expected uniforms.
    • water.quality 3 gives the simple shading, no short cascade and no persistent foam, and the whitecaps' threshold alone (higher than with persistence).
    • Tier 0 restores every uniform exactly.
  • cvcgl_ocean_fft:
    • OceanCascades against three OceanFFTs: worst difference 0, 14 passes at N = 64.
    • The foam stepped from the atlas matches the per-texture step.
    • With two cascades active, the first two step and the third is untouched.
  • ctest over the ocean, ewave, AdaptiveQuality/WaterQuality, Ariadne loader/components/scene-world, world-water and cvcgl ocean/ewave/ariadne/ari_/lowmem suites: 172 run, 171 passed, 1 skipped (AriadneLoader.ComboOptionsMayBeAReactiveExpression, as on master). The whole tree builds.
  • With water: persistent foam, the A4 shading, level of detail and packed samplers (O5, O21) #1314 and master f128352 merged in (3686724): cvcgl_ariadne_realize (all of it, including the WebGL2 16-unit section: 0 warnings), cvcgl_ocean_fft, cvcgl_ari_switch, cvcgl_ariadne_physics, ariadne_scene_quality_test (11) and ariadne_scene_world_test (36) pass on Windows Release.

Frame cost. Measured in one process: terrain_lab at 1280 x 720 offscreen on the laptop's Intel Arc iGPU (arigl info; the RTX 4070 sits idle), with other agents' builds and snapshots on the machine. Configurations alternated round by round, 16 frames each after 8 dropped. GPU time is from timestamp queries.

lake view (the water fills the frame) GPU: tick + draw frame, paired vs tier 0
tier 0 5.58 + 18.46 = 24.0 ms (41.8 ms median)
tier 1 3.21 + 17.70 = 20.9 ms within noise (+0.7)
tier 2 3.14 + 17.46 = 20.6 ms within noise (-0.6)
tier 3 1.71 + 15.97 = 17.7 ms -4.7 ms
tier 4 1.74 + 15.97 = 17.7 ms -6.1 ms
  • The default view (the whole world from high up, where the water is a small part of the frame): the tick's GPU work drops 3.4 → 1.7 ms at tier 3, and the frame drops 2.5–3.3 ms at tiers 3–4.
  • The cascades' atlas in one process, three runs of 360 paired steps, each fenced: three OceanFFTs 3.8–4.3 ms against OceanCascades 3.6–3.8 ms, a paired saving of 0.1–0.7 ms. On this iGPU the passes cost their pixels more than their count.
  • Before/after across processes (water: persistent foam, the A4 shading, level of detail and packed samplers (O5, O21) #1314's head against this branch, alternated, 3 rounds, tier 0): the numbers moved with the machine's load by more than the change, so no frame-level before/after is claimed. The lake view's GPU draw, round by round, was 15.6 / 18.9 / 40.0 ms before against 18.6 / 17.7 / 31.6 ms after.
  • The largest cost is the physics step's CPU, about 16 ms a frame (the water's fluid field sampling the sea), which no tier may touch. It is a follow-up for the physics.

Texture units. Now in-tree: cvcgl_ariadne_realize's WebGL2 section (#1313's: the water, the swash and the shade with the low-memory mapper at 16 units, a three-point rig's shadow map) passes with 0 out-of-units warnings on this branch (#1314 alone: 60). Also native, with CVCGL_LOWMEM_MAPPER=force CVCGL_TEXTURE_UNITS=16 arigl snapshot of terrain_lab at e749578 with #1313's commit cherry-picked: no "no texture unit left" line; at 10 units the far grid runs out (control).

Earlier, before #1311 and #1313 were on master, on a local branch with #1313's ba9f40b cherry-picked and #1311's uWindFetch stood in:

  • terrain_lab's opening view and the crate lake: 0 "no texture unit left" lines and 0 "Hardware does not support the number of textures defined" lines.
  • At 10 units the far grid runs out: "10 in all, 5 kept for the mapper's vertex data, 7 shader textures". So the water's draws take 12 of 16 units: 7 shader textures (the cascades, the coast, the wake, the foam, the fetch map and the two cloud-shade maps) plus 5 for the mapper's arrays.
  • Before this PR the same draw would have bound 12 shader textures with water: fetch and lee, gusts, the sea lagging the wind, and currents, in both seas (O13) #1311, 17 units with the arrays.

Frames looked at. Offscreen frames of terrain_lab and the crate lake (arigl snapshot, 1280 x 720), looked at by eye:

  • tiers 0–4 forced with --set water.quality=N: tier 1 keeps the rings and the near foam; tier 2 keeps the whitecaps; tier 3 is the plain sea without wakes;
  • the coast atlas's shoreline and shallows against the pre-packing frame;
  • the 16-unit low-memory-mapper runs.

Not checked

  • The browser (WebGL2): not run. The GLSL keeps to ES 3.0 (texelFetch, no float filtering), but no browser has compiled it.
  • The loop in a real interactive session: only the tests' wall-time frames and the modelled machines were run.
  • Linux and macOS: CI only.

…nahan's share (O5)

foam_step is the turbulence update the GPU runs (foam builds while a
texel folds, decays as exp(-t / decay) after; bubbles, crest, spray),
foam_look the windrow carve the shader draws it with. foam_history
evolves the cascades' h0 over a few seconds, integrates the long
cascades' foam texel by texel, and finds two biases: the aging foam's
alone covers 0.6 of Monahan's share, the whitecaps' the rest. A unit
of work is one cascade's Jacobian, so a caller can slice it.
…ter shading

The long and middle cascades' turbulence lies side by side in one
512 x 256 RGBA32F atlas, ping-ponged: one pass a frame, one sampler for
the water. OceanFoamCalibration runs foam_history as a sliced task.
The GLSL it hands the water: the atlas read bilinear, the windrows, and
the shading (GGX with Smith visibility and the sun's disc, footprint
roughness from Cox-Munk's slopes, short ripples for the glitter, light
through crests, the bubbles), ported from ABYSSAL (MIT, 849ff7f4).
GeometryNode can report the uniforms and textures it was given.
…eir level of detail (O5)

Both draw the long waves' foam from OceanFoam's atlas, carved into
windrows, with the whitecaps on top, and shade with OceanFoam's GLSL.
The thresholds are found off the frame. New keys: foam_decay (0: the
whitecaps alone, as before), lod_foam (the foam's detail ends there; the
mean cover beyond and on the far grid) and lod_shade (the O15 water
beyond), on water_controls.ari; coast.water.* in lsystem_coast.
@transfix
transfix enabled auto-merge (squash) November 16, 2026 09:08
… 105)

The cascades' textures are atlases of tiles side by side and every pass
does all of them: one time pass, 2 log2 n butterfly passes (OceanButterfly
over tiles) and one assemble, texel for texel three OceanFFTs (the test's
worst difference is 0). Each cascade's two work tiles sit together, so
setActive(k) transforms only the first k. OceanFoam steps from the
displacement atlas, and its calibration also finds the whitecaps' bias
for Monahan's share with no persistent foam beside them.
- water.profile times the node's work into water.stats.<section>_ms
  (2 also fences each section on the GPU).
- The cascades come from OceanCascades: one displacement atlas (uDisp).
- The coast is one atlas (uCoast): the shore distance and the still
  water's depth, then the shore layer's two planes. The bed's height
  field is no longer bound.
- The near grid is three rings (2, 4 and 8 m at the defaults). The far
  grid's vertex shader reads nothing. The short cascade fades out by
  water.lod_waves (150 m). The wake is read only inside its window, its
  slope from 12 cells instead of 20.
- Samplers: vertex 8 -> 3, fragment 9 -> 4 (11 -> 6 with a cloud_sky's
  shade).
- cvc::ariadne::AdaptiveQuality ports ABYSSAL's Quality.tick. AriRuntime
  ticks it on the wall time between frames, never on the fixed clock, and
  publishes quality.tier, quality.scale and quality.frame_ms.
  water_quality maps a tier to the water's distances and switches:
  the shading, the persistent foam, the wake's window, the short cascade
  and the far normal. water.quality pins a tier. Drawing only: the
  physics sea is the same at every tier.
The roadmap's "As built (O21)" under §10.10, the water's frame cost and
level of detail under §10.11, and D9's row. O5's frame-cost note names
the GPU it was measured on: the laptop's Intel Arc iGPU, where cvcGL's
contexts run, not the RTX 4070. docs/ARIADNE.md: water.lod_waves,
water.quality and water.profile, and the quality.* keys.
…the calibration

package-windows failed the O5 block three times: the thresholds' sliced task had finished within
the block's first seven frames, so the value read as the guess was already the calibration's
(0.7697) and never changed again. The check now waits on and compares against the guess itself
(0.75), so it passes whether the calibration lands before or during the wait.
The water node keeps both: #1311's lagged sea (keyframes, crossfade, fetch
maps), gusts, cat's paws and current, and the persistent foam, A4 shading
and level of detail. The far grid's cascade weights carry the lee, computed
once a fragment and shared by its normal and the shading's unresolved
slopes; the cat's paws darken the shaded colour as before. The foam's mean
cover, roughness wind and windrow direction follow the sea's wind (its
newest keyframe), as the whitecaps' thresholds already do.
…d; the fetch maps into the coast atlas

Conflicts:
- water_node.cpp: the level of detail's shaders and OceanCascades kept, with O13 in them:
  - the atlas read (wTexel) gets O13's flow map (wDisp(c, w, tile, adv)) for the cascades the
    current carries; wSum and wHt pass uAdvect per cascade;
  - the near grid's vertex weights are depth x edge x owWindW(w, gust); the gust and the current
    are computed for both grids' vertices (the far grid's fragments read through the current);
  - start_ocean takes h0 from the sea's keyframes into OceanCascades; sync_sea uploads per
    cascade through OceanCascades::setH0; the tick keeps adaptive quality's tier with
    follow_sea / sync_sea in place of the wind rebuild; fadeSpec drives the fades, the cover and
    uWindU beside the tier's uniforms.
- ARIADNE.md and water_controls.ari: both sides' keys and wording.

uWindFetch onto the coast atlas: OceanWind::glsl(true) leaves the fetch read to its caller. The
water node packs OceanWind::fetch's texels into uCoast past its planes (upload_atlas; uCoastRows,
uCoastFetch, uWindFetchGrid) and reads them with the same bilinear arithmetic, so the water takes
no sampler for the lee. upload_shore keeps the planes on the CPU; a keyframe's new maps rebuild
the atlas from them. lsystem_coast keeps uWindFetch.

Under a current the middle cascade's persistent foam is read through the same flow map as its
waves (oFoamAt: two reads, weights normalised), so it stays on their folds.

cvcgl_ariadne_realize checks no uWindFetch on either grid and the coast atlas past its planes.
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.
# Conflicts:
#	src/cvcGL/test/cvcgl_ariadne_realize.cpp
@transfix
transfix disabled auto-merge November 17, 2026 00:30
…o feat/water-lod

#1313 made shader textures fit WebGL2's 16 units, and its realize test checks that no draw runs
out with the low-memory mapper at 16. #1314 alone fails that check (its foam atlas is one sampler
more than master's water); this branch's packing (the cascades in uDisp, the coast and the wind's
fetch maps in uCoast) brings the water back under. No conflicts.

cvcgl_ariadne_realize: the WebGL2 section passes (16 texture units, 0 out-of-units warnings).
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 changed the title water: persistent foam and the A4 shading, with distance level of detail (O5) water: persistent foam, the A4 shading, level of detail and packed samplers (O5, O21) Nov 17, 2026
@transfix
transfix enabled auto-merge (squash) November 17, 2026 07:47
…an-foam

# Conflicts:
#	src/cvc/tests/CMakeLists.txt
…an-foam

# Conflicts:
#	src/cvcGL/test/cvcgl_ariadne_realize.cpp
@transfix
transfix merged commit 728440d into master Nov 17, 2026
29 checks passed
@transfix
transfix deleted the feat/ocean-foam branch November 17, 2026 14:13
transfix added a commit that referenced this pull request Nov 17, 2026
…s duplicate goes, its shaderUniform3f stays
transfix added a commit that referenced this pull request Nov 17, 2026
…(D5, D6) (#1316)

* boats: nav drives them, dyn_boat_plant and plant_host's dynamicboat (O12)

cvc::physics::dyn_boat_plant (OCEAN-AND-WEATHER-ROADMAP.md D4) puts a
sim_world's agents on boats (world::add_boat) in a borrowed world that floats
them, beside dyn_bike_plant and dyn_4w_plant. Each boat goes in over its
agent's start at the draft its hull_mesh gives (float_height); a start with
no water under it, too shallow, or a hull that cannot float is refused.

Every world step a driver turns nav's bicycle angle and acceleration into
set_boat_controls. The throttle takes the acceleration as dyn_driver.h does,
over the propeller's thrust at the speed through the water, its trim kept
across sign changes since the water holds the boat back either way. The
rudder holds the bicycle's yaw rate u tan(delta) / L: a feed-forward share of
full rudder and a PI term on the yaw rate's error as a curvature. state()'s
steer is the angle the driver holds, not the rudder, which fed the driver's
corrections into nav's steering-rate limit.

The books are the hull's mechanical energy every step: drive and brake (the
thrust's T u_a through the water), rudder, damping, water (the field load and
the water's own motion on the propeller and rudder), gravity and the
integrator's residual. Presets launch (physics_boat_test's boat; 3.19 m/s,
15.4 m) and jonboat (a 350 kg flat box with a steering outboard; 4.0 m/s,
4.1 m), measured.

- plant_host: dynamicboat / dynamicboat:<presets> on set_water's field and
  the geometry; no water is a fallback to the bicycle.
- world::water_at; water_sample moves to field.h.
- cvc::nav::plant_medium (land, water) and vehicle_plant::medium(), for
  spawning boats on water later.

physics_dyn_boat_plant_test: the presets' envelopes; 2.5 m/s and 0.08 rad/s
held exactly on calm water and within 1 % on a 0.3 m swell; the books' residual
6e-8 to 3.5e-5 of the flow; nav drives a launch and a jonboat 120 m to their
goals and turns them round to goals behind them; plant_host; a hosted world
bit for bit; a pier contact; the refusals; and the pinned hash
96abfc30fcae4fd4 (Windows MSVC; CI to confirm Linux and macOS). No existing
hash moved. pycvc does not bind the plant (it binds no boats yet).

* Ariadne: boats as world vehicles, and spawns by medium so cars stay out of lakes (L3b)

A world document's vehicles: archetypes: can offer a boat, plant: dynamicboat
(or dynamicboat:launch / dynamicboat:jonboat), and every spawn now follows its
archetype's medium: cars never start in water deeper than a ford, boats only in
water deep and open enough for them.

- nav::world_grid gains a water layer: water_depth (the level less the ground at
  each sample, set_water) and solid (what blocks a sample other than a water
  surface). medium_grid(g, medium, depth) is a car's grid with water deeper than
  a ford blocked, or a boat's with only deep enough water free. SceneWorld::grid
  sets the water from a water node over the node's ground, or a generated
  world's bodies of water.
- world: spawns: takes ford_depth (0.3 m), keel_clearance (0.3 m) and
  shore_clearance (0 m). WorldSpawns::set_needs takes each archetype's medium
  (from its plant's vehicle_plant::medium()), a boat's draft
  (dyn_boat_plant::draft, the deepest boat's) and half its length.
  - choose, add, points() (free, medium) and the free-point fallback use each
    medium's grid (ground_for). An untagged point serves only the archetypes
    whose medium it is on.
  - suggest follows the tag's archetype: roads on land, or water_spawn_points
    over the water, spread over each body of water with room.
- WorldVehicles: a dynamicboat fleet (dyn_boat_plant, step_world off) whose
  navigator plans on the inverse grid. The boats float on the water node's field,
  or on still water at the grid's level that the runtime adds when the world has
  none. vehicle_desc_of gives a boat a stand-in (its hull's box, envelope, no
  wheels), boat_desc_of its boat, and entity_info its goal.
- A placed start off its medium (a car in a lake, a boat ashore) moves to a free
  point of its medium, as a blocked start always has.
- dyn_boat_plant::attach also refuses a start where a ray from the hull's top
  meets ground above the boat's deepest point: the field's box alone knows
  nothing of the terrain in it.

ariadne_scene_world_test, on a lake 107 m across in a 300 m world:
- 48 humvees and 24 launches over all four policies each start on their medium;
- the any-points serve both, the free-point fallback respects medium, starts off
  their medium move, and boat suggestions are over the water;
- a launch on nav@1 reaches two goals across the lake with at least 1.6 m of
  water under it;
- without a water node, boats get still water.

nav_world_grid_test covers the water layer and the medium grids.

* Ariadne: a boat node you can drive, and boats drawn with their hulls (D5, D6)

A scene node `type: boat` puts a boat on a water node's sea: a hull, a
propeller and a rudder (preset launch) or a steering outboard (jonboat) in the
scene's physics world, at its draft on the water there. It drives from its
keys or from nav, headless or drawn, and terrain_lab.ari has a launch on the
big lake beside the crates.

- cvc::ariadne::BoatRuntime (scene_boat.h): a dyn_boat_plant with one boat in
  the scene's world (step_world off, stepped around each world step) and a
  sim_world of its own on the water's grid, land and water too shallow for it
  blocked. SceneWorld runs it (bind_boats) from from_scene and from cvcGL's
  realize alike; it goes in once the water's grid is ready.
- Its keys, under its id (or its keys: root): drive (keys / nav), throttle
  and rudder, goal ("x,y"), and its telemetry x, y, z, heading, speed, thrust, reached,
  placed, status. boat_controls.ari is its helm (Settings > Launch in
  terrain_lab.ari).
- dyn_boat_plant::hold_controls / release_controls: a helm in place of the
  driver's command for one boat, the books going on.
- SceneWorld learns a renderer-run water node's ground and level from the
  scene, so a drawn scene's grids carry the water too.
- SceneWorld::restart forgets the old world's node fields; a scene whose water
  node has a body: threw "unknown or removed field id" on restart.

Drawn (cvcGL):
- add_hull_node (vehicle_view): the hull_mesh flat-shaded, white topsides, a
  blue stripe just over the waterline and a dark red bottom below it (static,
  at the resting waterline). A box hull draws open, with a teak sole 0.12 m
  over the waterline. The boat node is its hull bound to the hull body; a
  dynamicboat world vehicle draws the same hull in place of the box stand-in.
- The water node keeps its water out of the four boats nearest the camera
  (boat nodes and boat world vehicles): eight vec3 and four float uniforms on
  its near and far grids (pose; half length, half beam, sheer height; bottom
  height), not a texture, since the water already binds 11-12 of WebGL2's 16
  texture units. A fragment inside a footprint, under its sheer and over its
  bottom, is discarded: a trough deeper than the hull still draws.
- The boat nodes' hulls make waves in the water's wake window.
- GeometryNode::shaderUniformf / shaderUniform3f read a uniform back.

ariadne_scene_world_test:
- a launch on a lake floats at its draft (z -0.85 over a -1 m level); on its
  helm it reaches 3.14 m/s and turns 0.90 rad in 12 s; on nav it reaches a goal
  60 m off in 96.8 s over at least 1.19 m of water; a restart puts it back;
- terrain_lab.ari's launch crosses the lake to its goal on the 9 m/s sea in
  17.8 s over at least 12.4 m of water.

cvcgl_ariadne_physics: the node realizes its hull and is shown, bound and drawn
where the boat floats; the helm moves it 11.0 m and turns it 0.42 rad in 5 s;
the far grid's uniforms hold its footprint, bottom to sheer; a boat world
vehicle draws its hull with no wheels, and the water takes its footprint too.

* ariadne_python: the bridge ops pass self to server_link

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.

* cvcGL: cvcgl_ariadne_realize gets its own ctest timeout (1200 s)

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.

* world_vehicles.h: the includes in clang-format's order after the master merge

* water_node: the uniforms' trailing comments in clang-format's alignment after the master merge

* GeometryNode: one shaderUniformf (master's, from #1314); this branch's duplicate goes, its shaderUniform3f stays
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