Skip to content

Official Codebase of 3DCodeVerse

Python

frames gate: the unseen-hero finding carries the hero's size as placed — "0.3 % of the frame" read as "microscopic"

gaoypengb2ee0f5c1fa0
diff --git a/harness/codeverse/spatial/frame_metrics.py b/harness/codeverse/spatial/frame_metrics.py
index 0a1f286e..22d77a7a 100644
--- a/harness/codeverse/spatial/frame_metrics.py
+++ b/harness/codeverse/spatial/frame_metrics.py
@@ -376,10 +376,12 @@ def _hero_findings(checks: list[dict[str, Any]], census: dict[str, Any]) -> list
base = url.rsplit("/", 1)[-1]
best = max(seen.values())
listing = ", ".join(f"{n} {v:.1%}" for n, v in list(seen.items())[:6])
+ size = _num(r, "size_m")
+ placed = f" ({size:.1f} m across as placed)" if size else ""
if best < HERO_MIN_FRAC:
out.append(_f(Severity.ERROR, base,
- f"{base} is in the scene but fills at most {best:.1%} of any authored frame ({listing}) — "
- "no camera sees the hero",
+ f"{base}{placed} is in the scene but fills at most {best:.1%} of any authored frame ({listing}) — "
+ "no camera sees the hero: it is far from every shot or something stands between, not small",
"aim the camera named for it at the hero's placement with a clear line of sight (a "
"camera_target_blocked finding names what cuts it) or move the hero into a shot; a hero the "
"frames never show cannot pass its must-have",
diff --git a/harness/runtime_js/lib/scene_host.mjs b/harness/runtime_js/lib/scene_host.mjs
index b2c42bc5..01e14934 100644
--- a/harness/runtime_js/lib/scene_host.mjs
+++ b/harness/runtime_js/lib/scene_host.mjs
@@ -146,11 +146,28 @@ function makeLoaders(manager) {
* that is why the finding is a WARN and says "no geometry from it", not "not used".
*/
function glbUsage(scene) {
- const used = new Set();
- try { scene.traverse((o) => { if (o.geometry && o.geometry.uuid) used.add(o.geometry.uuid); }); } catch { return []; }
+ const used = new Map(); // geometry uuid -> world boxes of the meshes that draw it
+ try {
+ const box = new THREE.Box3();
+ scene.traverse((o) => {
+ if (!o.geometry || !o.geometry.uuid || !(o.isMesh || o.isInstancedMesh)) return;
+ if (!o.geometry.boundingBox) o.geometry.computeBoundingBox();
+ if (!used.has(o.geometry.uuid)) used.set(o.geometry.uuid, new THREE.Box3());
+ if (o.geometry.boundingBox && !o.geometry.boundingBox.isEmpty()) {
+ box.copy(o.geometry.boundingBox).applyMatrix4(o.matrixWorld);
+ used.get(o.geometry.uuid).union(box);
+ }
+ });
+ } catch { return []; }
return loadedGlbs.map((g) => {
- const n = g.geometry_uuids.filter((u) => used.has(u)).length;
- return { url: g.url, meshes: g.geometry_uuids.length, meshes_in_scene: n, in_scene: n > 0 };
+ const all = new THREE.Box3();
+ let n = 0;
+ for (const u of g.geometry_uuids) { const b = used.get(u); if (b) { n += 1; if (!b.isEmpty()) all.union(b); } }
+ // the largest extent of the GLB as placed: "fills 0.3 % of the frame" reads as "microscopic"
+ // without it (loop 23's lighthouse: a 4.4 m lantern room on a 30 m tower, far from every
+ // camera, judged "scaled far too small" for three rounds)
+ const size = all.isEmpty() ? null : +Math.max(...all.getSize(new THREE.Vector3()).toArray()).toFixed(2);
+ return { url: g.url, meshes: g.geometry_uuids.length, meshes_in_scene: n, in_scene: n > 0, size_m: size };
});
}
diff --git a/harness/tests/scene_gates/test_frame_metrics.py b/harness/tests/scene_gates/test_frame_metrics.py
index 6f2d0cef..c87b58ce 100644
--- a/harness/tests/scene_gates/test_frame_metrics.py
+++ b/harness/tests/scene_gates/test_frame_metrics.py
@@ -222,7 +222,7 @@ def test_a_hero_in_the_scene_but_in_no_authored_frame_is_an_error():
"""cmp6's crypt (2026-09-09): the athanor stood behind a pillar in every authored shot and
the judge called the HERO a grey box — ``glb_frac`` is the mask render per GLB per camera."""
url = "/assets/athanor.glb"
- census = {"ground_y": 0.0, "glb_assets": [{"url": url, "meshes": 9, "meshes_in_scene": 9, "in_scene": True}]}
+ census = {"ground_y": 0.0, "glb_assets": [{"url": url, "meshes": 9, "meshes_in_scene": 9, "in_scene": True, "size_m": 2.2}]}
unseen = frame_findings({"census": census, "camera_checks": [
_chk("AthanorDetail", glb_frac={url: 0.0}), _chk("StairsPushIn", glb_frac={url: 0.001}),
_chk("overview_top", "orbit", glb_frac={url: 0.3})]}) # the rig sees it: not an authored shot
@@ -230,6 +230,7 @@ def test_a_hero_in_the_scene_but_in_no_authored_frame_is_an_error():
assert ("hero_unseen", Severity.ERROR, "athanor.glb") in kinds and not unseen.passed
msg = next(f.message for f in unseen.findings if f.data["kind"] == "hero_unseen")
assert "AthanorDetail 0.0%" in msg and "no camera sees the hero" in msg
+ assert "(2.2 m across as placed)" in msg and "not small" in msg # loop 23: 0.3 % read as "microscopic" without the size
# seen well in one shot, but the camera NAMED for it barely shows it → WARN on that camera
small = frame_findings({"census": census, "camera_checks": [
_chk("AthanorDetail", glb_frac={url: 0.004}), _chk("StairsPushIn", glb_frac={url: 0.12})]})
diff --git a/harness/tests/scene_gates/test_live_hero_in_frame.py b/harness/tests/scene_gates/test_live_hero_in_frame.py
index c1079d55..ddfee145 100644
--- a/harness/tests/scene_gates/test_live_hero_in_frame.py
+++ b/harness/tests/scene_gates/test_live_hero_in_frame.py
@@ -51,7 +51,7 @@ def test_a_hero_in_an_authored_frame_passes(starter_ws: Workspace):
assert rs.console_errors == []
m = read_metrics(out)
rows = {r["url"]: r for r in m["census"]["glb_assets"]}
- assert rows[URL]["in_scene"] is True
+ assert rows[URL]["in_scene"] is True and abs(rows[URL]["size_m"] - 4.0) < 0.05, rows[URL]
chk = {c["name"]: c for c in m["camera_checks"]}
seen = chk["overview"]["glb_frac"][URL]
assert seen > HERO_MIN_FRAC, chk["overview"]["glb_frac"] # the establishing shot sees the cube