Repository navigation
Storm wind: gust fronts in the scene's wind, and the wind on MuJoCo robots (O20, part 2: F4, F6's gusts) - #1345
Merged
Merged
Conversation
…obots (O20, part 2: F4, F6's gusts) - cvc::world::weather::gust_front: each storm cell's outflow, a function of the weather's cells at t. It rises to front_speed (12 m/s) at the front's edge, front_ahead radii ahead of the cell along its motion (front_behind behind, weaker there), and dies away to exactly 0 past its reach. Ahead of a storm the wind rises, beside it it veers, behind it it drops. Props: gust_front, front_ahead, front_behind, front_width. - The physics: in a scene with a wind and a weather node, the world's air is a StormWindFlow (scene_weather.h), the wind with every front in it as a pure function of the point and time. Bodies read it at the step's own time, and the storms at the clock's (the offset where the world anchored). Light bodies under a front are pushed harder and turned, the same at every frame rate. - One wind for the water and the trees: the scene's world writes the front at the weather's centre to wind.front before the water reads its wind, and scene_wind_now adds it. The sea builds toward it through its lag. The gusts' pattern still drifts with the wind as authored. - steeringWind() and the weather's start steer by the scene's wind as authored (scene_weather_steering), drawn and headless alike. The rain's slant is the wind at the camera with the front there. - mujoco_robot::set_wind: the drag on each collision geom's box, as xfrc_applied for the step beside apply_wrench's pushes, booked as external work. SceneWorld::wind() hands the scene's air out. - Scenes without a weather node step as before, bit for bit.
…eepers, MuJoCo fixes - The water's physics sea no longer depends on frame pacing in a scene with storms. The scene's world publishes wind.front as the front at the start of each 0.5 s clock period (kSceneWindFrontPeriod). While the scene has storms, WaterRuntime steps its sea once per period, to the next period's start (SceneColliders::clock_period). A keyframe's field then goes in at the first physics step past that tick (SceneColliders::from_tick, applied in follow's step loop). A scene without storms is unchanged. - Sleeping bodies under a front wake: on the first step of each period, each moving scene body asleep where a front blows over 0.5 m/s gets a zero force before the step. - MuJoCo: set_wind's time offset for a scene's air is the world's field time at the robot's start, not the clock's (docs, plus a test that reads the air at field time against the clock's storms). The pushes are put back by a scope guard, also on a throw, unless MuJoCo reset the state. Bodies welded to the world and mocap bodies take no drag. - Drawn and headless steering read the same deck base: the drawn node reads it at its first tick from its sky's key, and the headless world from the matching cloud_sky's base prop (scene_weather_deck_base). - wind.front is cleared when the scene's world goes, when the physics stops, and when a scene has no storms. - Docs: the ball's 16.6 m/s, avatars keep the room's plain wind. - The MuJoCo test model is written per test (named after it), so ctest -j runs cannot share the file. - SceneWorld::water(node) exposes a from_scene water runtime. - New tests: TheFrontsSeaFloatsBodiesAlikeAtEveryFrameRate, AFrontWakesASleepingBody, MujocoRobotWind.TheWindsPushEndsWithItsStep, and the field-time read in TheGustFrontIsInTheStepOnTheClocksTime.
- weather.gust_front is now a live key (m/s, under the weather node's key
root, seeded from the gust_front prop, default 12; 0 turns the fronts
off). The Weather panel has a Storm wind slider (0 to 30).
- The drawn node takes a change at once, for the rain's slant.
- WeatherFriction reads the key at sync and switches its model at the
first step past the start of the next clock period
(WeatherFriction::switch_gust, before the plants' before_step). The
scene's world then rebuilds its air, so wind.front and the woken
bodies follow on the clock.
- While the scene has storms, the sea's crossfade is at least two clock
periods. Otherwise a short sea_fade lets the sea keyframe in back-to-back
periods, and the world's own water runtime (ticked before the steps) and
a renderer's (ticked after them) would put in different fields.
- A follow that runs the clock over more than one period start warns once.
The docs say determinism needs a sync each period.
- Water stepping on the clock now requires a scene wind as well as a
weather node. It does not depend on whether a front blows, since the
live key can turn the fronts off mid-run.
- Headless steering reads the sky's <sky>.base key first, as the drawn
node does, and falls back to the document's cloud_sky base.
- The timed field change goes in before the vehicles' and boats'
before_step.
- Docs: WaterRuntime's period stepping is described in scene_water.h.
GustsAndTheScenesClockReachTheRobot is renamed
GustsReachTheRobotAtItsTimeOffset.
- New tests: TheStormWindsPeakIsALiveKeySwitchedOnTheClock,
ARendersSeaAndAHeadlessOneFloatAlikeWithAShortCrossfade (a renderer's
order through SceneWorld::build against from_scene),
TheSeaStepsOnTheClockOnlyWithAWindAndSteersAtTheSkysKey, and
AriadneComponents.WeatherControlsBindTheStormWind.
transfix
enabled auto-merge (squash)
November 18, 2026 04:20
transfix
added a commit
that referenced
this pull request
Nov 26, 2026
… is, headless steering (#1551) The ocean roadmap's F4/F6 "Not done" list after the storm wind (#1345). - Sea keyframes off the frame: while a scene has storms, a keyframe's h0 and fetch maps (100-250 ms) are a sliced job on the app's scheduler (SceneWaterSeaClock::begin, cvc::ocean::h0_builder), adopted once done or finished at the tick its field goes in after (WaterRuntime::tick, SceneColliders::settle from the world's sync). The same keyframe, field and tick, to the bit; `sea_threading: frame` keeps the old way. The drawn sea now shows the old keyframe until a clocked keyframe's crossfade starts (it popped to the new h0 up to 0.5 s early). - Fronts where each thing is: one front shape (cvc::algo::add_gust_front) for the weather, the sea and the shaders. The water's ripples and roughness scale by the wind there over the centre's (drawn per vertex through StormFrontGLSL's uniforms; the physics sea through sea_forcing::fronts and SceneColliders::air); the generated world's trees lean per vertex and the pines per tree. - Headless steering: WeatherFriction logs steer and rate events on the clock, drawn or headless (switch_steering); the drawn node reads them. - Front gustiness: decided, not built (roadmap section 15, D14). No pinned hash moved. New tests: OceanH0.ABuilderStepByStepIsBuildH0, OceanSea.AGustFrontRaisesTheRipplesWhereItBlows, AriadneSceneWeather.TheSeasKeyframesAreBuiltOffTheFrameAndGoInAtTheSameTick, AriadneSceneWeather.AFrontAtOneEndOfTheWorldReachesTheWavesAndBodiesThereFirst, cvcgl_ariadne_physics test_steering_headless_and_drawn, and the realize test's "the storms' fronts where each tree and wave is".
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.
The storm wind from the water/weather roadmap (docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md §9 F4, and F6's "gusts push light bodies"), plus the open item from #1317: the scene's wind on MuJoCo robots as
xfrc_applied.What it does
The gust front (
cvc::world::weather::gust_front,weather.h) is a function of the weather's cells at a time t. Nothing is stepped. Each cell's outflow:front_speed(12 m/s for a full cell) at the front's edge;front_ahead(1.5) radii ahead of the cell along its motion andfront_behind(0.9) behind it, and the outflow is weaker behind;front_width(0.6), and it is exactly 0 beyond that;rain_onset.Ahead of a storm the wind rises, beside it the wind veers, and behind it the wind drops. The weather node's props are
gust_front,front_ahead,front_behindandfront_width.Physics. With a scene wind and a weather node, the world's flow field is a
StormWindFlow(scene_weather.h): the wind with every front in it, a pure function of point and time.wind_flow's bit for bit.SceneWorld::wind()hands it out.The water and the trees read one wind for everything they draw. Each
sync(), the scene's world writes the front at the weather's centre towind.front("x y" m/s) before the water reads its wind, andscene_wind_nowadds it.sea_lag, and its whitecaps follow the keyframe's wind.The rain's slant is the wind at the camera, including the front there.
Steering.
steeringWind()reads the scene wind when there is one (scene_weather_steering): its heading, at its speed at the deck's base as authored, timessky.drift. Otherwise it readssky.wind_azas before. The weather also starts from this steering, drawn and headless (WeatherFriction), so terrain_lab's storms steer the same in both.MuJoCo (
mujoco_robot::set_wind(air, time_offset, C_d, rho)). At each step's start, every collision geom of a moving body takes ½ ρ C_d A |u| u on its bounding box. That goes intoxfrc_appliedfor the step, on top ofapply_wrench's pushes (which are put back after the step), and the books count it as external work.mj_kinematics/mj_comPos/mj_comVelbeforemj_step, so with no air or no drag the robot steps to the same bits.Decision: the fronts ride on the scene's wind. A scene with storms but no
wind:has no fronts.Scenes without a weather node step as before, bit for bit. The field is unchanged, nothing writes
wind.front, and the water's spec is unchanged.Measured (Windows 11, MSVC 2022 Release)
WorldWeather.AGustFrontRunsAheadOfACell), ahead of a mature 1000 m cell: 0, 5.25, 9.00, 11.25, 12.00 m/s at 0/375/750/1125/1500 m (the edge), then 10.84, 5.74, 0.53 m/s at 1700/2000/2300 m, and 0 from 2400 m on. A 9 m/s wind is 21.0 m/s at the front's edge and veers 46.8° beside the cell.AriadneSceneWeather.AStormsGustFrontPushesALightBody): a 1 kg, 1 m ball in a 6 m/s wind. Ahead of a storm it moves at 16.6 m/s, beside the storm at (5.1, 5.3) m/s. With the storm out of reach, or no storm, it moves at 6 m/s, the same bits both ways.TheGustFrontIsInTheStepOnTheClocksTime): one run at one frame per clock quantum (720 frames), one at 0.137 s frames (90). The ball and the world's state hash are equal at every tick both runs looked at, while the front swept the ball up to 16.3 m/s.TheWaterReadsTheGustFrontThroughItsLag): a 12 m/s front over the centre makes the spec's wind 18 m/s, and the sea's wind is 8.65 m/s after 6 s and 18.0 m/s after 60 s. That took 11 keyframes, about 1 s of h0 builds in all, 113 ms at most.TheStormWindIsCheap), one step on 100 bodies with 6 storms alive: 13.9 µs against 6.0 µs for the plain wind, about 0.1 µs per body per step.weather::at(2.2 µs) and a key write. The real cost is the water's keyframes while a front ramps in: at most one per 4 s crossfade in each sea, 100–250 ms each, on the frame's thread, the same as dragging the wind slider. arigl frame time with a front passing was not measured; the machine was shared with other builds.MujocoRobotWind.*, on a model the test writes itself):Tests run (all pass)
world_weather_test (13), ariadne_scene_world_test (72), physics_field_test (30), physics_world_test (47), physics_vehicle_test (26), physics_boat_test, physics_hull_test, physics_immersion_test, physics_energy_test, physics_parity_test, physics_replay_test (ctest), cvcgl_ariadne_physics, cvcgl_ariadne_realize (adds: with a scene wind the storms steer by it), and physics_mujoco_robot_test's
MujocoRobotWind.*with CVC_WITH_MUJOCO on (MuJoCo 4.0.0+cvc.3 from cvcpkg).Not verified
mujoco-menagerie. The CI MuJoCo lane (Linux) runs them and the new wind tests.Not done
set_wind, and MuJoCo robots are not in Ariadne scenes yet.Review fixes (a2a9233)
wind.frontnow holds the front at the start of each 0.5 s clock period, not at each frame's time.WaterRuntimesteps its sea once per period: in period k it steps to the start of period k+1, with period k's wind.SceneColliders::from_tick, applied infollow()'s step loop), not at the next sync.TheFrontsSeaFloatsBodiesAlikeAtEveryFrameRatefloats a crate on a lake while a front arrives (2 keyframes after the first). Runs at 1080 frames and at 135 frames of 0.137 s agree on the crate and on the state hash at every shared tick. With the per-frame sea it fails (checked).AFrontWakesASleepingBody, a 10 kg crate that slept in a 6 m/s wind is pushed 6.8 m; without the wake it does not move (checked). Vehicles and boats are not woken.world().field_time()); the docs said the clock's time, which counts the clock offset twice.TheWindsPushEndsWithItsStepfails without the restore (9.25 m against 0.5 mm, checked).baseprop of the cloud_sky the weather'ssky:names (scene_weather_deck_base).wind.frontis cleared when the scene's world goes away, when physics stops, and in a scene with no storms.ctest -jruns never share it.Re-run: world_weather, ariadne_scene_world (74), physics_field, physics_world, physics_vehicle, physics_parity, physics_boat, physics_hull, physics_immersion, physics_energy, physics_replay (ctest), holon, cvcgl_ariadne_physics, cvcgl_ariadne_realize, MujocoRobotWind.* (5). All pass.
Re-review items (b249df9)
A. The storm wind's peak is now a setting.
weather.gust_front: m/s, under the weather node's key root, seeded from thegust_frontprop (default 12). 0 turns the fronts off.WeatherFriction::switch_gust). The air (StormWindFlow),wind.frontand the woken bodies follow at that step.TheStormWindsPeakIsALiveKeySwitchedOnTheClock: the key goes from 12 to 24, set mid-frame for the 0.137 s run and read at tick 267 (280 in that run).WeatherControlsBindTheStormWindchecks the slider's bind, range and tooltip.B. The low items.
ARendersSeaAndAHeadlessOneFloatAlikeWithAShortCrossfadebuilds the world in a renderer's order (SceneWorld::build, with the water runtime ticked after each follow) and compares it againstfrom_scene. The lake hassea_fade0.2 andsea_lag1, run at 0.137 s frames.<sky>.basekey first, then the document's cloud_sky base. Withsky.baseset to 600 the storms steer at 10.49 m/s; without the key-first read they steer at 9.75 (checked).before_step. No test covers this: both orders are deterministic, so frame pacing can't show the difference. It was checked by reading the code.scene_water.hnow describes the period stepping, andscene_wind.hpoints toWaterRuntime. A MuJoCo test is renamed toGustsReachTheRobotAtItsTimeOffset.Re-run, all passing: world_weather (13), ariadne_scene_world (77), ariadne_loader (242), physics_field (30), physics_world, physics_vehicle, physics_parity, physics_boat, physics_hull, physics_immersion, physics_energy, physics_replay (ctest), holon (46), cvcgl_ariadne_physics, cvcgl_ariadne_realize, and
MujocoRobotWind.*(5).