Repository navigation
cvc::ocean: the shore layer, the swell refracting, shoaling, breaking and reflecting (O4a) - #1128
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
transfix
enabled auto-merge (squash)
November 10, 2026 07:50
transfix
added a commit
that referenced
this pull request
Nov 10, 2026
…ld panels (#1123), ocean shore (#1128) Also #1124, #1115 and #1120. Conflicts, both sides kept: - ariadne.h: post_signal also hands the signal to the event tap, and stays a host-thread call outside a pump, as post_input is. The tap is set on the drain's thread, which is the host thread. - ariadne.cpp: deliver_input and post_signal post to the document's scheduler (current_sched) when a resident takes the event, and queue it for the tap when the tap takes that kind. post_signal keeps its assert_outside_pump. The tap's events are handed over in drain_begin, after the input residents and before the has? snapshot, so what they start runs in the frame's pump. - ariadne_script_engine_test.cpp: this branch's isolated-document tests and master's hook tests, all kept. A lane's hook residents run on the host thread: a document that uses an engine stays there (require_host_thread), so the hook queues and the receiver's start_process need no more.
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.
O4a of
docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md: the shore layer's waves (A3). The swell refracts, shoals, breaks on the shores that face it, and reflects off the steep ones. The runup film over the sand and the wetness texture are the next PR, O4b.This branch includes #1125's and #1127's commits underneath its own (eca1513), because all three edit lsystem_coast and PRs aren't stacked in this repo. When those merge, the diff drops to this commit.
cvc/ocean/shore.h:cvc::ocean::shore_layerIt reads a
shore_gridof plain planes: still-water depth, shore distance and offshore normal (whatcvc::world::water_bodiesholds).cvc::oceanstill depends on no other library.evaluate(x, y, t)is the sum the GPU draws, from the same fields, so physics (B5) will read what is drawn.wave_texels()/dir_texels()pack the fields for the GPU.shore_wavenumber,shoaling,iribarren,reflection_coefficient, andrunup(Hunt, for O4b).lsystem_coast
coast.water.swell_*, now on by default at 1.2 m, 10 s) is drawn by the shore layer alone, and the FFT cascades draw only the wind sea. A coast with deep water offshore would hand the swell from a cascade of its own to the shore layer.wave_ampscales only the cascades. The shore layer stays at its true size, so its breaking cap holds at any setting. Atwave_amp= 5 the cap was being defeated and the troughs exposed the shoals; that is fixed.--set KEY=VALUEis a new option that seeds any knob, e.g.--set coast.water.wind_speed=1 --set coast.water.swell_hs=2.5.Checked
ocean_shore_test, 12 tests:ocean_spectrum_test: 13 tests still pass.lsystem_coast --shore-check:--set coast.water.wind_speed=1 --set coast.water.swell_hs=2.5the lee is calm and the windward shore breaks.Built and run locally (Windows Release, GL build).
git clang-format18.1.8 is clean on the changed lines. The roadmap's A3 gets an "as built" note.