Repository navigation
lsystem_coast: the seabed and the shore damp the waves; coastH() retired (O3) - #1127
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).
transfix
enabled auto-merge (squash)
November 10, 2026 05:32
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.
O3 of
docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md(A1, A2, and W0.2's textures): the waves stop at the shore instead of passing through it.This branch includes #1125's commit (the cascade weights as state keys) underneath its own, because both edit lsystem_coast. Once #1125 merges, I'll merge master in here and the diff drops to O3's own commit, f8dd175. I didn't stack the PRs because in this repo deleting a merged branch closes the PRs based on it.
What it does (lsystem_coast)
cvc::gl::HeightFieldTextureofterrainHsampled at 1 m over the ocean (441²). Its bilinear grid gives the same heights on the CPU and the GPU.cvc::world::water_bodies(from cvc::world: water_bodies, the sea, lakes and ponds and the shore grid (O1) #1109) built over that seabed, uploaded as an RGBA32F texture: distance to shore (+ offshore), the offshore normal, and the slope. The normal and slope are for O4. The scene reports "1 sea" on its 441² grid.coast.water.shore_fade(default 3 m). The island stands on a shelf about 9 m deep that runs out to the horizon:coastH(), the hand-copied GLSL ofterrainH, is gone.Checked
The waterline check.
lsystem_coast --shore-checkis a new flag; it exits 3 if any vertex lands on dry ground. After the run it reads back the three cascades and evaluates the vertex shader's displacement on the CPU for every offshore vertex (nearest texel, wrapped, as the GPU samples), counting those that land on dry ground:It checks the shader's arithmetic and the textures it reads; the GPU's own run of it shows in the frames.
Frames. In orbit and fly captures, the open sea keeps its chop. Near the island the water calms and turns shallow turquoise toward the beach, and the foam band sits on the waterline. No shader errors.
Built and run locally (Windows Release, GL build).
git clang-format18.1.8 is clean on the changed lines. The roadmap's A2 gets an "as built" note covering the fade cap and the sideways limit.Next
O4, the shore layer: an eikonal phase map for refraction, Green's law shoaling, breaking, runup and the wetness texture, and reflection off the cliffs. It reads the shore grid's normal and slope uploaded here.