Skip to content

Official Codebase of 3DCodeVerse

Python

scene: a glass house is glass — ScenePlan.glazed builds roomShell's walls and roof as panes on an iron frame grid

gaoypeng60e938cdef03
diff --git a/harness/codeverse3d/contracts/plan.py b/harness/codeverse3d/contracts/plan.py
index d3210f90..772bbe19 100644
--- a/harness/codeverse3d/contracts/plan.py
+++ b/harness/codeverse3d/contracts/plan.py
@@ -605,6 +605,13 @@ class ScenePlan(BaseModel):
"environment module owns the enclosure — floor, walls and ceiling on the bounds' faces with "
"openings where the windows and doors are — and the zones dress the inside; false outdoors",
)
+ glazed: bool = Field(
+ default=False,
+ description="only with interior: the enclosure itself is glass on a metal frame (glasshouse, "
+ "conservatory, palm house, greenhouse, glass atrium) — the environment builds glass walls and "
+ "roof on a frame grid, and the sun and the land outside come through them; false for a room "
+ "with windows",
+ )
zones: list[ZonePlan] = Field(min_length=1)
assets: list[AssetPlan] = Field(default_factory=list)
effects: list[EffectPlan] = Field(default_factory=list)
diff --git a/harness/codeverse3d/languages/scene_threejs/__init__.py b/harness/codeverse3d/languages/scene_threejs/__init__.py
index 0039c2dc..c2fff44b 100644
--- a/harness/codeverse3d/languages/scene_threejs/__init__.py
+++ b/harness/codeverse3d/languages/scene_threejs/__init__.py
@@ -197,7 +197,9 @@ def _env_for_plan(plan: ScenePlan) -> str:
if plan.interior:
c = [round(float(v), 2) for v in plan.bounds.center]
e = [round(float(v), 2) for v in ex]
- text = re.sub(r"export const INTERIOR = null;", f"export const INTERIOR = {{ center: {c}, extents: {e}, openings: [] }};", text)
+ glazed = ", glazed: true" if plan.glazed else ""
+ text = re.sub(r"export const INTERIOR = null;",
+ f"export const INTERIOR = {{ center: {c}, extents: {e}, openings: []{glazed} }};", text)
header = (
f"// ENV PLAN: {plan.environment.strip()}\n"
f"// setting: {plan.setting.strip()} mood: {plan.mood.strip()}\n"
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/env.js b/harness/codeverse3d/languages/scene_threejs/starter/src/env.js
index 0a2925a1..426afc8d 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/env.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/env.js
@@ -23,7 +23,9 @@ export const GROUND_SIZE = 160; // ground plane extent (m); the outskirts
export const CONTENT_RADIUS = 45; // the plan bounds' radius (m): level ground inside, rolling beyond; the shadow frustum
// An INTERIOR plan (the skeleton fills this from plan.bounds): the room shell — floor is the
// ground, walls and ceiling on the bounds' faces. Cut the plan's windows and doors as
-// `openings` (see lib/environment.js roomShell) and light the inside; never delete it.
+// `openings` (see lib/environment.js roomShell) and light the inside; never delete it. A glass
+// house (`glazed: true`, from the plan) is glass walls and roof on an iron frame grid: the sun
+// and the land outside come through it.
export const INTERIOR = null; // e.g. { center: [0, 3, 0], extents: [14, 6, 16], openings: [{ face: 'west', center: [8, 2.5], size: [6, 3] }] }
const SEED = 7;
@@ -54,7 +56,7 @@ export function buildEnv(ctx) {
// land between the content and that ridge (relief, field patchwork, distant copses)
const shell = worldShell({ rand: mulberry32(SEED + 1), mood: MOOD, bounds: CONTENT_RADIUS });
group.add(shell.group);
- if (!INTERIOR) group.add(makeOutskirts({ inner: GROUND_SIZE / 2, shellRadius: shell.radius, heightAt, seed: SEED }));
+ if (!INTERIOR || INTERIOR.glazed) group.add(makeOutskirts({ inner: GROUND_SIZE / 2, shellRadius: shell.radius, heightAt, seed: SEED }));
// --- lights + the baked environment: the library's rig — sun, hemisphere fill, the env map
// metals read from, the visible disc. Measured 2026-09-07 on this renderer: a metalness-0.9
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/environment.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/environment.js
index ee8ea5c9..79a4fe4f 100644
--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/environment.js
+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/environment.js
@@ -43,10 +43,23 @@ const MOODS = {
* `{ face: 'west'|'east'|'north'|'south', center: [along, up],
* size: [width, height] }` in metres — `along` runs +z (west/east
* faces) or +x (north/south), `up` from the floor; `wallColor`,
- * `ceilingColor` hex; `ceiling` false for an open-topped set.
+ * `ceilingColor` hex; `ceiling` false for an open-topped set;
+ * `glazed` true for a glass house (conservatory, greenhouse, palm
+ * house, glass atrium): every wall and the roof become clear glass
+ * panes on an iron frame grid — `frameColor` hex, `bay` [across, up]
+ * frame spacing in metres (default [1.6, 2.4]). Measured 2026-09-23
+ * on the conservatory brief: an opaque shell around a glass house
+ * was judged "a solid white box encloses the dome, blocking the
+ * exterior view and lighting" (critical) and the room lit by fill
+ * alone; the runs that scored carved every wall into one opening and
+ * hand-built the same glass and grid.
* @returns {THREE.Group} named 'RoomShell' — walls 'Wall_<face>' (and
* 'Wall_<face>_<n>' panels around an opening), ceiling 'Ceiling'.
- * All cast and receive shadows.
+ * All cast and receive shadows. Glazed: the panes keep those names
+ * but cast no shadow (the sun comes through; the frame's shadow grid
+ * falls on the floor), the roof pane is 'Roof' (a see-through roof
+ * stays in the overview views), and the bars are one InstancedMesh
+ * 'Frame'.
*/
export function roomShell(opts = {}) {
const [cx, cy, cz] = opts.center || [0, 0, 0];
@@ -61,7 +74,47 @@ export function roomShell(opts = {}) {
// read "RoomShell is floating 39.8 m above the ground" against a terrain the env session had
// sunk to -40 m, and the judge repeated it as critical. Same tag as a bird: not on anything.
group.userData.placement = 'free';
+ const glazed = !!opts.glazed;
+ const glassMat = glazed ? new THREE.MeshStandardMaterial({
+ color: 0xe6f2f0, roughness: 0.05, metalness: 0.0, transparent: true, opacity: 0.14,
+ depthWrite: false, side: THREE.DoubleSide }) : null;
+ const frameMat = glazed ? new THREE.MeshStandardMaterial({
+ color: opts.frameColor === undefined ? 0x1f2b24 : opts.frameColor, roughness: 0.55, metalness: 0.6 }) : null;
+ const [bayA, bayU] = opts.bay || [1.6, 2.4];
+ const bar = 0.08; // frame bar section (m)
+ const bars = []; // [cx, cy, cz, sx, sy, sz] per bar
+ // The frame of one glazed panel: bars on a WORLD lattice (so the grid runs on across
+ // adjacent panels and around an opening) plus a bar on every panel edge.
+ const frame = (sx, sy, sz, x, y, z) => {
+ const dims = [sx, sy, sz], c = [x, y, z];
+ const thin = dims.indexOf(Math.min(...dims));
+ const [i, j] = [0, 1, 2].filter((k) => k !== thin);
+ const step = (k) => (k === 1 ? bayU : bayA);
+ const lines = (k) => {
+ const lo = c[k] - dims[k] / 2, hi = c[k] + dims[k] / 2, s = step(k), out = [lo, hi];
+ for (let v = Math.ceil((lo + 0.3) / s) * s; v < hi - 0.3; v += s) out.push(v);
+ return out;
+ };
+ for (const [along, across] of [[i, j], [j, i]]) {
+ for (const v of lines(across)) {
+ const size = [0, 0, 0], at = [...c];
+ size[thin] = Math.max(0.04, Math.min(dims[thin], 0.15)); size[along] = dims[along]; size[across] = bar;
+ at[across] = v;
+ bars.push([...at, ...size]);
+ }
+ }
+ };
const slab = (name, sx, sy, sz, x, y, z, mat) => {
+ if (glazed) {
+ // one sheet of glass in the slab's mid-plane (a 0.3 m glass BOX is four faces of glass)
+ const sheet = [sx, sy, sz];
+ sheet[sheet.indexOf(Math.min(...sheet))] = 0.02;
+ const m = new THREE.Mesh(new THREE.BoxGeometry(...sheet), glassMat);
+ m.name = name === 'Ceiling' ? 'Roof' : name; m.position.set(x, y, z);
+ group.add(m);
+ frame(sx, sy, sz, x, y, z);
+ return m;
+ }
const m = new THREE.Mesh(new THREE.BoxGeometry(sx, sy, sz), mat);
m.name = name; m.position.set(x, y, z); m.castShadow = true; m.receiveShadow = true;
group.add(m);
@@ -110,8 +163,18 @@ export function roomShell(opts = {}) {
}
}
if (opts.ceiling !== false) slab('Ceiling', w + 2 * t, t, d + 2 * t, cx, y0 + h + t / 2, cz, ceilMat);
+ if (bars.length) {
+ const inst = new THREE.InstancedMesh(new THREE.BoxGeometry(1, 1, 1), frameMat, bars.length);
+ const m4 = new THREE.Matrix4(), q = new THREE.Quaternion();
+ bars.forEach(([x, y, z, sx, sy, sz], n) => inst.setMatrixAt(n, m4.compose(new THREE.Vector3(x, y, z), q, new THREE.Vector3(sx, sy, sz))));
+ inst.instanceMatrix.needsUpdate = true;
+ inst.computeBoundingBox(); inst.computeBoundingSphere();
+ inst.name = 'Frame'; inst.castShadow = true; inst.receiveShadow = true;
+ group.add(inst);
+ }
const owned = snapshotResources(group);
owned.add(wallMat);owned.add(ceilMat);
+ if (glazed) { owned.add(glassMat); owned.add(frameMat); }
return attachDisposal(group, owned);
}
diff --git a/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md b/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md
index def18fca..83e6b805 100644
--- a/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md
+++ b/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md
@@ -48,7 +48,7 @@ says `import { makeGrass } from '../lib/grass.js';`, `src/scene.js` says
| the land between the content and the horizon | `makeOutskirts({ inner, baseY, heightAt, shellRadius, colors, seed })` — `lib/environment.js`; seam-matched relief, field patchwork and wooded clusters. A bare oversized ground plane measured as "a diorama on a vast, empty flat plane" |
| a Blender hero's own keyframed motion (the GLB carries a clip) | nothing to call — the assembled scene plays every clone's clips; `clone.userData.clipOffset = 0.7` de-phases a copy |
| the sun, the fill and the baked environment | `sunRig({ azimuth, elevation })` — `lib/environment.js`; returns `{ sun, fill, sunDisc, envTex, sunDir }`. Add the lights, assign `scene.environment = rig.envTex` |
-| an interior's walls, ceiling and window/door openings | `roomShell({ center, extents, openings, thickness, wallColor, ceilingColor })` — `lib/environment.js`; walls outward of the bounds' faces (inner face = bounds face), openings cut as span / sill / lintel panels. The skeleton's env.js builds it from its INTERIOR constant for an interior plan; six runs measured "not enclosed, a diorama on a flat plane" without one |
+| an interior's walls, ceiling and window/door openings | `roomShell({ center, extents, openings, thickness, wallColor, ceilingColor, glazed, frameColor, bay })` — `lib/environment.js`; walls outward of the bounds' faces (inner face = bounds face), openings cut as span / sill / lintel panels; glazed: true makes every wall and the roof glass on an iron frame grid (a conservatory, greenhouse, glass atrium). The skeleton's env.js builds it from its INTERIOR constant for an interior plan; six runs measured "not enclosed, a diorama on a flat plane" without one |
| the sky itself | `makeSky(scene, { rig })` — `lib/sky.js`; the dome IS the backdrop, so `scene.background` stays null |
| cloud, cirrus | `makeClouds({ preset, sunDir })` · `makeCirrus()` — `lib/clouds.js` |
| volumetric cumulus with internal sunlight attenuation | `makeCloudVolume({ size: [600,180,360], coverage: 0.55, density: 0.028, wind: [2.5,0.4], seed, quality: 'balanced' })` — `lib/cloudvolume.js`; Mesh centred on its local origin. Move it to cloud altitude. Wind advects density/erosion inside a bounded billow scaffold; translate the Mesh to move the whole cloud. `userData.sampleDensity(x,y,z,t)` mirrors the GPU field. Use one bounded sky volume and inspect its screen cost. No terrain shadows or opaque-depth intersections. |
diff --git a/harness/codeverse3d/prompts/tracks/plan_scene.j2 b/harness/codeverse3d/prompts/tracks/plan_scene.j2
index 49181ae7..3a9c6e07 100644
--- a/harness/codeverse3d/prompts/tracks/plan_scene.j2
+++ b/harness/codeverse3d/prompts/tracks/plan_scene.j2
@@ -124,7 +124,11 @@ WHAT TO PRODUCE (JSON, fields: {{ schema_fields }}):
enclosure on the bounds' faces (floor, walls, ceiling, with openings where `environment`
puts the windows and doors) and the zones dress the inside. Measured 2026-09-07 on
six interior runs: with no owner for walls and roof, every one was judged "not
- enclosed, a diorama on a flat plane" (0.0–0.3) until a refine round built them;
+ enclosed, a diorama on a flat plane" (0.0–0.3) until a refine round built them.
+ When the enclosure itself is glass on a frame (a conservatory, greenhouse, palm house,
+ glass atrium) also set `glazed: true`: the walls and roof are then glass on an iron
+ grid that the sun and the outside come through — an opaque room around a glass house
+ was judged "a solid box blocking the exterior view and lighting";
- mark everything else `priority: should` — craft goals, counts, specific patterns, exact
heights and anything needing evidence the judge may not have;
- never write a `must` whose wording contains a number, a named style, or the word "and"
diff --git a/harness/codeverse3d/prompts/tracks/scene_env.j2 b/harness/codeverse3d/prompts/tracks/scene_env.j2
index 33fd4418..45f4398b 100644
--- a/harness/codeverse3d/prompts/tracks/scene_env.j2
+++ b/harness/codeverse3d/prompts/tracks/scene_env.j2
@@ -6,7 +6,15 @@ Bounds: {{ bounds }}
## Environment plan (realise these numbers)
{{ environment }}
-{% if interior %}
+{% if interior and glazed %}
+## This is a GLASS HOUSE — the enclosure is yours
+The skeleton already builds it: `export const INTERIOR = { center, extents, openings, glazed: true }`
+feeds `roomShell()` from `lib/environment.js` — floor (the ground), glass walls and a glass roof on
+the bounds' faces, on an iron frame grid (`frameColor`, `bay`), with the land outside built beyond
+it. Keep it. Your job: cut the plan's doors as `openings`, tune the frame, and let the SUN do the
+lighting — it comes through the glass and the frame throws its grid of shadows on the floor. Never
+put an opaque wall or roof around it.
+{% elif interior %}
## This is an INTERIOR — the enclosure is yours
The skeleton already builds the room: `export const INTERIOR = { center, extents, openings }` feeds
`roomShell()` from `lib/environment.js` — floor (the ground), four walls and a ceiling on the bounds'
diff --git a/harness/codeverse3d/tracks/scene.py b/harness/codeverse3d/tracks/scene.py
index 27b5ab8b..ff8bac0e 100644
--- a/harness/codeverse3d/tracks/scene.py
+++ b/harness/codeverse3d/tracks/scene.py
@@ -455,7 +455,7 @@ class SceneTrack(BaseTrack):
effects = "\n".join(f"- {e.name} ({e.kind}, on {e.target or 'scene'}): {e.description}" for e in plan.effects) or "(none)"
return base_prompt_context(
ctx, title=plan.title, setting=plan.setting, mood=plan.mood, bounds=bbox_line(plan.bounds), environment=plan.environment,
- interior=plan.interior,
+ interior=plan.interior, glazed=plan.glazed,
zones_table=zones_table, cameras=cameras, effects=effects, animation="; ".join(plan.animation) or "(none)",
asset_api=ctx.extra.get("asset_api", "(no assets)"),
textures=texture_pack_prompt(ctx.extra.get("textures") or {}), **extra)
diff --git a/harness/docs/DECISIONS.md b/harness/docs/DECISIONS.md
index c4e8123b..90147bec 100644
--- a/harness/docs/DECISIONS.md
+++ b/harness/docs/DECISIONS.md
@@ -709,7 +709,12 @@ Pointers: EVAL, PAPER_WRITING = `eval/docs/*.md`; COST, RUNBOOK, ARCHITECTURE, I
a storm-dead env session ships a room, not a plane; the env brief claims the openings and the
light, the zone brief forbids walls. Harness-owned starter geometry the agent edits, like
`worldShell` (D51) — not a wrapper that re-centres or grounds anything (L7). Details:
- `tests/scene_runtime/lib/test_room_shell.py`.
+ `tests/scene_runtime/lib/test_room_shell.py`. 2026-09-23: a glass house is `ScenePlan.glazed`
+ → `roomShell({ glazed: true })` (glass walls and roof on an iron frame grid, panes cast no shadow,
+ the outskirts are built). Every recorded `scn_med_conservatory` round on 3.7-flash (0.00–0.14)
+ was a glass house inside the opaque shell ("a solid white box … blocking the exterior view and
+ lighting", critical); the 3.8-flash runs that scored 0.56–0.62 had cut each wall into one
+ opening and hand-built the same glass and grid.
* **D70 One author for the whole world — `C3D_ONE_WORLD_SESSION`, ON by default since the
fixed-judge confirmation of the session that is told its window (2026-09-08).** Under one fixed
diff --git a/harness/tests/scene_runtime/lib/test_room_shell.py b/harness/tests/scene_runtime/lib/test_room_shell.py
index 7b406f87..4ee63d34 100644
--- a/harness/tests/scene_runtime/lib/test_room_shell.py
+++ b/harness/tests/scene_runtime/lib/test_room_shell.py
@@ -48,3 +48,48 @@ def test_the_skeleton_env_carries_the_shell_only_for_an_interior_plan():
c, e = plan.bounds.center, plan.bounds.extents
assert f"export const INTERIOR = {{ center: [{c[0]}, {c[1]}, {c[2]}], extents: [{e[0]}, {e[1]}, {e[2]}], openings: [] }};" in inside
assert "if (INTERIOR) group.add(roomShell(INTERIOR));" in inside
+ glass = _env_for_plan(plan.model_copy(update={"interior": True, "glazed": True}))
+ assert "openings: [], glazed: true };" in glass
+ assert "if (!INTERIOR || INTERIOR.glazed) group.add(makeOutskirts(" in glass # the land outside is built
+
+
+_GLASS = """
+import * as THREE from 'three';
+import { roomShell } from './lib/environment.js';
+const g = roomShell({ center: [0, 5, 0], extents: [20, 10, 16], glazed: true,
+ openings: [{ face: 'south', center: [10, 1.5], size: [3, 3] }] });
+g.updateMatrixWorld(true);
+const panes = g.children.filter((m) => !m.isInstancedMesh);
+const frame = g.children.find((m) => m.name === 'Frame');
+// rays from a floor grid toward a high sun: the share a shadow caster stops
+const lit = (shell) => {
+ shell.updateMatrixWorld(true);
+ const sun = new THREE.Vector3(1, 1.4, 0.5).normalize();
+ let blocked = 0, n = 0;
+ for (let x = -8; x <= 8; x += 1.7) for (let z = -6; z <= 6; z += 1.3) {
+ const rc = new THREE.Raycaster(new THREE.Vector3(x, 0.01, z), sun);
+ n += 1;
+ if (rc.intersectObjects(shell.children, false).some((h) => h.object.castShadow)) blocked += 1;
+ }
+ return blocked / n;
+};
+const shaded = lit(g), opaque = lit(roomShell({ center: [0, 5, 0], extents: [20, 10, 16] }));
+console.log(JSON.stringify({
+ names: g.children.map((m) => m.name),
+ paneShadow: panes.some((m) => m.castShadow),
+ seeThrough: panes.every((m) => m.material.transparent && m.material.depthWrite === false),
+ bars: frame ? frame.count : 0, frameShadow: !!(frame && frame.castShadow), shaded, opaque,
+}));
+"""
+
+
+def test_a_glazed_shell_is_glass_on_a_frame_grid_that_lets_the_sun_in():
+ """The conservatory's round 0 (ab_verdict 2026-09-22, live_wave2): an opaque shell around a
+ glass house — "a solid white box encloses the dome, blocking the exterior view and lighting"."""
+ got = measure(_GLASS, ("environment.js", "sky.js"))
+ assert "Roof" in got["names"] and "Ceiling" not in got["names"], got["names"] # the overview rig keeps a glass roof
+ assert "Wall_east" in got["names"] and "Frame" in got["names"], got["names"]
+ assert got["seeThrough"] and not got["paneShadow"], got
+ assert got["bars"] > 40 and got["frameShadow"], got
+ # between the bars the sun reaches the floor; the opaque shell shades all of it
+ assert got["opaque"] == 1.0 and got["shaded"] < 0.3, got