Official Codebase of 3DCodeVerse
Python
scene prompts: every lighting recipe hands its colours to the starter's sunRig; the rig takes fillSky/fillGround
gaoypeng21aff1726bf7
diff --git a/harness/codeverse/languages/scene_threejs/starter/src/lib/environment.js b/harness/codeverse/languages/scene_threejs/starter/src/lib/environment.jsindex 4badaf76..b8850034 100644--- a/harness/codeverse/languages/scene_threejs/starter/src/lib/environment.js+++ b/harness/codeverse/languages/scene_threejs/starter/src/lib/environment.js@@ -407,6 +407,8 @@ const RIGS = {* sun direction in degrees (per-mood defaults; golden sits low);* `sunColor`/`intensity` sun overrides; `fill` hemisphere intensity,* clamped UP to the mood's readability floor (night floor 0.55);+ * `fillSky`/`fillGround` hex overrides of the hemisphere's colours (the+ * baked environment's ground half follows `fillGround`);* `zenith`/`horizon` hex overrides matching `worldShell()`'s (used by* the overcast/gradient bake and the below-horizon half);* `radius` sky radius the disc sits inside (default 4000, matching@@ -496,8 +498,13 @@ export function sunRig(opts = {}) {// The darkest tenth of a frame is not shade the fill reaches — it is// albedo the libraries have already multiplied toward zero at contact// points, and no light colour rescues a black albedo.+ // Colours are the mood's unless the scene tints them: the cookbook's+ // time-of-day rows carry a cool sky over a warm ground for every hour,+ // and the env bake's ground half below follows the same override.+ const fillSky = opts.fillSky === undefined ? rig.fillSky : opts.fillSky;+ const fillGround = opts.fillGround === undefined ? rig.fillGround : opts.fillGround;const fill = new THREE.HemisphereLight(- rig.fillSky, rig.fillGround,+ fillSky, fillGround,Math.max(rig.fillFloor,opts.fill === undefined ? rig.fill : opts.fill));fill.name = 'SunRigFill';@@ -509,7 +516,7 @@ export function sunRig(opts = {}) {const w = 256;const h = 128;const data = new Uint16Array(w * h * 4);- const groundC = new THREE.Color(rig.fillGround);+ const groundC = new THREE.Color(fillGround);const glowC = new THREE.Color(rig.discColor);const px = new THREE.Vector3();const pc = new THREE.Color();diff --git a/harness/codeverse/prompts/scene_threejs/contract.md b/harness/codeverse/prompts/scene_threejs/contract.mdindex 978a8814..4e65fced 100644--- a/harness/codeverse/prompts/scene_threejs/contract.md+++ b/harness/codeverse/prompts/scene_threejs/contract.md@@ -67,6 +67,7 @@ animated object has a stable `.name`; ShaderMaterials `mat.name = 'Water'`.`src/env.js````jsimport * as THREE from 'three';+import { sunRig } from './lib/environment.js';export const BOUNDS = { min: [-40, 0, -40], max: [40, 25, 40] };export function heightAt(x, z) { // gentle rolling ground, deterministicreturn 0.6 * Math.sin(x * 0.12) * Math.cos(z * 0.09) + 0.2 * Math.sin((x + z) * 0.31);@@ -74,12 +75,12 @@ export function heightAt(x, z) { // gentle rolling ground, deterexport function buildEnv(THREE, scene) {scene.background = new THREE.Color(0x9fc4e8);scene.fog = new THREE.Fog(0x9fc4e8, 40, 140);- scene.add(new THREE.HemisphereLight(0xbfd8ff, 0x6b5a3a, 0.6));- const sun = new THREE.DirectionalLight(0xfff1d6, 2.8);- sun.position.set(30, 40, 20); sun.castShadow = true;- sun.shadow.mapSize.set(2048, 2048);- Object.assign(sun.shadow.camera, { left: -45, right: 45, top: 45, bottom: -45, near: 1, far: 150 });- scene.add(sun, sun.target);+ // ONE rig: key + hemisphere fill + the environment map metals read from + disc + shadows+ // fitted to BOUNDS; tint through sunColor / fillSky / fillGround, never a second sun+ const rig = sunRig({ mood: 'day', azimuth: 35, elevation: 48, bounds: 45 });+ scene.add(rig.sun, rig.sun.target, rig.fill);+ if (rig.sunDisc) scene.add(rig.sunDisc);+ scene.environment = rig.envTex;const geo = new THREE.PlaneGeometry(80, 80, 80, 80); geo.rotateX(-Math.PI / 2);const pos = geo.attributes.position;for (let i = 0; i < pos.count; i++) pos.setY(i, heightAt(pos.getX(i), pos.getZ(i)));diff --git a/harness/codeverse/prompts/scene_threejs/cookbook.md b/harness/codeverse/prompts/scene_threejs/cookbook.mdindex 4fae3193..e039aa45 100644--- a/harness/codeverse/prompts/scene_threejs/cookbook.md+++ b/harness/codeverse/prompts/scene_threejs/cookbook.md@@ -319,74 +319,78 @@ function addPracticals(THREE, scene, spots) { // ≤ 12; none cast shadconsole.log('practicals', addPracticals(THREE, new THREE.Scene(), [[4, 1.8, 2], [-3, 2.1, 5]]).length);```-Rules of thumb: sun/moon + hemisphere together ≥ 2.5 at dusk (≥ 1.5 at night with ≥ 6-practicals); hemisphere sky/ground colours carry the mood — turning the key down is NOT how-you make dusk, tinting it is; ground albedo ≥ 0.25; no black `scene.background` (the sky-gradient's horizon band is the brightest thing in the frame).+Rules of thumb: the starter's `env.js` lights the scene with ONE `sunRig({...})` from+`lib/environment.js` — key, hemisphere fill, the environment map metals read from, the disc+and fitted shadows — and clamps `intensity` / `fill` UP to per-mood floors (day and golden+sun ≥ 4.5 with fill ≥ 1.0–1.2, overcast 2.0 / 1.6, the night moon 2.2 / 0.8); turning the key+down is NOT how you make dusk, tinting it is (`sunColor`, `fillSky`, `fillGround`, `zenith`,+`horizon`, and a set sun — `elevation` < 0 — is the night rig); ground albedo ≥ 0.25; no+black `scene.background` (the sky gradient's horizon band is the brightest thing in the frame).**Exposure self-check (after each build):** `scene_views` → the frame table(`camera_checks` in metrics.json) for every authored camera: `mean_lum` ≥ 0.15, `dark_frac`≤ 0.25, `blown_frac` ≤ 0.10, `content_frac` ≥ 0.25 on the establishing shot. Below that,-raise HemisphereLight by +0.3 and the key by +0.8 and re-render. Black shade is the most-common cause: at sun elevation < 25° keep the hemisphere ≥ 1.0.+raise `fill` by +0.3 and `intensity` by +0.8 in the `sunRig({...})` call and re-render —+never a second DirectionalLight beside the rig (measured 2026-09-07: a blue-hour lighthouse+stacked a "TwilightKey" on the night rig and still read 0.13). Black shade is the most+common cause: at sun elevation < 25° keep `fill` ≥ 1.0.## Atmosphere: time-of-day triads with numbers-Pick the row, use the numbers, then only tune exposure. `hemi` = HemisphereLight-(sky colour / ground colour / intensity), `sun` = DirectionalLight (colour / intensity /-elevation°). Fog colour is always the sky's **horizon** colour — never white, never grey+Pick the row, hand its colours to the rig, then only tune exposure. `sun` = the rig's key+(`sunColor`, `elevation`; `intensity` is the mood's floor or higher), `hemi` = the rig's fill+(`fillSky` / `fillGround`; `fill` ≥ the floor). Bare-light intensities measured without the+rig's environment map sit below its floors — the colours, elevations and fog are what a row+gives you. Fog colour is always the sky's **horizon** colour — never white, never greyunless the brief says overcast.-| time of day | sky zenith | sky horizon = fog | sun colour | sun int | sun elev | hemi sky / ground | hemi int | fog near/far (100 m scene) |-|---|---|---|---|---|---|---|---|---|-| dawn | 0x2f4a72 | 0xe8a06a | 0xffb073 | 2.2 | 8° | 0x7d94c4 / 0x4a3a2c | 0.75 | 25 / 150 |-| morning | 0x3d76c2 | 0xbcd6ea | 0xfff1d0 | 3.0 | 35° | 0xbfd6f0 / 0x5e5442 | 0.60 | 45 / 190 |-| noon | 0x2f6fd0 | 0xcfe2f2 | 0xfffaf0 | 3.4 | 70° | 0xcfe2f2 / 0x6b6152 | 0.55 | 60 / 220 |-| golden hour | 0x3b5f96 | 0xf0a860 | 0xffc27a | 2.8 | 12° | 0x86a8d8 / 0x5c4630 | 0.85 | 35 / 170 |-| overcast | 0x8e9aa6 | 0xc3cad1 | 0xd8dee4 | 1.4 | 45° | 0xc3cad1 / 0x6f6a62 | 1.10 | 30 / 160 |-| dusk | 0x33285c | 0xd9703a | 0xffa060 | 2.4 | 6° | 0x7a5aa0 / 0x3a2e22 | 0.80 | 30 / 140 |-| night (moon) | 0x0d1430 | 0x22305a | 0xa8c0ff | 1.2 | 40° | 0x36406e / 0x1a1c24 | 0.55 | 25 / 120 |+| time of day | rig mood | sky zenith | sky horizon = fog | sun colour | sun elev | fill sky / ground | fog near/far (100 m scene) |+|---|---|---|---|---|---|---|---|+| dawn | golden | 0x2f4a72 | 0xe8a06a | 0xffb073 | 8° | 0x7d94c4 / 0x4a3a2c | 25 / 150 |+| morning | day | 0x3d76c2 | 0xbcd6ea | 0xfff1d0 | 35° | 0xbfd6f0 / 0x5e5442 | 45 / 190 |+| noon | day | 0x2f6fd0 | 0xcfe2f2 | 0xfffaf0 | 70° | 0xcfe2f2 / 0x6b6152 | 60 / 220 |+| golden hour | golden | 0x3b5f96 | 0xf0a860 | 0xffc27a | 12° | 0x86a8d8 / 0x5c4630 | 35 / 170 |+| overcast | overcast | 0x8e9aa6 | 0xc3cad1 | 0xd8dee4 | 45° | 0xc3cad1 / 0x6f6a62 | 30 / 160 |+| dusk | golden | 0x33285c | 0xd9703a | 0xffa060 | 6° | 0x7a5aa0 / 0x3a2e22 | 30 / 140 |+| night (moon) | night | 0x0d1430 | 0x22305a | 0xa8c0ff | 40° | 0x36406e / 0x1a1c24 | 25 / 120 |**Colour temperature contrast is the whole trick**: the key light is warm, the fill is the*opposite* hue (cool blue sky bounce). A scene lit warm-on-warm — orange sun with anorange hemisphere — comes out as the monochrome-orange soup the rooftop run was marked-down for. Keep `hemi.color` at least 60° of hue away from the sun colour.+down for. Keep `fillSky` at least 60° of hue away from `sunColor`.```js+import { sunRig } from './lib/environment.js';const TIME_OF_DAY = {- dawn: { zenith: 0x2f4a72, horizon: 0xe8a06a, sun: 0xffb073, sunI: 2.2, elev: 8, hemiSky: 0x7d94c4, hemiGround: 0x4a3a2c, hemiI: 0.75, fog: [25, 150] },- morning: { zenith: 0x3d76c2, horizon: 0xbcd6ea, sun: 0xfff1d0, sunI: 3.0, elev: 35, hemiSky: 0xbfd6f0, hemiGround: 0x5e5442, hemiI: 0.60, fog: [45, 190] },- noon: { zenith: 0x2f6fd0, horizon: 0xcfe2f2, sun: 0xfffaf0, sunI: 3.4, elev: 70, hemiSky: 0xcfe2f2, hemiGround: 0x6b6152, hemiI: 0.55, fog: [60, 220] },- goldenHour: { zenith: 0x3b5f96, horizon: 0xf0a860, sun: 0xffc27a, sunI: 2.8, elev: 12, hemiSky: 0x86a8d8, hemiGround: 0x5c4630, hemiI: 0.85, fog: [35, 170] },- overcast: { zenith: 0x8e9aa6, horizon: 0xc3cad1, sun: 0xd8dee4, sunI: 1.4, elev: 45, hemiSky: 0xc3cad1, hemiGround: 0x6f6a62, hemiI: 1.10, fog: [30, 160] },- dusk: { zenith: 0x33285c, horizon: 0xd9703a, sun: 0xffa060, sunI: 2.4, elev: 6, hemiSky: 0x7a5aa0, hemiGround: 0x3a2e22, hemiI: 0.80, fog: [30, 140] },- night: { zenith: 0x0d1430, horizon: 0x22305a, sun: 0xa8c0ff, sunI: 1.2, elev: 40, hemiSky: 0x36406e, hemiGround: 0x1a1c24, hemiI: 0.55, fog: [25, 120] },+ dawn: { mood: 'golden', zenith: 0x2f4a72, horizon: 0xe8a06a, sun: 0xffb073, elev: 8, fillSky: 0x7d94c4, fillGround: 0x4a3a2c, fog: [25, 150] },+ morning: { mood: 'day', zenith: 0x3d76c2, horizon: 0xbcd6ea, sun: 0xfff1d0, elev: 35, fillSky: 0xbfd6f0, fillGround: 0x5e5442, fog: [45, 190] },+ noon: { mood: 'day', zenith: 0x2f6fd0, horizon: 0xcfe2f2, sun: 0xfffaf0, elev: 70, fillSky: 0xcfe2f2, fillGround: 0x6b6152, fog: [60, 220] },+ goldenHour: { mood: 'golden', zenith: 0x3b5f96, horizon: 0xf0a860, sun: 0xffc27a, elev: 12, fillSky: 0x86a8d8, fillGround: 0x5c4630, fog: [35, 170] },+ overcast: { mood: 'overcast', zenith: 0x8e9aa6, horizon: 0xc3cad1, sun: 0xd8dee4, elev: 45, fillSky: 0xc3cad1, fillGround: 0x6f6a62, fog: [30, 160] },+ dusk: { mood: 'golden', zenith: 0x33285c, horizon: 0xd9703a, sun: 0xffa060, elev: 6, fillSky: 0x7a5aa0, fillGround: 0x3a2e22, fog: [30, 140] },+ night: { mood: 'night', zenith: 0x0d1430, horizon: 0x22305a, sun: 0xa8c0ff, elev: 40, fillSky: 0x36406e, fillGround: 0x1a1c24, fog: [25, 120] },};function applyTimeOfDay(THREE, scene, key, opts = {}) {const T = TIME_OF_DAY[key] || TIME_OF_DAY.morning;- const az = (opts.azimuthDeg ?? 135) * Math.PI / 180, el = (opts.elevationDeg ?? T.elev) * Math.PI / 180;- const R = opts.sunDistance ?? 120, span = opts.shadowSpan ?? 60;// the table's fog is calibrated for a 100 m scene: scale it by the bounds diagonal or// a 30 m garden disappears into soup (and its horizon ring never hazes).const fs = opts.fogScale ?? Math.min(2.5, Math.max(0.3, (opts.boundsDiagonal ?? 100) / 100));scene.fog = new THREE.Fog(T.horizon, T.fog[0] * fs, T.fog[1] * fs);scene.background = new THREE.Color(T.horizon);- const hemi = new THREE.HemisphereLight(T.hemiSky, T.hemiGround, T.hemiI);- const sun = new THREE.DirectionalLight(T.sun, T.sunI);- sun.position.set(Math.cos(el) * Math.sin(az) * R, Math.sin(el) * R, Math.cos(el) * Math.cos(az) * R);- sun.castShadow = true;- // shadow texel = 2*span / mapSize. Keep it ≤ 0.05 m or the edges look like stairs.- const mapSize = span <= 30 ? 2048 : span <= 60 ? 3072 : 4096;- sun.shadow.mapSize.set(mapSize, mapSize);- sun.shadow.bias = -0.0004; sun.shadow.normalBias = 0.02;- Object.assign(sun.shadow.camera, { left: -span, right: span, top: span, bottom: -span, near: 1, far: R * 2.2 });- sun.shadow.camera.updateProjectionMatrix?.();- scene.add(hemi, sun, sun.target);- return { sun, hemi, palette: T, fogFar: scene.fog.far, shadowTexelM: (2 * span) / mapSize };+ // ONE rig: key, hemisphere fill, environment map, disc, and shadows whose frustum and map+ // are fitted to `bounds` (texel ≤ 0.05 m) — never a second DirectionalLight beside it+ const bounds = opts.bounds ?? 60;+ const rig = sunRig({ mood: T.mood, azimuth: opts.azimuthDeg ?? 135, elevation: opts.elevationDeg ?? T.elev,+ sunColor: T.sun, fillSky: T.fillSky, fillGround: T.fillGround, zenith: T.zenith, horizon: T.horizon,+ bounds, fill: opts.fill, intensity: opts.intensity });+ scene.add(rig.sun, rig.sun.target, rig.fill);+ if (rig.sunDisc) scene.add(rig.sunDisc);+ scene.environment = rig.envTex;+ return { rig, palette: T, fogFar: scene.fog.far, shadowTexelM: (2 * bounds) / rig.sun.shadow.mapSize.x };}const todScene = new THREE.Scene();-const tod = applyTimeOfDay(THREE, todScene, 'goldenHour', { azimuthDeg: 250, shadowSpan: 26, boundsDiagonal: 45 });+const tod = applyTimeOfDay(THREE, todScene, 'goldenHour', { azimuthDeg: 250, bounds: 26, boundsDiagonal: 45 });console.log('golden hour shadow texel (m)', tod.shadowTexelM.toFixed(3), 'fog far', tod.fogFar.toFixed(1), 'ring radius', (tod.fogFar * 0.6).toFixed(1));```diff --git a/harness/codeverse/prompts/scene_threejs/system.md b/harness/codeverse/prompts/scene_threejs/system.mdindex df166a10..18d8b1fd 100644--- a/harness/codeverse/prompts/scene_threejs/system.md+++ b/harness/codeverse/prompts/scene_threejs/system.md@@ -63,8 +63,11 @@ Rules that survive every brief:* **Light before colour, and light before detail.** Get the frame into a readable bandfirst. Hue, material and geometry work are all invisible on near-black pixels, and everyhour you spend on them before the exposure is right is an hour the judge cannot see.- A starting point that usually reads: `DirectionalLight` 2–4 as key, `HemisphereLight`- 0.5–1.0 (sky colour over ground colour) as fill, `scene.fog` the same colour as the sky.+ The starter's `env.js` already builds the light that reads: `sunRig({ mood, azimuth,+ elevation, … })` from `lib/environment.js` — sun, hemisphere fill, the environment map+ metals read from, the disc, and per-mood floors it clamps UP to. Pick the mood, tint+ through `sunColor` / `fillSky` / `fillGround`, raise `intensity` / `fill`; never a second+ DirectionalLight on top of it. `scene.fog` is the sky's horizon colour.* **Author a camera.** The harness's orbit rig is a fallback, not your picture; a scenejudged only on the rig is a scene you did not frame.* **Things rest on things.** `check_placement` measures the gap from each asset's feet todiff --git a/harness/codeverse/prompts/tracks/scene_env.j2 b/harness/codeverse/prompts/tracks/scene_env.j2index 87cc0938..622626b0 100644--- a/harness/codeverse/prompts/tracks/scene_env.j2+++ b/harness/codeverse/prompts/tracks/scene_env.j2@@ -58,9 +58,9 @@ The chapters behind these rules are printed in full at the end of this briefshallow shelf) — never a hard-edged disc or square laid on top of the ground, which alwaysshows its outline from the overview cameras.4. **Coloured atmosphere, not monochrome.** Warm key + cool fill (or the reverse) with >= 60- degrees of hue between them; shade must carry sky colour, never black — with the sun below- 25 degrees elevation keep the hemisphere intensity >= 1.0 or the shadows render pitch black- and trip the `unlit_or_blown` defect (cap 0.60). Add 3-4 haze bands+ degrees of hue between them (`sunColor` vs `fillSky` on the rig); shade must carry sky+ colour, never black — with the sun below 25 degrees elevation keep the rig's `fill` >= 1.0+ or the shadows render pitch black and trip the `unlit_or_blown` defect (cap 0.60). Add 3-4 haze bands(`depthWrite:false`, opacity 0.04-0.10, fog colour) for aerial perspective, and light shaftsif the brief mentions sun through something.4b. **Keep `scene.environment`.** The skeleton lights the scene with `sunRig()` fromdiff --git a/harness/codeverse/skills/cv3d-scene-lighting/SKILL.md b/harness/codeverse/skills/cv3d-scene-lighting/SKILL.mdindex 64249a3b..59df42e0 100644--- a/harness/codeverse/skills/cv3d-scene-lighting/SKILL.md+++ b/harness/codeverse/skills/cv3d-scene-lighting/SKILL.md@@ -89,11 +89,13 @@ linear 0.02 to 0.05 moves the frame from 0.08 to 0.20. Small increases pay nearovercast, and never a black background.Working numbers for a scene lit from the SKY (day, overcast, dusk), straight from the-gate's fix hint: DirectionalLight **2-4**, HemisphereLight **0.5-1.0**,-`emissiveIntensity` **2-6** with a PointLight **0.5-2** per practical, and keep mean-luminance **>= 0.15** so you are not sitting on the threshold. If the frame is blown-instead: key <= 3, hemisphere <= 1.0, sky below 0.9 white, `emissiveIntensity` <= 4 on-large surfaces.+gate's fix hint: the starter's `sunRig({ mood, intensity, fill, sunColor, fillSky, fillGround })`+— pick the mood (`day | golden | night | overcast`; a set sun is the night rig), raise+`intensity` / `fill` (the rig clamps requests below its floors UP, so under-lighting is not+reachable through it), never a second DirectionalLight on top — plus `emissiveIntensity`+**2-6** with a PointLight **0.5-2** per practical, and keep mean luminance **>= 0.15** so+you are not sitting on the threshold. If the frame is blown instead: `intensity` at the+floor, `fill` <= 1.2, sky below 0.9 white, `emissiveIntensity` <= 4 on large surfaces.For a scene lit from its PRACTICALS the target is contrast, not average — but it is aBAND, not a floor you can fall through. Aim at `lum_std` **>= 0.12** with mean luminancediff --git a/harness/docs/DECISIONS.md b/harness/docs/DECISIONS.mdindex fadea3f5..b334a48e 100644--- a/harness/docs/DECISIONS.md+++ b/harness/docs/DECISIONS.md@@ -1027,6 +1027,14 @@ written) that were accepted because the code works that way and the tests pin itkeep it. `sunRig`'s 'SunDisc' at 3.6 km (no word boundary for `SKY_NAME_RE`) blew thecontent bbox to 2.5 km and put the overview rig kilometres up (`overview_top` ground0.0008); `backdrop.mjs` now calls anything small and > 1.5 km from the origin sky.+ Follow-through (2026-09-07 evening): every prompt that taught lighting still taught bare+ lights — the cookbook's time-of-day recipe built its own DirectionalLight + HemisphereLight+ + shadow camera, the contract's minimal `env.js` did too, `system.md` said "DirectionalLight+ 2–4 as key", the lighting skill quoted the old gate hint — so the loop-9 lighthouse stacked+ a "TwilightKey" on the night rig and the loop-8 boat passed `fillSky`/`fillGround` the rig+ ignored. All of them now hand the row's colours to `sunRig` (which gained the two colour+ overrides; the env bake's ground half follows), the recipe's intensity columns are gone+ (they sat below the rig's floors), and both snippets are run for real under node.* **D66 A procedural module is judged on the hero's rig, and the plan's largest one keepsits verdict (2026-09-07).** `scene_assets` had judged threejs assets throughdiff --git a/harness/tests/prompts/conftest.py b/harness/tests/prompts/conftest.pyindex 6f9d6cee..eee912e1 100644--- a/harness/tests/prompts/conftest.py+++ b/harness/tests/prompts/conftest.py@@ -17,6 +17,9 @@ import pytestfrom codeverse.config import get_settingsPROMPTS_DIR = Path(__file__).resolve().parents[2] / "codeverse" / "prompts"+#: the scene starter's harness-owned library (D51): a scene workspace always has it at+#: `src/lib/`, so a snippet may import from it exactly as an agent's file would+STARTER_LIB = Path(__file__).resolve().parents[2] / "codeverse" / "languages" / "scene_threejs" / "starter" / "src" / "lib"RUNTIME_JS = Path(__file__).resolve().parents[2] / "runtime_js"HELPERS = Path(__file__).resolve().parent / "helpers"@@ -72,6 +75,9 @@ def run_node_module(tmp_path: Path, code: str, timeout: int = 120) -> str:link = tmp_path / "node_modules"if not link.exists():link.symlink_to(RUNTIME_JS / "node_modules")+ for lib in (tmp_path / "lib", tmp_path / "src" / "lib"): # `./lib/...` from run.mjs and from src/*.js+ if not lib.exists(): # a COPY: a symlinked lib resolves its bare `three` from the starter dir, which has none+ shutil.copytree(STARTER_LIB, lib)mod = tmp_path / "run.mjs"mod.write_text(code)proc = subprocess.run(@@ -110,5 +116,6 @@ def js_prelude(extra: str = "") -> str:"import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';\n""import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';\n""import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';\n"- "import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';\n" + extra+ "import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';\n"+ "import { sunRig } from './lib/environment.js';\n" + extra # the rig the starter's env.js builds)diff --git a/harness/tests/scene_runtime/lib/test_environment.py b/harness/tests/scene_runtime/lib/test_environment.pyindex 0fd8f8f0..4fd87cd5 100644--- a/harness/tests/scene_runtime/lib/test_environment.py+++ b/harness/tests/scene_runtime/lib/test_environment.py@@ -116,6 +116,9 @@ for (const b of [8, 25, 60, 150, 400, 1200]) {normalBias: r.sun.shadow.normalBias };}out.nightFloor = sunRig({ mood: 'night', fill: 0.2 }).fill.intensity;+const tinted = sunRig({ mood: 'golden', fillSky: 0x7a5aa0, fillGround: 0x3a2e22 });+out.tinted = { sky: tinted.fill.color.getHex(), ground: tinted.fill.groundColor.getHex(),+ nadir: sample(tinted, new THREE.Vector3(0, -1, 0)), plainNadir: sample(sunRig({ mood: 'golden' }), new THREE.Vector3(0, -1, 0)) };out.discOptional = sunRig({ mood: 'day', disc: false }).sunDisc === null;const floors = (o) => { const r = sunRig(o); return { sun: r.sun.intensity, fill: r.fill.intensity }; };out.floors = { dayAsked: floors({ mood: 'day', intensity: 2.8, fill: 0.65 }), goldenAsked: floors({ mood: 'golden', intensity: 2.0, fill: 0.3 }),@@ -177,6 +180,15 @@ def test_the_night_rig_is_dark_but_lit(sun):assert zl < 0.03 and n["zenith"][2] > n["zenith"][0], n["zenith"]+def test_the_fill_colours_can_be_tinted_and_the_env_ground_half_follows(sun):+ """The cookbook's time-of-day rows tint the hemisphere (cool sky / warm ground per hour);+ the boat-workshop run (loop 8, 2026-09-07) passed `fillSky`/`fillGround` and the rig+ silently ignored them."""+ t = sun["tinted"]+ assert t["sky"] == 0x7A5AA0 and t["ground"] == 0x3A2E22, t+ assert t["nadir"] != t["plainNadir"], "the baked ground bounce follows the override"++def test_the_shadow_sun_is_fitted_and_biased(sun):for mood in _MOODS:m = sun[mood]