Skip to content

generated_world: water as depth-coloured surfaces on the terrain chunks' LOD rungs - #1034

Merged
transfix merged 2 commits into
masterfrom
feat/water-surface
Nov 7, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/water-surface

Conversation

@transfix

@transfix transfix commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Joe noticed the water areas didn't seem to have their volume rendering, and asked to rework the water for large worlds, the way the clouds were reworked. This is the first step. It's stacked on #1032 (roads, and the ground-texture flip that caused the phantom lakes); I'll rebase it onto master after that merges.

Why the shallows didn't show

  • The water was one VolumeNode over the whole world: at most 320 columns across (35 m columns on the 11.2 km world) and 22 slices deep.
  • Its scalar was depth over 5 m, at about 1% opacity per unit.
  • Water shallower than a slice, under 1.8 m on the 1.2 km world, barely drew. Even where it did, a metre of it was a fraction of a percent opaque.
  • Its voxels (about 2.2 M) were refilled on the CPU every four frames.
  • The phantom blue "lakes" with no water on them were the mirrored ground texture, fixed in generated_world: roads shape the ground, two Humvee lanes, smooth strips with a centre stripe #1032.

The water as surfaces, per WATER-RENDERING-ROADMAP's W1. For uniform water, a closed surface gives the same image as a volume, at a cost that falls with distance and screen size; a volume's doesn't.

  • cvc::world::make_water_rungs builds a water surface for each terrain LOD chunk, on that chunk's own rungs. It sits level at the water line over every cell with a corner under it. Drawn with the terrain, it's hidden exactly where the ground rises out of the water, so there's no shoreline to extract and none to move when a rung changes.
  • water_colour(depth): Beer-Lambert absorption of the bed's light, down and back up, with red absorbed first, then green, then blue (0.45, 0.065, 0.035 per metre), and the water's own blue filling in. It's baked per vertex, so the shallows read sandy, then green, then deep blue.
  • The generated_world node draws a ladder per wet chunk under <id>_water. It switches rung with its chunk, is opaque, casts no shadow, and has a sun glint (specular 0.6, power 80). water: 0 leaves the water out.
  • The volume and its per-frame refill are gone.

Checked

  • world_generated_test:
    • WaterColourDeepensWithDepth.
    • WaterRungsCoverTheWetCells: on a pit, rung 0 covers exactly the wet cells, at z = level, coloured by depth; coarser rungs have fewer cells; a dry chunk has none.
    • TheWaterIsDrawnWhereverItIs: every cell of the generated world under the water has a surface over it.
  • cvcgl_ariadne_realize: surface ladders per wet chunk, five rungs each, casting no shadow; every chunk's water switches rung with its ground.
  • Native arigl snapshots of terrain_lab, top-down and close: every lake and pond draws, shallow edges light teal and deep water dark blue, with the shore's sand band around them.
  • A debug pass with magenta surfaces confirmed the surfaces sit exactly over the lakes, and that the mismatched ones were the texture.

Next, from the roadmap's W1/W2 and the clouds' example:

  • ripples and Fresnel glints in the shader;
  • the shore skirt and foam;
  • a far rung folded into the terrain colour (the texture already paints the water classes);
  • browser timing on the deployed gallery.

@transfix
transfix changed the base branch from feat/road-grading to master November 6, 2026 23:13
…ks' LOD rungs

The water was one volume over the whole world (at most 320 columns across, 22 slices deep, a
fraction of a percent opaque per metre), so water shallower than a slice barely drew, and its
voxels were refilled on the CPU every four frames. Each terrain chunk now carries a water surface
per rung (make_water_rungs): level at the water line over every cell with a corner under it, the
terrain hiding it past the shoreline, each vertex coloured by the water column under it
(water_colour: the bed absorbed red first, then green, so the shallows read sandy, then green,
then deep blue). The generated_world node draws a ladder per wet chunk under <id>_water that
switches rung with its chunk, opaque and casting no shadow, and drops the volume.
@transfix
transfix merged commit 9cdd801 into master Nov 7, 2026
22 of 27 checks passed
@transfix
transfix deleted the feat/water-surface branch November 7, 2026 03:30
transfix added a commit that referenced this pull request Nov 7, 2026
Bumps the project version and every recipe's upstream_version from 3.7.11 to 3.7.12. The v3.7.12 tag on this commit is the first release with the multi-car controller template (pycvc_gl.cars, #1031 #1035 #1040), the hidden-subtree fix in cvcGL (#1037), the discrete-gradient dyn_bike step (#978), semi-implicit Euler by default in the nav rollout (#981), the implicit contact damper (#1004, #1038), and generated_world's roads and water (#1032, #1034).
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