Official Codebase of 3DCodeVerse
Python
scene: camera clearance rejects lens-inside reach only — the dg_izakaya lesson
gaoypeng0af6758070b2
diff --git a/harness/codeverse/tracks/zone_layout.py b/harness/codeverse/tracks/zone_layout.pyindex 4e5ac1f8..1a00ea02 100644--- a/harness/codeverse/tracks/zone_layout.py+++ b/harness/codeverse/tracks/zone_layout.py@@ -35,12 +35,17 @@ LAYOUT_WAIT_S = 300.0COUNT_SLACK = 4#: cluster centres may sit this far outside the zone bbox (assets have radius)BBOX_MARGIN_M = 1.0-#: base clearance a camera needs beyond half the asset's footprint. Measured on-#: fv_izakaya_night (2026-08-30): the director placed BarCounter 0.7 m from the-#: PotDetail camera — the camera sat INSIDE the counter, camera_in_geometry +-#: dark_frame capped all three rounds (0.512 uncapped → 0.252), and refine cannot-#: fix it because cameras belong to the plan, not to any file an agent owns.-CAMERA_CLEAR_M = 1.2+#: lens margin beyond the asset's own reach. Two measurements set this: fv_izakaya_night+#: (2026-08-30) — BarCounter 0.7 m from the PotDetail camera put the lens INSIDE the+#: counter, three capped rounds, unfixable downstream; and dg_izakaya_night (2026-08-31)+#: — the first tune (1.2 m base + footprint/2 + full spread) rejected EVERY placement a+#: small indoor zone could offer ("WoodenStool 1.8 m from OdenStationDetail — keep+#: >= 1.8 m") until the layout was dropped entirely, muting the layer exactly where it+#: helps. The validator now rejects only what puts the LENS inside the asset's reach+#: (half footprint + half spread + this margin, floored at 0.8 m); polite shot spacing+#: stays in the prompt, where a director can trade it off.+CAMERA_CLEAR_M = 0.4+CAMERA_CLEAR_FLOOR_M = 0.8#: two LARGE assets whose cluster centres nearly coincide are stacked into each other —#: fv2_alpine_night's RetainingWall x PrayerBench interpenetration. Deliberately narrow:#: only same-spot (< 0.6 m) pairs where BOTH footprints are >= 0.8 m and neither stands on@@ -70,12 +75,13 @@ def validate_layout(layout: ZoneLayout, zone: ZonePlan, plan: ScenePlan) -> str:# the shot must survive the layout: a cluster whose footprint reaches a camera# puts geometry inside the lens (fv_izakaya_night), and nothing downstream can fix itfoot = max(known[k].approx_size_m[0], known[k].approx_size_m[2])- need = CAMERA_CLEAR_M + foot / 2 + p.spread_m+ need = max(CAMERA_CLEAR_FLOOR_M, foot / 2 + p.spread_m / 2 + CAMERA_CLEAR_M)for cam in plan.cameras:dist = math.hypot(x - cam.position[0], z - cam.position[2])if dist < need:- problems.append(f"{p.asset} cluster ({x:.1f}, {z:.1f}) is {dist:.1f} m from camera {cam.name} "- f"— keep >= {need:.1f} m (its footprint plus lens clearance) so the shot stays clear")+ problems.append(f"{p.asset} cluster ({x:.1f}, {z:.1f}) reaches camera {cam.name} "+ f"({dist:.1f} m < {need:.1f} m = half its footprint+spread plus lens margin) — "+ f"move the cluster or shrink its spread so the lens stays outside it")placed = {to_snake(p.asset) for p in layout.placements}missing = [c for c in zone.contents if to_snake(c) not in placed]if missing:diff --git a/harness/tests/orchestrator_tracks/test_zone_layout.py b/harness/tests/orchestrator_tracks/test_zone_layout.pyindex d6d889ae..66da13f6 100644--- a/harness/tests/orchestrator_tracks/test_zone_layout.py+++ b/harness/tests/orchestrator_tracks/test_zone_layout.py@@ -50,7 +50,12 @@ def test_validator_rejects_a_cluster_that_swallows_a_camera():bad = _layout(placements=[{"asset": "Stall", "count": 1, "cluster": (1.2, 0.8), "spread_m": 0.0}],zone="Market")complaint = validate_layout(bad, plan.zones[1], plan)- assert "from camera overview" in complaint and "shot stays clear" in complaint+ assert "camera overview" in complaint and "lens stays outside" in complaint+ # the dg_izakaya lesson: an asset NEAR a camera but out of its reach is legal —+ # a 0.3 m-foot lantern 1.5 m from the lens must never be rejected+ near_ok = _layout(placements=[{"asset": "Bollard", "count": 2, "cluster": (2.0, 2.0), "spread_m": 0.4}],+ zone="Market")+ assert "camera" not in validate_layout(near_ok, plan.zones[1], plan)def test_validator_rejects_two_large_assets_on_one_spot_but_spares_adjacency():