Skip to content

physics, ariadne: one scene wind for the water, clouds and trees, and its push on bodies (O14) - #1317

Merged
transfix merged 20 commits into
masterfrom
feat/scene-wind
Nov 17, 2026
Merged

transfix merged 20 commits into
masterfrom
feat/scene-wind

Conversation

@transfix

@transfix transfix commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

O14 of docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md: one scene wind (E5) that the water, the clouds, the trees and the physics all read, and a push from it on the bodies in the world: vehicles, avatars and anything dynamic. Exit: one key turns everything.

Stacked on #1311 (O13, branch feat/ocean-wind): this PR's base is feat/ocean-wind, and it should be retargeted to master once #1311 merges.

What changed, and where

  • One wind, three keys. A document's scene: wind: { speed, dir, gustiness, base } seeds wind.speed (m/s, 10 m up), wind.dir (degrees, the way it blows from +x toward +y) and wind.gustiness, drawn or headless (inc/cvc/ariadne/scene_wind.h: seed_scene_wind, scene_wind_set). While wind.speed is set, every reader follows these keys, with the same gusts at the same (x, y, t) (cvc::algo::wind_gust). wind_controls.ari is the panel.
    • The water (both seas): scene_wind() now returns the scene's wind when there is one. The node's own water.wind_speed / wind_dir / gustiness are a fallback, left alone and unused while the scene has a wind (they're not mirrored). No shader change.
    • cloud_sky: the deck drifts along the wind's heading at the wind's speed at the deck's base (a height profile), times the gusts' spatial mean, in place of sky.wind_az and the fixed 3 m/s; its orographic slopes take the same heading. It publishes sky.drift_az / sky.drift_speed. This fixes O13's SceneWind::azimuth(), which mirrored the heading (90 − dir; it's dir + 90).
    • forest_trees: each tree leans downwind as well as swaying, scaled by the gust at the tree (repose_forest_in_wind), and the forest publishes forest.lean_dir.
  • The force: a time-varying flow hook on cvc::physics fields. inc/cvc/physics/flow_velocity.h: field::wind is a flow_velocity (a velocity in space and time, with a digest) in place of a flow's velocity volumes. wind_flow is the scene's wind times the power-law height profile (h/10)^(1/7) over a base level (the ground's or the water's). A flow with a wind may have no volume: it's then air everywhere.
    • Per-cell drag and torque, as any flow: ½ ρ C_d a |u| u, with a the cell's share of the body's area across u.
    • O(bodies): the field step reads the wind's reference velocity once per body (at its centre of mass) and its profile at nine heights across the body, closer together near the bottom; each cell interpolates. A cell is clipped to the wind's base as to a free surface, so a floating body feels the wind on its part above the water only. The air isn't counted as immersed.
    • The profile is linear below 0.1 m (0.52 of U10 there), so a body near the ground or the water feels a realistic share of the wind (0.70 at a person's middle, 0.69 at a Humvee's centre of mass).
    • In state_hash: the wind's digest goes into the save's surface section, so a world without winds or free surfaces saves and hashes exactly as before, and restore() refuses another wind.
    • A Jolt vehicle's own aero drag (frontal area, C_d) reads the wind at its centre of mass (air_at); its chassis still skips flow fields.
  • Where the push lands:
    • The scene's world (SceneWorld::bind_wind, headless and drawn): one volume-less flow field, added, replaced or removed as the keys change.
    • WorldVehicles: jolt fleets through their aero drag. dynamic, dynamic4w and kinematic fleets get the wind's share of the drag (the drag in moving air less the drag in still air, which the dynamic models already charge) through the drive's external force each navigator tick. entity_info::wind_fx / wind_fy report it.
    • arisrv avatars: the document's wind goes into the room rules' physics section (wind.*, written only when there is a wind) and replicates. Dynamic avatars stand in a flow field in avatar_world, and their walker pushes back. Kinematic avatars hold while the wind's drag is within the walker's grip (840 N) and drift past it; the drift is folded into the intent, so the server, a client's prediction and a replay agree bit for bit.
    • MuJoCo robots: not wired. CVC_WITH_MUJOCO is off on this machine and its deps aren't installed, so I couldn't build mujoco_robot.cpp. The seam is the same wind_flow into xfrc_applied per body.
  • Docs: the roadmap's "As built (O14)" under E5 (Status line untouched), docs/ARIADNE.md §5.4 "Wind" and the component table, docs/PHYSICS_API.md "The wind: a flow field's flow_velocity".
  • terrain_lab.ari (second commit) gets the scene's wind: wind: { speed: 9, dir: 30, gustiness: 0.25 }. Before this, its water blew toward 30° and its clouds drifted toward +x (wind_az: 90), so they disagreed.
    • I kept 30°, the water's direction, because the swell and the coast's lee were tuned to it. The clouds now drift toward 30° (sky.drift_az 120).
    • The water's wind_speed / wind_dir and the sky's wind_az stay as fallbacks, commented as such.
    • Settings has a Wind item opening wind_controls.
    • The Water and Sky panels' wind sliders now say in their tooltips that they're unused while the scene has a wind. Sky's Drift tooltip says 1 is the wind's speed at the deck.
    • The clouds now move at the wind's speed at their base, about 14.6 m/s (9 m/s × 1.63 at 300 m), where they used to move at a fixed 3 m/s. That's realistic but visibly faster. sky.drift scales it if the owner wants them slower.
    • The trees don't move. terrain_lab's trees are the generated world's foliage meshes, which have never swayed. forest_trees (which does follow the wind) isn't in terrain_lab. A wind lean for the world's foliage would be a vertex-shader job (uniforms only) and isn't in this PR.

How it was checked (Windows 11, MSVC Release)

New tests, with what they measured:

  • physics_field_test:
    • TheSceneWindCarriesABallAlongTheDragCurve: a 1 kg ball 0.5 m in radius, 10 m up in a 10 m/s wind (no gravity), reaches 8.285 m/s in 2 s; the drag curve says 8.279. The profile reads 0.72 of U10 at 1 m and 1.26 at 50 m.
    • AFloatingCrateDriftsDownwind: a 1 × 1 × 0.5 m crate at density 500 floats upright in a 10 m/s wind and drifts 0.154 m/s on the water's drag alone, against 0.156 m/s where the wind's drag on its top half balances the water's on the bottom half. On the scene water's damping it drifts 0.0013 m/s. Its immersed volume is the water's half only.
    • TheSceneWindIsInTheStateHash: the hash moves with the wind; a world without one hashes as before; restore() refuses another wind; a wind on a fluid, and a flow with neither volume nor wind, are refused.
    • TheSceneWindIsTheSameOnEveryPlatform: pins the digest (c7ec24178041550e) and 200 velocities (3ec1c28ca0601404).
  • physics_vehicle_test, ACrosswindPushesTheCarAside: a Humvee at 25 m/s in a 15 m/s crosswind is pushed 406 N aside (0.15 m/s², under 0.05 g), matching ½ ρ C_d A |u| u for the 10.4 m/s of air at its centre of mass.
  • ariadne_scene_world_test:
    • AriadneWorldVehicles.TheSceneWindPushesEveryPlant: four plants under nav@1 in a 30 m/s wind for 8 s, against the same run in still air. Push downwind and offset from the still-air run: jolt 1273 N, 2.20 m; dynamic 1189 N, 4.34 m; dynamic4w 1881 N, 0.16 m; kinematic 1576 N, 1.15 m. The push is exactly 0 without a wind.
    • AriadneSceneWorld.TheSceneWindCarriesWhatFallsAndTurnsWithItsKey: a beach ball dropped from 40 m in a 12 m/s wind is at (51.4, 0) after 4 s. With wind.dir set to 90 it's at (0, 51.7). Clearing wind.speed takes the field out of the world.
    • AriadneSceneWorld.TheWaterFollowsTheScenesWind: the water takes the scene's wind and turns with wind.dir while its own keys stay; clearing wind.speed gives it its own wind back.
  • holon_test:
    • HolonTest.KinematicAvatarsHoldInABreezeAndDriftInAGale: standing 1 s, an avatar doesn't move in 9 m/s and slides 23.1 m in 90 m/s. The client's prediction is bit for bit the server's.
    • HolonPhysicsTest.TheWindPushesADynamicAvatar: standing 2 s, 0.005 m in 9 m/s (the walker holds), 13.6 m in 75 m/s.
  • world_rules_test, TheScenesWindIsTheRooms: a document's wind: becomes the room rules' wind and round-trips through the room's rules section; a negative speed is refused. (A room without a wind writes no wind.* keys, so its section is unchanged; the existing room-rules tests pass.)
  • cvcgl_ariadne_realize, "O14: one key turns everything": with a generated world, a water node (own wind 3 m/s toward −90°), a cloud_sky and forest_trees, the scene's wind (9 m/s toward 30°) drives all three. The water's wind is 30°, sky.drift_az is 120 and forest.lean_dir is 30, while water.wind_dir stays −90. Setting wind.dir to 120 turns them to 120 / 210 / 120 on the next tick. Clearing wind.speed puts each back on its own wind.
  • AriadneComponents.ShippedComponentsLoadClean: wind_controls.ari loads, binds, and is in INDEX.ari.

Regression: 1413 tests matching Physics, Ocean, Algo, Ariadne, Holon, Avatar, WorldRules, Room, cvcgl_ariadne, cvcgl_ocean, Lsys, Forest, Wind and Conference all pass; the skips are the usual ones. No existing golden hash moved: a world without a wind saves and hashes as before.

terrain_lab frames: one key, before and after

Offscreen arigl snapshot at 1280×720, same camera (held by an on_tick orbit). "After" is the same document with --set wind.dir=120 and nothing else. I looked at each one:

  • Island world (preset: island, edge: shore, looking along the wind): at 30° the water in front of the island is in its lee, glassy, with the sun's glint unbroken. At 120° the lee has moved off to the side, and the same water is rough, the glint broken into ripples.
  • Overview (the 1.2 km world from 1300 m, 400 frames in): the near cloud starts over the city's west. At 30° it has drifted one way, at 120° a quarter-turn away from that, with its shade going with it.
  • On the shipped world the lakes are fetch-limited and nearly glassy at either direction, so the wind's direction doesn't show in the lake close-ups (only the crates' wake rings do).

I haven't recorded an MP4: arigl snapshot --mp4 (#1310) isn't on master yet. The live turn (one key changing everything on the next tick) is covered by cvcgl_ariadne_realize.

Frame rate and WebGL2

No new sampler, texture or shader change: the water reads the scene wind through its existing uniforms. The cloud drift and the trees' lean are CPU work per frame (one gust frame, and one lean per tree in place of the old sway). The physics reads the wind once per body per step, and once per pushed vehicle per navigator tick.

terrain_lab with the wind on vs off, same binaries: on is the document as shipped, off is --set wind.speed= (cleared, so the water and clouds use their own winds and there's no wind field). Each figure is ms per frame, (720-frame run − 120-frame run) / 600, arigl snapshot 1280×720, three rounds in ABBA order on a machine shared with other agents' builds:

round wind on wind off
1 76.6 79.0
2 71.0 78.4
3 69.8 76.3
median 71.0 78.4

On − off is −2.4, −7.4 and −6.5 ms: the wind costs nothing this machine can see. The "faster" side is noise: the deck's clouds sit in different places once they drift at a different speed.

Not done, not checked

…in both seas (O13)

- cvc::algo::wind_field: the scene's gusts as one deterministic function of (x, y, t): two scales
  of integer-hashed value noise carried downwind and ABYSSAL's pulse over time. cvc/gl/WindGLSL.h
  is the same in GLSL, no texture. Everything the wind moves (O14: the clouds, the trees, the air
  physics) can sample it at the same point and time.
- cvc::ocean: fetch.h (the fetch map in one upwind sweep, coarse, capped by each body's extent; each
  cascade scaled by sqrt(F / F_full), F_full where its band is fully grown), sea_lag.h (the sea's
  wind follows with a time constant and steps by keyframes, at most one per crossfade), current.h
  (a divergence-free curl-noise current and a two-phase flow map). sea_surface takes a
  sea_forcing: the h0 crossfade, the fetch scales, the ripples' gust weight, the current.
- Ariadne: scene_wind.h reads a node's wind in one place (O14 points it at wind.*).
  SceneWaterSeaClock steps the keyframes both seas use. New water keys: gustiness, lee, sea_lag,
  sea_fade, current (water_controls.ari, ARIADNE.md).
- cvcGL: OceanWind (one RG32F texture of the two keyframes' fetch maps; the gusts and the current
  hashed per vertex). The water node and lsystem_coast draw the lee, the gusts (the ripples'
  weight, cat's paws in the shading), the current carrying the two short cascades, and mix the two
  keyframes' h0 on the CPU only while a crossfade runs.
- Tests: ocean_wind_test (fetch behind an island and on a lake, the lag and its debounce, a
  continuous crossfade, golden hashes of the fetch map, the gusts and the current, a
  divergence-free current, the physics sea's lee and current), a floating crate in the lee against
  one in the open (ariadne_scene_world_test), the water node's new keys (cvcgl_ariadne_realize).

No golden hash moved: a sea_surface without a forcing has the same digest and values as before.
… its push on bodies (O14)

A document's scene: wind: seeds wind.speed, wind.dir and wind.gustiness. While wind.speed is
set, the water (both seas), cloud_sky's drift and orographic heading, and the forest's lean and
sway all follow those keys, sampling the same gust field at the same (x, y, t). Each node's own
wind keys are the fallback. SceneWind::azimuth is dir + 90 (O13 had it mirrored).

cvc::physics: field::wind takes a flow_velocity (a velocity in space and time, with a digest).
wind_flow is the scene's wind over a power-law height profile, linear below 0.1 m. A flow with a
wind may have no volume (then it is air everywhere). The field step reads the wind once per body
and its profile at nine heights across the body, and clips cells to the wind's base. The wind's
digest is in save() and state_hash(); a world without one hashes as before. A vehicle's aero drag
reads the wind at its centre of mass.

The push: SceneWorld adds the wind as a flow field. WorldVehicles' dynamic, dynamic4w and
kinematic fleets get the wind's share of the drag through the drive's external force. The room
rules carry the wind to arisrv: dynamic avatars stand in a flow field, and kinematic avatars
drift once the wind's drag beats the walker's grip, the drift folded into the intent.

wind_controls.ari; docs: roadmap As built (O14), ARIADNE.md Wind, PHYSICS_API.md flow hook.
…ater and clouds, and a Wind panel in Settings

The water's and the clouds' own winds stay as fallbacks. The Water and Sky panels' wind
sliders say they are unused while the scene has a wind.
…intent

The test runs 120 frames while a writer thread replaces vehicle a's intent, then expects a to be
moving. A thread can start late: on a busy machine all 120 frames (a few tens of milliseconds)
passed before the writer ran, no intent reached a, and only the last 6 frames moved it. That
reads 0.10766078436440293 m/s, which is what recipe / windows-2022 / Release read on #1318, and
what a writer held back until the frames end reads here, bit for bit.

The frames now start once the writer has landed an intent (10 s at most). A failure says a's speed
after the threaded frames, how many intents landed during them, and whether a existed. It passes
with the writer started 300 ms late.
…s mid-run

After its first intent the writer may still be descheduled for all 120 frames (a few tens of
milliseconds on a busy machine), which would fail the check that an intent landed while the world
stepped. The world now steps on, a frame at a time, until one does (10 s at most).
Base automatically changed from feat/ocean-wind to master November 16, 2026 18:05
This branch carried #1311's original commit (b6ab0c4), whose files are identical in the squash.
The add/add conflicts (wind_field.h/.cpp, scene_wind.h/.cpp) and water_controls.ari take this
branch's side, which is #1311 plus #1317's changes. docs/ARIADNE.md is a three-way merge on
b6ab0c4 as its base, so master's later edits and #1317's both stand. Against master, the result
is exactly #1317's own diff against b6ab0c4: the same 44 files and the same changed lines.
@transfix
transfix enabled auto-merge (squash) November 16, 2026 19:19
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.
…ne-wind

# 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.
…ne-wind

# Conflicts:
#	src/cvc/ariadne/scene_world.cpp
#	src/cvc/ariadne/world_vehicles.cpp
#	src/cvc/tests/ariadne_scene_world_test.cpp
…ne-wind

# Conflicts:
#	docs/ARIADNE.md
#	examples/ariadne/documents/terrain_lab.ari
#	src/cvc/ariadne/components/INDEX.ari
#	src/cvc/ariadne/components/sky_controls.ari
#	src/cvcGL/ariadne/lsystem_nodes.cpp
#	src/cvcGL/test/cvcgl_ariadne_realize.cpp
…feat/scene-wind

#1322 moved each cell's reads into read_cell() (and ahead of the loop, on the field workers, for a
free surface's cells). The scene wind's per-cell work moves with it: body_wind holds a body's wind
(its reference at the centre of mass and its height profile), made once per body and field as
before, and read_cell takes it to clip the cell at the wind's base and to read its velocity. A
wind is a flow's and a free surface a fluid's, so the workers' reads never need it. The arithmetic
is the branch's, in the same order. world.cpp keeps #1322's timing and the branch's field_time()
for the vehicles' pre_step; the tests are both sides'.
…ne-wind

# Conflicts:
#	docs/ARIADNE.md
#	examples/ariadne/documents/terrain_lab.ari
#	src/cvcGL/test/cvcgl_ariadne_realize.cpp
…e-wind

world_vehicles.cpp: the runtime keeps both the scene's wind (set_wind) and the boats' still water.
The wind's push on the plants that feel no field now leaves the boat fleet out as it leaves out the
jolt vehicles: a boat's hull is a dynamic body in the scene's physics world, so the wind's flow field
already drags on its part in the air, and the push would charge it twice.
@transfix
transfix merged commit dca779f into master Nov 17, 2026
29 checks passed
@transfix
transfix deleted the feat/scene-wind branch November 17, 2026 17:53
transfix added a commit that referenced this pull request Nov 17, 2026
Merged on #1317's final head (eab251e) as the base, so the squash's copy of #1317 meets this
branch's and only the trees' own changes are applied over master.
transfix added a commit that referenced this pull request Nov 17, 2026
Both sides kept: bind_boats beside bind_wind (scene_world.h, scene_realize.cpp), the Boats and Wind
sections in ARIADNE.md, terrain_lab's boat and wind panels. The Launch panel moves under World to
[16, 590]: the right column now holds Sky, Water, Weather and Wind. A boat node's hull is a dynamic
body, so the wind's flow field drags on it directly (it is not a world vehicle, so the vehicles'
wind push does not reach it).
transfix added a commit that referenced this pull request Nov 17, 2026
Merged on #1317's final head (eab251e) as the base, so the squash's copy of #1317 meets this
branch's and only the inertial fluid'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