Conservative route slabs with an outside sentinel, tight expanded segment bounds; DensityGrid exact fallbacks 479k -> 0 per run. Near-ready 2-14% faster than L119, still +4.7..+10.2% vs L109; whole view within -0.5..+8%. Same look (floor offset 7.884 mm, captures checked), seam audit bit-identical, fast tier + walk audits, Clang/GCC W1/W8/W12 determinism green. BVH and 25 cm tolerance trials rejected. Not for merge yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
101 lines
4.9 KiB
Python
101 lines
4.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Render the exact 23 L119 camera views with the L125 candidate."""
|
|
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
import json
|
|
import math
|
|
import os
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[4]
|
|
RESEARCH = Path(__file__).resolve().parent
|
|
CAPTURES = RESEARCH / "captures"
|
|
SAVED = ROOT / "Saved/Linux/l125/captures"
|
|
BASELINE_INDEX = (ROOT / "Standalone/Research/WorldAssemblerM3/Linux119"
|
|
/ "captures/L119/capture-index.json")
|
|
LAYOUT = ROOT / "Saved/Linux/l125/hashes/owner4-surface-world-w12-clang.layout.json"
|
|
CLANG = ROOT / os.environ.get("L125_CAPTURE_CLANG",
|
|
"Saved/Linux/l125/bin/VoxelForgeCoreHeadless-l125-clang")
|
|
RENDERER = ROOT / os.environ.get("L125_CAPTURE_RENDERER",
|
|
"Saved/Linux/l125/bin/VoxelForgeOffscreenCapture-l125-clang")
|
|
HELPER_PATH = ROOT / "Standalone/Research/WorldAssemblerM3/Linux113/RunL113Captures.py"
|
|
|
|
SPEC = importlib.util.spec_from_file_location("l113_capture_helpers", HELPER_PATH)
|
|
if SPEC is None or SPEC.loader is None:
|
|
raise SystemExit("cannot load the verified L113 capture helpers")
|
|
HELPERS = importlib.util.module_from_spec(SPEC)
|
|
SPEC.loader.exec_module(HELPERS)
|
|
HELPERS.RESEARCH = RESEARCH
|
|
HELPERS.CAPTURES = CAPTURES
|
|
HELPERS.SAVED = SAVED
|
|
HELPERS.BINARIES = {"L125": CLANG}
|
|
HELPERS.RENDERERS = {"L125": RENDERER}
|
|
|
|
|
|
def main() -> int:
|
|
if any(not path.is_file() for path in (BASELINE_INDEX, LAYOUT, CLANG, RENDERER)):
|
|
raise SystemExit("missing L119 camera set, L125 layout, or capture binary")
|
|
baseline = json.loads(BASELINE_INDEX.read_text(encoding="utf-8"))
|
|
layout = json.loads(LAYOUT.read_text(encoding="utf-8"))
|
|
rows = []
|
|
CAPTURES.mkdir(parents=True, exist_ok=True)
|
|
SAVED.mkdir(parents=True, exist_ok=True)
|
|
for view in baseline["captures"]:
|
|
row = HELPERS.capture("L125", view, layout)
|
|
row["variant"] = "L125-v225"
|
|
if view["kind"] == "rock-floor-close":
|
|
scene = ROOT / row["scene"]
|
|
anchor = HELPERS.nearest_surface_anchor(scene, view["target"], margin_m=5.0,
|
|
preferred_normal=(0.0, 0.0, 1.0), minimum_alignment=0.85)
|
|
alignment = HELPERS.dot(anchor["normal"], (0.0, 0.0, 1.0))
|
|
camera_distance = math.dist(row["camera_actual_m"], anchor["position_m"])
|
|
row.update({"floor_anchor_position_m": anchor["position_m"],
|
|
"floor_anchor_normal": anchor["normal"],
|
|
"closeup_camera_to_floor_distance_m": camera_distance,
|
|
"closeup_floor_normal_alignment": alignment,
|
|
"verified_upward_floor_normal": alignment >= 0.85})
|
|
if (not row["verified"] or not 2.0 <= camera_distance <= 3.2
|
|
or anchor["distance_m"] > 0.25 or alignment < 0.85
|
|
or row["drawn_triangles"] <= 0
|
|
or row["pixel_quality_status"] not in
|
|
("pass", "low_contrast_geometry_visible")):
|
|
raise RuntimeError(f"L125 floor close-up failed at {view['name']}")
|
|
rows.append(row)
|
|
if len(rows) != len(baseline["captures"]) or len(rows) != 23:
|
|
raise RuntimeError(f"expected all 23 L119 views, captured {len(rows)}")
|
|
index = CAPTURES / "L125" / "capture-index.json"
|
|
index.parent.mkdir(parents=True, exist_ok=True)
|
|
index.write_text(json.dumps({"captures": rows}, indent=2) + "\n",
|
|
encoding="utf-8")
|
|
|
|
html = ["<!doctype html><meta charset='utf-8'>",
|
|
"<title>L119 / L125 tunnel capture comparison</title>",
|
|
"<style>body{font:14px system-ui;margin:24px;background:#17191d;color:#eee}"
|
|
"section{margin:28px 0}h2{font-size:18px}div{display:grid;"
|
|
"grid-template-columns:1fr 1fr;gap:12px}img{width:100%;height:auto}"
|
|
"p{color:#bbb}</style>",
|
|
"<h1>L119 / L125 v225: identical views</h1>"]
|
|
old_by_name = {Path(row["capture"]).name: row for row in baseline["captures"]}
|
|
for row in rows:
|
|
name = Path(row["capture"]).name
|
|
old = old_by_name[name]
|
|
old_path = os.path.relpath(ROOT / "Standalone/Research/WorldAssemblerM3/Linux119"
|
|
/ old["capture"], CAPTURES)
|
|
new_path = os.path.relpath(RESEARCH / row["capture"], CAPTURES)
|
|
html.extend(["<section>", f"<h2>{row['passage']} — {row['station']}</h2>",
|
|
f"<p>{row['kind']} · L119 {old['pixel_quality_status']} · "
|
|
f"L125 {row['pixel_quality_status']}</p>", "<div>",
|
|
f"<figure><figcaption>L119</figcaption><img src='{old_path}'></figure>",
|
|
f"<figure><figcaption>L125 v225</figcaption><img src='{new_path}'></figure>",
|
|
"</div>", "</section>"])
|
|
(CAPTURES / "COMPARE.html").write_text("\n".join(html) + "\n",
|
|
encoding="utf-8")
|
|
print(f"[L125Captures] rendered={len(rows)} views index={index.relative_to(ROOT)}",
|
|
flush=True)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|