Skip to content

Official Codebase of 3DCodeVerse

Python

lib/water: the broadband wave set starts at 300 m, not 1500 — a 380-440 m storm sea read as "a checkerboard of white crescents"

gaoypeng88c9c43b7a42
diff --git a/harness/codeverse/languages/scene_threejs/starter/src/lib/water.js b/harness/codeverse/languages/scene_threejs/starter/src/lib/water.js
index f1f9b9ff..94e428e6 100644
--- a/harness/codeverse/languages/scene_threejs/starter/src/lib/water.js
+++ b/harness/codeverse/languages/scene_threejs/starter/src/lib/water.js
@@ -307,6 +307,9 @@ function _readScene(scene, uniforms, pinned) {
* @returns {THREE.Mesh} The Water mesh, rotated flat, named 'Ocean',
* with `userData.update(t)` driving the wave phase for `tick`.
*/
+/** Water wider than this gets the broadband (28-direction) wave set. */
+export const BROADBAND_EXTENT_M = 300;
+
export function makeOcean(width, depth, opts = {}) {
_oceans++;
if (_oceans > 1) {
@@ -327,7 +330,12 @@ export function makeOcean(width, depth, opts = {}) {
textureWidth: rtt,
textureHeight: rtt,
waterNormals: opts.waterNormals
- || makeWaterNormals(256, { broadband: _extent > 1500 }),
+ // 300 m, not 1500: a 380 m and a 440 m storm sea (two lighthouse runs,
+ // 2026-09-09) read as "a checkerboard of white crescents" from every
+ // overview and the establishing shot — the eight-tone set's own period
+ // shows wherever the water is wide enough to be seen at a grazing angle,
+ // and a scene's sea is exactly that. Pools and ponds keep the lively set.
+ || makeWaterNormals(256, { broadband: _extent > BROADBAND_EXTENT_M }),
sunDirection: sunDir,
sunColor: opts.sunColor === undefined ? 0xffffff : opts.sunColor,
waterColor:
diff --git a/harness/tests/scene_runtime/lib/test_water.py b/harness/tests/scene_runtime/lib/test_water.py
index a6acc4d2..028cdebf 100644
--- a/harness/tests/scene_runtime/lib/test_water.py
+++ b/harness/tests/scene_runtime/lib/test_water.py
@@ -342,6 +342,11 @@ def test_wide_water_gets_the_broadband_wave_spectrum(probe) -> None:
"broadband:true returned the same normal map — the option is "
"not reaching the wave table")
assert m["poolUsesNarrow"], "a pool paid for the broadband spectrum"
+ # a 380 m storm sea is wide enough to be seen edge-on: two lighthouse runs (2026-09-09)
+ # read the eight-tone set as "a checkerboard of white crescents" — the threshold is 300 m
+ from codeverse.config import get_settings
+ src = (get_settings().runtime_js_dir().parent / "codeverse" / "languages" / "scene_threejs" / "starter" / "src" / "lib" / "water.js").read_text()
+ assert "BROADBAND_EXTENT_M = 300" in src and "_extent > BROADBAND_EXTENT_M" in src
def test_update_drives_the_wave_phase_and_sundir_reaches_the_shader(