Repository navigation
cvc::ocean: the swash, runup up the beach, a film and wet sand (O4b) - #1131
Merged
Merged
Conversation
coast.water.weight_long, weight_mid and weight_short (the 251, 83 and 29 m cascades) set each band's amplitude, baked into h0 so the physics band will see the same sea; a change rebuilds h0 like any spectrum knob. All default to 1, the one physical spectrum, so the default sea is unchanged (an orbit capture's frame is byte-identical to before). The Ocean panel gains a slider for each (0 to 2).
…red (O3) O3 of docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md (A1, A2, W0.2's textures). The seabed is a HeightFieldTexture of terrainH at 1 m over the ocean, and the shore grid is cvc::world::water_bodies uploaded as an RGBA32F texture (distance to shore, offshore normal, slope). The vertex shader fades each cascade as the still water shoals, over its band's half wavelength capped by coast.water.shore_fade (3 m: the island's shelf is about 9 m deep to the horizon, so the uncapped rule would calm the whole sea before the shore layer, O4, carries the long waves in), and never moves a vertex sideways more than 0.8 of its distance to the shore. The fragment shader's depth reads the seabed texture; coastH(), the GLSL copy of terrainH, is gone. lsystem_coast --shore-check evaluates the vertex shader's displacement on the CPU over the read-back cascades: at t = 1.3 s the old shader put 60 offshore vertices on dry ground, this one none (76 and none at t = 5 s).
… and reflecting (O4a)
O4 of docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md, its waves (A3); the runup film and wetness are
O4b. cvc/ocean/shore.h builds, over a shore grid of plain planes (depth, shore distance and normal):
* the phase, |grad P| = k(depth) by fast marching from the edge the swell enters, as a plane
wave, so offshore crests stay straight and turn toward the shore as it shoals (Snell), wrapping
round an island; k from the exact dispersion relation (Newton from Eckart);
* the amplitude: shoaled by sqrt(c_g0 / c_g) (Green's law in shallow water), shadowed near shores
facing away from the swell, capped where a set would break (gamma_b = 0.78), the excess the
breaking intensity;
* Battjes' reflection from the surf zone's mean slope, a reflected train fading offshore;
* Gerstner steepness rising toward breaking; and evaluate(), the sum the GPU draws.
lsystem_coast draws it: the swell (coast.water.swell_*, now 1.2 m at 10 s by default) is the shore
layer's, uploaded as two RGBA32F textures and summed in the vertex shader with the wind-sea cascades,
breaking crests feeding foam; wave_amp scales the cascades only, so the breaking cap holds. A --set
KEY=VALUE option seeds any knob. The shore check counts the swell's sideways move too: none of the
44722 offshore vertices lands on dry ground.
…/ocean-shore-layer # Conflicts: # examples/cvcgl/lsystem_coast.cpp
…/ocean-shore-layer # Conflicts: # examples/cvcgl/lsystem_coast.cpp
O4b of docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md (A3's runup and swash, D4). The shore layer gains a runup field, Hunt's R = min(xi, 2.5) H0 as shadowed as the swell, carried with the phase swash_reach_m (30 m) up the dry beach. shore_layer::swash(x, y, t, ground_z) runs each wave's front up to R (1 + cos theta) / 2 on the first train's phase and back: the film under it, the foam lace at its edge, and the wetness exp(-age / dry_time), the age since the front last left the ground. That age follows from the phase, so the swash needs no wetness texture or ping-pong pass and the CPU knows where it is wet; rain's texture (F3) can take it as a writer. lsystem_coast draws it in the terrain's fragment shader after VTK's texture: wet sand darkens and shines toward grazing angles, the film tints it, foam marks the front; coast.water.dry_time sets the drying. The direction texture's third channel is now the runup (the shader never read k). The shore check reports the swash: at the default 1.2 m swell, runup to 3 m on the windward beaches, about 1000 beach cells within its reach, the lee dry.
…/ocean-swash # Conflicts: # docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md # examples/cvcgl/lsystem_coast.cpp # inc/cvc/ocean/shore.h # src/cvc/ocean/shore.cpp # src/cvc/tests/ocean_shore_test.cpp
…arsed bodies The writable-data scan failed on package-linux / libcvc-release-grpc: - #1109 moved nav's per-thread EDT scratch into cvc::algo (edt_scratch) and left grid_nav its own sdf_scratch; both are thread_local scratch buffers, the same objects as the two stale grid_nav edt_scratch lines they replace. - script_engine.cpp's SlicedCall constructor and locked_call each hold a static const parsed program (`body`), built once and never written. The new list is the one the scan emitted for this build.
package-macos / libcvc-debug failed ScriptEngineTest.AKeyHookTakesEveryKeyInOrder (finished 4, not 3) and AFailedEventLetsTheNextOneGo (3 outcomes, not 2), the same on every retry. ScriptLane::take_queue moved on_done out of its copy of the hook's options into the QueueDelivery, then passed the options on to start(). libc++ moves a std::function whose callable sits in its small buffer by copying it, so the moved-from on_done still held the test's lambda. The activation then called it once more when its process ended, on top of the one call per event. libstdc++ and MSVC leave a moved-from std::function empty, so Linux and Windows passed. std::exchange leaves the options without it on every standard library.
…/ocean-swash # Conflicts: # src/cvc/ariadne/script_engine.cpp # tools/singleton_scan/allowlist.txt
transfix
enabled auto-merge (squash)
November 10, 2026 20:09
transfix
added a commit
that referenced
this pull request
Nov 10, 2026
) One conflict, in src/cvc/tests/CMakeLists.txt, where both sides added a test after physics_replay_test: master's permissive_libs_test and this branch's threaded runs of the two Ariadne suites. Both are kept; ctest registers permissive_libs_test, ariadne_runtime_test_threads_auto and ariadne_host_test_threads_auto. Neither PR adds a static or thread_local to a scanned target's sources, so the writable-data allowlist is unchanged. Rebuilt cvc; ocean_shore_test 15 passes, permissive_libs_test runs (its libraries are absent from this build, so it skips), and ariadne_runtime_test (291) and ariadne_host_test (48) pass with CVC_EXEC_THREADS=auto.
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.
O4b of
docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md: the swash. Each wave runs up the beach and drains back, drawn as a thin film over the sand, and the sand it has just left is darker and glossy until it dries. This finishes A3 (decision D4).This branch includes #1128 (O4a) underneath its own commit, c79e3a7, because O4b extends the shore layer and lsystem_coast's shaders. Once #1128 merges, I'll merge master in and the diff drops to this commit.
cvc::ocean::shore_layerrunupfield. It holds Hunt's R = min(ξ, 2.5)·H₀, as shadowed as the swell, at each reached cell. It is carried, with the phase,swash_reach_m(30 m) up the dry beach, ring by ring from the waterline. A steep shore surges no higher than 2.5·H₀.swash(x, y, t, ground_z, level). Each wave's front runs up to R(1 + cos θ)/2 on the first train's phase and drains back. The ground is under the film while the front stands above it. It returns:swash_reach_m,runup_xi_max,dry_time_s.dir_texels()'s third channel is now the runup. The shader never read the wavenumber.No wetness texture, a deviation from the roadmap. The roadmap asks for a texture that records when each texel was last wet. For the swash that time follows from the wave's phase, so it is computed directly:
Rain's wetness (F3) will need a real texture, and the swash can feed it then. The roadmap's A3 notes this.
lsystem_coast
coast.water.shore_foam.shore_layer::swash's.coast.water.dry_time(6 s). Changing it rebuilds the shore layer.Checked
ocean_shore_test, 15 tests. The 3 new ones:ocean_spectrum_test: 13 tests still pass.lsystem_coast --shore-check:--set coast.water.wind_speed=2 --set coast.water.swell_hs=2.5: runup reaches 6.25 m and about 1000 cells are under the film.Built and run locally (Windows Release, GL build).
git clang-format18.1.8 is clean on the changed lines. Not yet measured in the browser.Next
That completes A3 (O4). Next in the roadmap's order: O5 (shading: GGX, light through backlit crests, footprint roughness, persistent foam), O6 (the
fluid_surfacehook incvc::physics, which also needs h0 to be cross-platform deterministic), or O10 / O17 / O21, the independent quick ones.