Official Codebase of 3DCodeVerse
Python
scene prompts: one camera count (3-4), one cameraMask radius (~4 m), and no camera near-hit number
gaoypengcf2929667e0f
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/scene.js b/harness/codeverse3d/languages/scene_threejs/starter/src/scene.jsindex 36308b14..b2b8e6a1 100644--- a/harness/codeverse3d/languages/scene_threejs/starter/src/scene.js+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/scene.js@@ -4,7 +4,7 @@// export function createScene({ THREE, renderer, loaders })// → { scene, cameras: [{ name, position: [x,y,z], lookAt: [x,y,z], fov }], update(t, dt) }// • Y is up, +Z is front, units are meters. The scene owns its lights, sky/env and fog.-// • cameras: 1-6 authored shots (eye above the ground, clear of every surface).+// • cameras: 3–4 authored shots (eye above the ground, clear of every surface).// • update(t, dt): t = seconds since start, dt = step; animate here (no requestAnimationFrame).// • loaders.gltf is a GLTFLoader: loaders.gltf.loadAsync('/assets/<name>.glb') for Blender-built assets.// • Imports allowed: 'three', 'three/addons/*', relative files. No CDN, no network, no DOM access.diff --git a/harness/codeverse3d/prompts/scene_threejs/contract.md b/harness/codeverse3d/prompts/scene_threejs/contract.mdindex 9f05da19..5cee415f 100644--- a/harness/codeverse3d/prompts/scene_threejs/contract.md+++ b/harness/codeverse3d/prompts/scene_threejs/contract.md@@ -24,7 +24,7 @@ establishing shot that is mostly sky/ground. Dusk/night = coloured, never black## createScene return value* `scene`: `THREE.Scene` with `scene.fog` set and a background colour or sky dome.-* `cameras`: 3–5 **plain objects** `{ name, position: [x, y, z], lookAt: [x, y, z], fov }`+* `cameras`: 3–4 **plain objects** `{ name, position: [x, y, z], lookAt: [x, y, z], fov }`(the harness builds the PerspectiveCameras: aspect 16/9, near 0.1, far from bounds).Names PascalCase from the plan (`Establishing`, `HarbourMid`, `LanternDetail`); fov35–60; eye height ≈ 1.6 m for human views; never inside or up against geometry; the@@ -158,6 +158,7 @@ export async function createScene({ THREE, renderer, loaders }) {const cameras = [ // plain objects; the harness builds the cameras{ name: 'Establishing', position: [38, 14, 42], lookAt: [0, 2, 0], fov: 40 },{ name: 'GroveWalk', position: [6, heightAt(6, 20) + 1.6, 20], lookAt: [0, 2, 0], fov: 55 },+ { name: 'GroveDetail', position: [-4, heightAt(-4, 9) + 1.6, 9], lookAt: [-6, 1.2, 4], fov: 45 },];const movers = [grove];return { scene, cameras, update(t, dt) { env.update(t, dt); for (const m of movers) m.userData.update?.(t, dt); } };diff --git a/harness/codeverse3d/prompts/scene_threejs/cookbook.md b/harness/codeverse3d/prompts/scene_threejs/cookbook.mdindex 2ae2ade8..9a02cc85 100644--- a/harness/codeverse3d/prompts/scene_threejs/cookbook.md+++ b/harness/codeverse3d/prompts/scene_threejs/cookbook.md@@ -424,8 +424,8 @@ function buildLightShaft(THREE, opts = {}) {console.log('haze bands', buildHazeBands(THREE).children.length, 'shaft', buildLightShaft(THREE).name);```-Camera safety: the harness raycasts from every authored camera and calls anything within-0.3 m "camera inside geometry" (an ERROR). Keep haze bands and shafts at least 1 m clear+Camera safety: the harness raycasts from every authored camera and calls geometry right in+front of the lens "camera inside geometry" (an ERROR). Keep haze bands and shafts at least 1 m clearof every eye-level camera, or — since these cards are not solid surfaces — give them`mesh.raycast = () => {};` so the probe ignores them. Never do that to real geometry.@@ -837,7 +837,7 @@ console.log('cameras', planCameras(THREE, new THREE.Scene()).map(c => c.name));```Rules: eye height 1.6 m (+ terrain!), fov 35–60, look at a focal POINT (an object, not-the horizon), never inside geometry or up against a surface, 3–5 cameras:+the horizon), never inside geometry or up against a surface, 3–4 cameras:establishing → mid → detail. Compute positions from measured bounds/heightAt, not vibes.## Post-processing (the harness's own chain, ON by default)@@ -922,7 +922,7 @@ function sceneSelfcheck(THREE, scene, cameras) {}});if (!scene.fog) throw new Error('scene.fog not set');- if (!cameras || cameras.length < 2) throw new Error('need 3-5 cameras');+ if (!cameras || cameras.length < 3) throw new Error('need 3-4 cameras');console.log(`[selfcheck] draws=${draws} tris=${Math.round(tris)} lights=${lights} shadowLights=${shadowLights} cameras=${cameras.length}`);}const demoScene = new THREE.Scene(); buildEnv({ THREE, scene: demoScene });diff --git a/harness/codeverse3d/prompts/tracks/scene_refine.j2 b/harness/codeverse3d/prompts/tracks/scene_refine.j2index dae3631d..4ab4c1dd 100644--- a/harness/codeverse3d/prompts/tracks/scene_refine.j2+++ b/harness/codeverse3d/prompts/tracks/scene_refine.j2@@ -63,7 +63,7 @@ timid: double the amplitude / the count / the contrast this time.| sparse, token, "a diorama on a plane", empty midground | `"Set dressing"` + `"Scene layering"` — hit the per-zone prop counts, add a foreground element 2-4 m from each camera || flat / dark / monochrome light, black shade, jagged shadows | `"Atmosphere: time-of-day triads with numbers"` — warm key vs cool fill ≥ 60° apart, shadow texel ≤ 0.05 m || frames at t=0 and t=1.5 identical, "nothing moves" | `"Motion you can SEE between t = 0 and t = 1.5 s"` — the hook is `userData.update` (never `tick`), amplitudes from the table |-| camera inside geometry / shows only sky or a wall | move the camera in `src/scene.js` and mask scatter within 6 m of it (`cameraMask`) |+| camera inside geometry / shows only sky or a wall | move the camera in `src/scene.js` and mask scatter within ~4 m of it (`cameraMask`) |{% if current_files %}## Current file contents (edit and return each COMPLETE)