Skip to content

Official Codebase of 3DCodeVerse

Python

graphics: the judge loop — shader_v2 (likeness, tonal range, the artefact checklist) and its calibration harness

gaoypenga284a66cc8c8
diff --git a/harness/bench/judge_calib_graphics.py b/harness/bench/judge_calib_graphics.py
new file mode 100644
index 00000000..428174b1
--- /dev/null
+++ b/harness/bench/judge_calib_graphics.py
@@ -0,0 +1,142 @@
+"""Calibrate the GRAPHICS judge against a human reading of the same contact sheets.
+
+The loop the object track had (rubric → re-judge recorded rounds → compare against what a
+person sees → revise) never ran for graphics. This script is that loop's measuring half:
+
+ python bench/judge_calib_graphics.py --corpus <corpus.json> --eye <eye.json> \
+ --rubrics shader_v1,shader_v2 --model gemini:gemini-3.1-pro-preview --n 2 \
+ --out bench/out/judge_calib_graphics
+
+* ``corpus.json``: ``[[score, run_dir, sheet_path, generator], ...]`` — every graphics run with a
+ judged round (``run_dir`` relative to ``bench/out`` or absolute).
+* ``eye.json``: ``{run_dir: score}`` — a person's 0–1 reading of the SAME sheets ("would a
+ curator screenshot it / does it look like the thing"). The ground truth this calibrates to.
+
+For every run and every rubric it rebuilds the JudgeInput the loop used (spec, the best round's
+RenderSet and gates; no planner acceptance items, so the rubric is measured on its own) and
+judges it with a fresh ``VlmJudge`` (n samples, pro). Output per rubric: ``<rubric>.jsonl`` (one
+row per run: overall, per-criterion, defects present, caps) and one ``summary.md`` with
+Spearman(judge, eye), mean judge vs mean eye, the biggest disagreements, and defect firing rates.
+Judging only; nothing under the runs is modified.
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import statistics as st
+from concurrent.futures import ThreadPoolExecutor
+from pathlib import Path
+from typing import Any
+
+from codeverse.contracts.artifacts import GateReport, RenderSet
+from codeverse.contracts.spec import Spec
+from codeverse.judges.base import JudgeInput
+from codeverse.judges.vlm_judge import VlmJudge
+
+OUT_ROOT = Path(__file__).resolve().parent / "out"
+
+
+def spearman(a: list[float], b: list[float]) -> float:
+ def rank(v: list[float]) -> list[float]:
+ order = sorted(range(len(v)), key=lambda i: v[i])
+ r = [0.0] * len(v)
+ i = 0
+ while i < len(order): # average ranks for ties
+ j = i
+ while j + 1 < len(order) and v[order[j + 1]] == v[order[i]]:
+ j += 1
+ for k in range(i, j + 1):
+ r[order[k]] = (i + j) / 2
+ i = j + 1
+ return r
+ ra, rb = rank(a), rank(b)
+ n = len(a)
+ if n < 3:
+ return float("nan")
+ return 1 - 6 * sum((x - y) ** 2 for x, y in zip(ra, rb, strict=True)) / (n * (n * n - 1))
+
+
+def best_round(run: Path) -> dict[str, Any] | None:
+ best: dict[str, Any] | None = None
+ for f in sorted(run.glob("rounds/r*.json")):
+ r = json.loads(f.read_text())
+ j = r.get("judgment") or {}
+ if j.get("overall") is not None and (best is None or j["overall"] > (best.get("judgment") or {}).get("overall", -1)):
+ best = r
+ return best
+
+
+def judge_one(run: Path, rubric: str, model: str, n: int) -> dict[str, Any]:
+ spec = Spec.model_validate(json.loads((run / "spec.json").read_text()))
+ rnd = best_round(run)
+ if rnd is None:
+ return {"run": str(run), "error": "no judged round"}
+ renders = RenderSet.model_validate(rnd["renders"])
+ gates = [GateReport.model_validate(g) for g in rnd.get("gates") or []]
+ inp = JudgeInput(spec=spec, renders=renders, gates=gates, round_index=int(rnd.get("index", 0)))
+ judge = VlmJudge(rubric=rubric, model_id=model, n_samples=n)
+ v = judge.judge(inp)
+ raw = v.raw if isinstance(v.raw, dict) else json.loads(v.raw or "{}")
+ return {
+ "run": str(run), "rubric": rubric, "overall": v.overall, "loop_overall": (rnd.get("judgment") or {}).get("overall"),
+ "scores": v.scores, "uncapped": raw.get("overall_uncapped"),
+ "defects": [d for d, on in (raw.get("defects") or {}).items() if on],
+ "caps": [c.get("rule") for c in (raw.get("caps") or {}).get("caps_applied", [])],
+ "summary": (v.summary or "")[:400], "cost_usd": getattr(v.usage, "cost_usd", None),
+ }
+
+
+def main(argv: list[str] | None = None) -> int:
+ ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
+ ap.add_argument("--corpus", required=True)
+ ap.add_argument("--eye", required=True)
+ ap.add_argument("--rubrics", default="shader_v1,shader_v2")
+ ap.add_argument("--model", default="gemini:gemini-3.1-pro-preview")
+ ap.add_argument("--n", type=int, default=2)
+ ap.add_argument("--workers", type=int, default=4)
+ ap.add_argument("--out", default=str(OUT_ROOT / "judge_calib_graphics"))
+ a = ap.parse_args(argv)
+ out = Path(a.out)
+ out.mkdir(parents=True, exist_ok=True)
+ corpus = json.loads(Path(a.corpus).read_text())
+ eye: dict[str, float] = json.loads(Path(a.eye).read_text())
+
+ def norm(d: str) -> str:
+ p = Path(d)
+ return str(p.relative_to(OUT_ROOT)) if p.is_absolute() and OUT_ROOT in p.parents else d.replace("bench/out/", "")
+
+ runs = [(norm(row[1]), Path(row[1]) if Path(row[1]).is_absolute() else Path.cwd() / row[1]) for row in corpus]
+ runs = [(k, p) for k, p in runs if k in eye]
+ lines = [f"# graphics judge calibration — {len(runs)} runs, model {a.model}, n={a.n}\n"]
+ for rubric in [r.strip() for r in a.rubrics.split(",") if r.strip()]:
+ with ThreadPoolExecutor(max_workers=a.workers) as ex:
+ rows = list(ex.map(lambda kp, rb=rubric: {"key": kp[0], **judge_one(kp[1], rb, a.model, a.n)}, runs))
+ (out / f"{rubric}.jsonl").write_text("".join(json.dumps(r) + "\n" for r in rows))
+ ok = [r for r in rows if "overall" in r]
+ js = [r["overall"] for r in ok]
+ ey = [eye[r["key"]] for r in ok]
+ rho = spearman(js, ey)
+ loop = [r["loop_overall"] for r in ok if r.get("loop_overall") is not None]
+ lines.append(f"\n## {rubric}\n")
+ lines.append(f"Spearman(judge, eye) = **{rho:.2f}** · mean judge {st.mean(js):.3f} · mean eye {st.mean(ey):.3f}"
+ + (f" · loop-time mean {st.mean(loop):.3f}" if loop else "") + f" · n={len(ok)}\n")
+ fired: dict[str, int] = {}
+ for r in ok:
+ for d in r["defects"]:
+ fired[d] = fired.get(d, 0) + 1
+ lines.append("defects fired: " + ", ".join(f"{d} {c}/{len(ok)}" for d, c in sorted(fired.items(), key=lambda x: -x[1])) + "\n")
+ lines.append("\n| run | eye | judge | Δ(judge−eye) | defects | caps |\n|---|---|---|---|---|---|\n")
+ for r in sorted(ok, key=lambda r: -(abs(r["overall"] - eye[r["key"]]))):
+ lines.append(f"| {r['key'].split('/')[-1]} | {eye[r['key']]:.2f} | {r['overall']:.3f} | {r['overall'] - eye[r['key']]:+.2f} | "
+ f"{', '.join(r['defects'])} | {', '.join(c for c in r['caps'] if c)} |\n")
+ for r in rows:
+ if "error" in r:
+ lines.append(f"- {r['key']}: {r['error']}\n")
+ (out / "summary.md").write_text("".join(lines))
+ print("".join(lines))
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/harness/bench/prompts/refs_v1_graphics.yaml b/harness/bench/prompts/refs_v1_graphics.yaml
new file mode 100644
index 00000000..98e7efae
--- /dev/null
+++ b/harness/bench/prompts/refs_v1_graphics.yaml
@@ -0,0 +1,132 @@
+name: refs_v1_graphics
+track: graphics
+language: glsl_shader
+description: Reference photos vs none on the same brief (aurora), 3 seeds per arm; judge both arms offline with
+ the same LikenessJudge.
+prompts:
+- id: aurora_ref_1
+ prompt: 'an aurora over a snowy ridge: layered green and violet curtains with vertical ray structure rippling
+ across the sky, a dense star field behind them, a dark mountain-ridge silhouette along the bottom third and
+ a frozen lake reflecting the curtains with a soft shimmer
+
+ '
+ tier: medium
+ category: natural_phenomena
+ must_have:
+ - at least 3 overlapping aurora curtains at different depths and brightnesses
+ - vertical ray structure inside the curtains, not flat colour bands
+ - green low in the curtain shading to violet or magenta at the top
+ - star field visible through and above the curtains, at least 200 stars in 2 brightnesses
+ - dark mountain ridge silhouette across the lower third with at least 3 peaks
+ - frozen lake below the ridge reflecting the curtains, softer and dimmer than the sky
+ - the curtains ripple and drift horizontally across the sampled frames
+ - dark night frame with the aurora as the brightest element, nothing blown out
+ tags:
+ - refs_ab
+ - ref
+ - seed1
+- id: aurora_ref_2
+ prompt: 'an aurora over a snowy ridge: layered green and violet curtains with vertical ray structure rippling
+ across the sky, a dense star field behind them, a dark mountain-ridge silhouette along the bottom third and
+ a frozen lake reflecting the curtains with a soft shimmer
+
+ '
+ tier: medium
+ category: natural_phenomena
+ must_have:
+ - at least 3 overlapping aurora curtains at different depths and brightnesses
+ - vertical ray structure inside the curtains, not flat colour bands
+ - green low in the curtain shading to violet or magenta at the top
+ - star field visible through and above the curtains, at least 200 stars in 2 brightnesses
+ - dark mountain ridge silhouette across the lower third with at least 3 peaks
+ - frozen lake below the ridge reflecting the curtains, softer and dimmer than the sky
+ - the curtains ripple and drift horizontally across the sampled frames
+ - dark night frame with the aurora as the brightest element, nothing blown out
+ tags:
+ - refs_ab
+ - ref
+ - seed2
+- id: aurora_ref_3
+ prompt: 'an aurora over a snowy ridge: layered green and violet curtains with vertical ray structure rippling
+ across the sky, a dense star field behind them, a dark mountain-ridge silhouette along the bottom third and
+ a frozen lake reflecting the curtains with a soft shimmer
+
+ '
+ tier: medium
+ category: natural_phenomena
+ must_have:
+ - at least 3 overlapping aurora curtains at different depths and brightnesses
+ - vertical ray structure inside the curtains, not flat colour bands
+ - green low in the curtain shading to violet or magenta at the top
+ - star field visible through and above the curtains, at least 200 stars in 2 brightnesses
+ - dark mountain ridge silhouette across the lower third with at least 3 peaks
+ - frozen lake below the ridge reflecting the curtains, softer and dimmer than the sky
+ - the curtains ripple and drift horizontally across the sampled frames
+ - dark night frame with the aurora as the brightest element, nothing blown out
+ tags:
+ - refs_ab
+ - ref
+ - seed3
+- id: aurora_noref_1
+ prompt: 'an aurora over a snowy ridge: layered green and violet curtains with vertical ray structure rippling
+ across the sky, a dense star field behind them, a dark mountain-ridge silhouette along the bottom third and
+ a frozen lake reflecting the curtains with a soft shimmer
+
+ '
+ tier: medium
+ category: natural_phenomena
+ must_have:
+ - at least 3 overlapping aurora curtains at different depths and brightnesses
+ - vertical ray structure inside the curtains, not flat colour bands
+ - green low in the curtain shading to violet or magenta at the top
+ - star field visible through and above the curtains, at least 200 stars in 2 brightnesses
+ - dark mountain ridge silhouette across the lower third with at least 3 peaks
+ - frozen lake below the ridge reflecting the curtains, softer and dimmer than the sky
+ - the curtains ripple and drift horizontally across the sampled frames
+ - dark night frame with the aurora as the brightest element, nothing blown out
+ tags:
+ - refs_ab
+ - noref
+ - seed1
+- id: aurora_noref_2
+ prompt: 'an aurora over a snowy ridge: layered green and violet curtains with vertical ray structure rippling
+ across the sky, a dense star field behind them, a dark mountain-ridge silhouette along the bottom third and
+ a frozen lake reflecting the curtains with a soft shimmer
+
+ '
+ tier: medium
+ category: natural_phenomena
+ must_have:
+ - at least 3 overlapping aurora curtains at different depths and brightnesses
+ - vertical ray structure inside the curtains, not flat colour bands
+ - green low in the curtain shading to violet or magenta at the top
+ - star field visible through and above the curtains, at least 200 stars in 2 brightnesses
+ - dark mountain ridge silhouette across the lower third with at least 3 peaks
+ - frozen lake below the ridge reflecting the curtains, softer and dimmer than the sky
+ - the curtains ripple and drift horizontally across the sampled frames
+ - dark night frame with the aurora as the brightest element, nothing blown out
+ tags:
+ - refs_ab
+ - noref
+ - seed2
+- id: aurora_noref_3
+ prompt: 'an aurora over a snowy ridge: layered green and violet curtains with vertical ray structure rippling
+ across the sky, a dense star field behind them, a dark mountain-ridge silhouette along the bottom third and
+ a frozen lake reflecting the curtains with a soft shimmer
+
+ '
+ tier: medium
+ category: natural_phenomena
+ must_have:
+ - at least 3 overlapping aurora curtains at different depths and brightnesses
+ - vertical ray structure inside the curtains, not flat colour bands
+ - green low in the curtain shading to violet or magenta at the top
+ - star field visible through and above the curtains, at least 200 stars in 2 brightnesses
+ - dark mountain ridge silhouette across the lower third with at least 3 peaks
+ - frozen lake below the ridge reflecting the curtains, softer and dimmer than the sky
+ - the curtains ripple and drift horizontally across the sampled frames
+ - dark night frame with the aurora as the brightest element, nothing blown out
+ tags:
+ - refs_ab
+ - noref
+ - seed3
diff --git a/harness/bench/refs/aurora_ref_1/aurora_green_spiral_sea.png b/harness/bench/refs/aurora_ref_1/aurora_green_spiral_sea.png
new file mode 100644
index 00000000..0af725b8
Binary files /dev/null and b/harness/bench/refs/aurora_ref_1/aurora_green_spiral_sea.png differ
diff --git a/harness/bench/refs/aurora_ref_1/aurora_purple_green_lake.png b/harness/bench/refs/aurora_ref_1/aurora_purple_green_lake.png
new file mode 100644
index 00000000..8075b10a
Binary files /dev/null and b/harness/bench/refs/aurora_ref_1/aurora_purple_green_lake.png differ
diff --git a/harness/bench/refs/aurora_ref_2/aurora_green_spiral_sea.png b/harness/bench/refs/aurora_ref_2/aurora_green_spiral_sea.png
new file mode 100644
index 00000000..0af725b8
Binary files /dev/null and b/harness/bench/refs/aurora_ref_2/aurora_green_spiral_sea.png differ
diff --git a/harness/bench/refs/aurora_ref_2/aurora_purple_green_lake.png b/harness/bench/refs/aurora_ref_2/aurora_purple_green_lake.png
new file mode 100644
index 00000000..8075b10a
Binary files /dev/null and b/harness/bench/refs/aurora_ref_2/aurora_purple_green_lake.png differ
diff --git a/harness/bench/refs/aurora_ref_3/aurora_green_spiral_sea.png b/harness/bench/refs/aurora_ref_3/aurora_green_spiral_sea.png
new file mode 100644
index 00000000..0af725b8
Binary files /dev/null and b/harness/bench/refs/aurora_ref_3/aurora_green_spiral_sea.png differ
diff --git a/harness/bench/refs/aurora_ref_3/aurora_purple_green_lake.png b/harness/bench/refs/aurora_ref_3/aurora_purple_green_lake.png
new file mode 100644
index 00000000..8075b10a
Binary files /dev/null and b/harness/bench/refs/aurora_ref_3/aurora_purple_green_lake.png differ
diff --git a/harness/codeverse/judges/rubrics/shader_v2.yaml b/harness/codeverse/judges/rubrics/shader_v2.yaml
new file mode 100644
index 00000000..a11cfb31
--- /dev/null
+++ b/harness/codeverse/judges/rubrics/shader_v2.yaml
@@ -0,0 +1,224 @@
+name: shader_v2
+version: 2
+track_hint: graphics
+pass_threshold: 0.70
+description: >
+ Rubric for the GRAPHICS track (Shadertoy-style fragment shader or raw OpenGL program), judged on
+ a contact sheet of frames sampled at t = 0, 1, 2.5, 4, 6 s plus the harness frame metrics.
+ v2 (2026-08-26) replaces "brief fidelity" with LIKENESS: does the effect look like the thing
+ the brief names — the physics of it, not the list of nouns. Measured on 17 judged runs before
+ this revision: Spearman(judge, a curator's eye) = 0.16, judge mean 0.77 against an eye mean of
+ 0.55; three aurora versions that a person would not accept as an aurora scored 0.78-0.94 with
+ empty issue lists because every noun in the brief was present. The checklist below names the
+ ways those frames failed so that a 0.9 is once again something a person would screenshot.
+
+extra_instructions: >
+ Every view is the SAME program rendered at a different time (label t=...s); there are no camera
+ angles. Compare the frames to judge motion: identical frames mean the effect is static; wildly
+ unrelated frames mean flicker. The frame-metrics digest (mean luminance, colourfulness, edge
+ density, mean |Δ| between frames, NaN count) is measured by the harness — treat it as truth over
+ your impression. You are a demanding curator, not a checklist clerk: the median competent
+ shader is 0.55-0.65; 0.85+ is reserved for frames you would screenshot and show someone; a frame
+ that ticks every noun in the brief with the wrong physics (a row of evenly spaced bars standing
+ in for aurora curtains, hard opaque discs standing in for bokeh, a lifted purple wash standing in
+ for a nebula) is 0.5 on likeness however complete its inventory. When REAL-WORLD REFERENCE
+ photos are attached, likeness, light and detail are scored against them — the photo says what
+ the thing looks like; the brief only names it. A consistent stylised look (ukiyo-e, pixel art,
+ flat vector) is craft when the brief allows it, never a defect. Do not grade up for effort, for
+ the number of named elements present, or for saturation.
+
+criteria:
+ - id: likeness
+ weight: 0.26
+ floor: 0.30
+ title: Likeness to the thing named
+ description: >
+ Would someone who has seen the real thing (or the referenced style) accept these frames as
+ it? Judge the physics: the dominant colour and where the secondary colours sit, how the
+ structure folds / layers / thins out, where the brightness concentrates and how much of the
+ frame stays dark, the texture at fine scale, the scale relations (a star field is thousands
+ of points, not twenty sparkles). Named elements count only insofar as they look right.
+ anchors:
+ "1.0": Could pass for a still of the thing, or a well-made stylised rendition of it; nothing about its physics is wrong.
+ "0.7": Recognisable at once; one physical trait is wrong (colour balance, structure, light distribution).
+ "0.4": The nouns are all there but no one would mistake it for the thing — bars for curtains, discs for bokeh, a flat wash for a nebula, a gradient for a sky (score 0.4-0.5).
+ "0.1": Unrelated abstract pattern, noise, or nothing recognisable.
+
+ - id: depth_and_detail
+ weight: 0.16
+ title: Depth and detail
+ description: >
+ Is there structure at several scales — near / mid / far layers with real depth cues
+ (parallax, fog, size and brightness falloff), fbm or particle detail inside the large shapes,
+ highlights and shadows — rather than one texture or gradient filling the frame? Credit only
+ what is visible in the frames.
+ anchors:
+ "1.0": Several layers at different depths, each with its own detail; the image rewards a closer look.
+ "0.7": Two or three distinct layers; some areas plain.
+ "0.4": One dominant element on a flat background; little detail.
+ "0.1": A single gradient, blob, or field of uniform noise fills the frame.
+
+ - id: light_and_tone
+ weight: 0.16
+ title: Light and tonal range
+ description: >
+ Is the exposure and palette that of the scene described — real darks where the subject is
+ night, space or dusk, highlights that glow without clipping to white, no milky haze lifting
+ the whole frame, colours with a neutral or dark counterweight rather than candy saturation
+ everywhere? Glow, bloom and scattering should read as light, not as paint.
+ anchors:
+ "1.0": Tonal range and palette sell the mood; darks are dark, highlights bloom without clipping.
+ "0.7": Pleasant; slightly flat, slightly lifted or one colour overdone.
+ "0.4": Washed-out mid-tones with no darks, a blown region, or uniformly candy/pastel colour.
+ "0.1": Near-black, blown white, or random colours.
+
+ - id: composition
+ weight: 0.10
+ title: Composition and framing
+ description: >
+ Is the frame composed — a focal area, horizon / vanishing point placed deliberately, balance
+ between empty and busy regions, nothing important cut off or crammed into a corner, aspect
+ ratio respected (no stretched circles)?
+ anchors:
+ "1.0": Deliberate composition with a clear focal area and depth layering.
+ "0.7": Readable composition; slightly flat or off-balance.
+ "0.4": Elements stretched / off-screen / centred by accident; no focal area.
+ "0.1": Unreadable arrangement.
+
+ - id: motion_quality
+ weight: 0.14
+ floor: 0.20
+ title: Motion quality
+ description: >
+ Across the time samples, does the effect move the way the brief / plan says (rain falls,
+ curtains ripple, lights pulse, camera glides) — continuous, paced, plausible — neither frozen
+ nor strobing? Motion that is only a texture scrolling under a fixed shape is 0.5.
+ anchors:
+ "1.0": Planned motion is visible, continuous and natural across all samples.
+ "0.7": Motion visible but subtle, uniform or partly missing.
+ "0.4": Frames nearly identical although motion was planned, or jumps/strobes between samples.
+ "0.1": Static effect (all frames identical) or incoherent flicker.
+
+ - id: technical_cleanliness
+ weight: 0.10
+ floor: 0.30
+ title: Technical cleanliness
+ description: >
+ No NaN / garbage pixels, no aliasing staircase on edges, no banding in gradients, no tiling
+ seams, no z-fighting, no flicker, no frame that is solid black or white. The harness digest
+ lists NaN counts and gate findings — treat those as facts.
+ anchors:
+ "1.0": Clean frames; no artefacts in any sample; no gate findings.
+ "0.7": One minor artefact (slight aliasing / banding) in one area.
+ "0.4": A clearly visible artefact (seam, banding, aliasing, a black frame) or a gate warning.
+ "0.1": NaN / garbage pixels, or frames are broken.
+
+ - id: craft
+ weight: 0.08
+ title: Craft and idea
+ description: >
+ Does the effect go beyond the textbook demo with a specific look, a considered palette and a
+ detail that fits the brief? A consistent stylised treatment counts as craft.
+ anchors:
+ "1.0": Distinctive, crafted look with a memorable idea.
+ "0.7": Competent and tasteful; some familiar ingredients.
+ "0.4": A stock demo with the brief's colours swapped in.
+ "0.1": Generic noise / gradient with no idea.
+
+caps:
+ - id: build_error
+ when: gate
+ gate: "build*"
+ severity: error
+ cap: 0.0
+ note: the shader/program did not compile or render; nothing to score
+ - id: lint_error
+ when: gate
+ gate: "lint*"
+ severity: error
+ cap: 0.6
+ - id: nan_pixels
+ when: gate
+ gate: "gl_frames"
+ severity: error
+ kinds: [nan]
+ cap: 0.0
+ note: NaN/Inf pixels detected in the float readback
+ - id: black_or_blown
+ when: gate
+ gate: "gl_frames"
+ severity: error
+ kinds: [black, blown]
+ cap: 0.5
+ - id: static_frames
+ when: gate
+ gate: "gl_frames"
+ severity: warn
+ kinds: [static]
+ cap: 0.5
+ note: motion was planned but frames do not change over time
+ - id: flicker
+ when: gate
+ gate: "gl_frames"
+ severity: warn
+ kinds: [flicker]
+ cap: 0.7
+ - id: missing_must_acceptance
+ when: acceptance
+ cap: 0.7
+ note: >
+ planner-written must items are fallible on this track (a stylised wave lost 0.25 to three of
+ them while looking better than anything else in the battery); the cap is 0.7, not 0.6
+
+defects:
+ - id: wrong_subject
+ text: The frames do not depict the subject of the brief (an unrelated abstract pattern, or nothing recognisable).
+ cap: 0.40
+ - id: unlike_reference
+ text: REAL-WORLD REFERENCE photos are attached and the frames would not be taken for the same thing — wrong dominant colour, wrong structure, or light in the wrong place. (Leave false when no reference is attached.)
+ penalty: 0.10
+ cap: 0.60
+ - id: comb_artefact
+ text: An organic structure (curtains, rays, flames, grass, waves, trees) is drawn as a row of straight, evenly spaced bars, tubes or stripes.
+ penalty: 0.10
+ cap: 0.65
+ - id: opaque_shapes_for_light
+ text: A light phenomenon (bokeh, glow, aurora, rays, fire, neon) is drawn as hard-edged opaque shapes instead of light with soft falloff.
+ penalty: 0.08
+ - id: flat_fill
+ text: One texture, gradient or noise field fills most of the frame with no structure at other scales.
+ penalty: 0.08
+ - id: no_dark_range
+ text: The subject is night, space, dusk or an interior, yet nothing in the frame is near-black — a lifted, washed-out mid-tone throughout.
+ penalty: 0.06
+ - id: white_wash
+ text: Haze, bloom or fog lifts a large region toward white (a milky frame, or a blown patch that is not a light source).
+ penalty: 0.08
+ - id: candy_saturation
+ text: Colours are uniformly candy-saturated or pastel with no neutral or dark counterweight.
+ penalty: 0.06
+ - id: black_or_blown_frame
+ text: At least one sampled frame is essentially solid black or blown-out white.
+ penalty: 0.10
+ cap: 0.50
+ - id: static_effect
+ text: The sampled frames are visually identical although the brief implies motion.
+ penalty: 0.10
+ cap: 0.50
+ - id: flicker_or_strobe
+ text: Consecutive samples are unrelated (hard cuts, strobing, random per-frame colours) rather than continuous motion.
+ penalty: 0.08
+ cap: 0.70
+ - id: garbage_pixels
+ text: Visible garbage — NaN speckles, blocky corruption, uninitialised regions, magenta/error colour.
+ penalty: 0.10
+ cap: 0.30
+ - id: banding_or_aliasing
+ text: Clearly visible banding in gradients or staircase aliasing on edges / thin lines.
+ penalty: 0.05
+ - id: stretched_aspect
+ text: Circles are ellipses / the image is stretched — aspect ratio not corrected.
+ penalty: 0.06
+ - id: placeholder_look
+ text: The effect is a textbook demo (plain plasma, uv gradient, rainbow rings) with no connection to the brief beyond colour.
+ penalty: 0.10
diff --git a/harness/docs/GRAPHICS_LOOP.md b/harness/docs/GRAPHICS_LOOP.md
new file mode 100644
index 00000000..15e0e33b
--- /dev/null
+++ b/harness/docs/GRAPHICS_LOOP.md
@@ -0,0 +1,117 @@
+# The graphics loop — what is judged, what feeds back, and how to keep making it better
+
+*2026-08-26. Companion to `docs/EVAL.md` (protocol) and `docs/ARCHITECTURE.md` (the track).
+Everything here is measured on this harness; numbers are cited, not re-derived.*
+
+The graphics track (`glsl_shader`, `opengl_python`) shares the judge **machinery** with every
+other track — `judges/vlm_judge.py` builds the messages, `judges/scoring.py` turns N samples
+into one code-computed verdict, `judges/caps.py` applies gate caps and the defect checklist.
+What is track-specific is (a) the rubric (`judges/rubrics/shader_*.yaml`: criteria, anchors,
+caps, the defect checklist), (b) the judge context the track writes (`tracks/graphics.py::
+judge_context`: the harness frame metrics), (c) what the refine session receives
+(`prompts/tracks/refine_graphics.j2`), and (d) since today, the reference photos. Until today
+only (b) and (c) had been designed for graphics; the rubric had never been calibrated against a
+person looking at the frames. This document is the loop that does that, and the first turn of it.
+
+## 1. What the loop looks like
+
+```
+brief ──plan──▶ shader ──build──▶ frames @ t=0,1,2.5,4,6 ──metrics──▶ gl_frames gate
+ │ │
+ ▼ ▼
+ contact sheet + metrics ──▶ JUDGE (rubric) ──▶ score, issues, plan
+ ▲ │
+ │ refine_graphics.j2 ◀───────┘
+ └──── refine session (sees the sheet, the photos, the plan)
+```
+
+* **Deterministic first** (law 3): `spatial/frame_metrics.py` measures every sampled frame — mean
+ luminance, colourfulness, edge density, |Δ| between frames, black / blown fraction, NaN count —
+ and `gl_frames` gates static / flicker / black / NaN. These are in the judge's context as facts.
+* **The judge** sees one labelled contact sheet (frames are the "views"; there are no cameras),
+ the metrics digest, the plan digest (passes, key visuals, motion) and the acceptance checklist
+ the planner wrote; it answers observe-then-score JSON; code computes the weighted overall,
+ applies floors, gate caps and the defect checklist (`scoring.py`).
+* **The refine session** gets a prioritised change list (gate failures first, then the judge's
+ improvement plan with `instruction` per item), the judge summary, the metrics table, the plan,
+ the checklist, the current files — and, since 5688051 / 0aee3b8, the contact sheet the judge
+ scored and the reference photos as images. This part works: the accretion-disc teaser went
+ 0.24 → 0.75 in one round on exactly this prompt (`bench/out/teaser/runs/tsr_gfx_accretion_disc`).
+
+## 2. What was wrong (measured before the first turn)
+
+Seventeen graphics runs with a judged round (graphics_v1/v2 batteries, the teaser, the codex
+wave) were read by a person and scored 0–1 on "would a Shadertoy curator screenshot it / does
+it look like the thing". Against the loop-time judge (`shader_v1`, pro):
+
+| | judge v1 | eye |
+|---|---|---|
+| mean | 0.773 | 0.550 |
+| Spearman(judge, eye) | **0.16** | — |
+
+Three aurora versions that no one would accept as an aurora scored 0.78 / 0.94 / 0.94 with empty
+issue lists; a neon-rain of hard opaque pastel discs scored 0.92; a lifted purple nebula wash
+0.82 — while a crisp ukiyo-e wave (0.59) and a crafted mandala (0.60) were capped by
+planner-written must items. The rubric rewarded *the nouns of the brief being present* and had
+no notion of likeness, tonal range or the artefacts flash actually produces (a comb of evenly
+spaced bars for anything organic; hard shapes for light; a white wash for glow). The refine
+loop then faithfully optimised toward that judge.
+
+Eye scores: `scratchpad/gfx_eye.json` → copied to `bench/out/judge_calib_graphics/eye.json`.
+
+## 3. The first turn: `shader_v2` + reference photos + LikenessJudge
+
+* **`judges/rubrics/shader_v2.yaml`** — `brief_fidelity` becomes **`likeness`** (0.26, floor
+ 0.3): would someone who has seen the real thing accept the frames — dominant colour, where the
+ secondary colours sit, how the structure folds / thins, where the light sits, how much stays
+ dark, scale relations; "all the nouns, wrong physics" is anchored at 0.4–0.5.
+ `visual_richness` → `depth_and_detail`; `colour_light` → `light_and_tone` (darks must exist in
+ night/space subjects; no milky wash; no candy saturation); `originality` → `craft` (a
+ consistent stylised look is craft). The instructions calibrate the scale ("median competent
+ shader 0.55–0.65; 0.85+ is a screenshot"). New checklist defects name the observed failure
+ modes: `comb_artefact` (cap 0.65), `opaque_shapes_for_light`, `flat_fill`, `no_dark_range`,
+ `white_wash`, `candy_saturation`, `unlike_reference` (cap 0.6, only with photos attached).
+ `missing_must_acceptance` cap 0.7 (was 0.6): planner must items are fallible on this track.
+* **Reference photos** — `bench/refs/<prompt_id>/*.png|jpg` (README there). Attached to the
+ Spec by every bench driver; graphics/scene tasks carry them as images on the first message
+ with a note that asks for the physics, not the composition (`tracks/prompting.py::
+ _likeness_note`); the judge becomes `judges/reference.py::LikenessJudge` — the same photos
+ beside the frames, no silhouette IoU (that is an object-track measurement). Same battery with
+ the folder present vs absent is the A/B (`bench/prompts/refs_v1_graphics.yaml`, in flight).
+* **Measuring the turn** — `bench/judge_calib_graphics.py` re-judges the corpus under v1 and v2
+ (pro, n=2, no planner acceptance so the rubric is measured on its own) and prints
+ Spearman(judge, eye), means, defect firing rates and the biggest disagreements. The result of
+ the first run is recorded in §5 below and in EVAL.md §6; `TRACK_INFO[graphics].rubric` moves
+ to v2 only if the correlation clearly improves.
+
+## 4. How to run the next turn (the recipe)
+
+1. **Look.** Pick 10–20 judged graphics runs (`rounds/rNN.json` has the sheet path); score
+ them by eye into `eye.json`. Disagreements between eye and judge are the material; write
+ down *why* each one is wrong in one line.
+2. **Name the failure.** Every "why" becomes either a checklist defect (binary, with a penalty
+ and, when it should dominate, a cap), an anchor sentence in the criterion it belongs to, or a
+ deterministic metric if it can be measured (`frame_metrics.py` — e.g. black fraction already
+ exists; a "dark range" metric = fraction of pixels < 0.05 luminance would make
+ `no_dark_range` a gate instead of an opinion). Prefer the metric.
+3. **Bump the rubric version** (`shader_vN+1.yaml`, never edit the one a battery reports on —
+ EVAL.md §6 rule) and run `bench/judge_calib_graphics.py --rubrics shader_vN,shader_vN+1`.
+ Keep the turn only if Spearman rises and the mean moves toward the eye mean; look at the
+ biggest remaining disagreements before believing it.
+4. **Switch** `TRACK_INFO` and re-run one small battery (`graphics_v2_flash`, 10 prompts) so
+ the refine loop optimises toward the new judge; compare the sheets, not just the numbers.
+5. **Reference photos** for any prompt that names a real phenomenon or place: drop them in
+ `bench/refs/<id>/` — the agent and the judge both see them; nothing else changes.
+6. Record the turn in this file (§5) and EVAL.md §6 with the numbers.
+
+Things this loop will not fix and should not try to: the judge model's own taste (use n=2 and
+pro), planner must items that are wrong (they cap at 0.7 now; the fix is the planner prompt),
+and generator capability (a better rubric makes flash's ceiling visible, it does not raise it).
+
+## 5. Turns recorded
+
+| date | rubric | n runs | Spearman(judge, eye) | judge mean | eye mean | note |
+|---|---|---|---|---|---|---|
+| 2026-08-26 | shader_v1 (loop-time scores) | 17 | 0.16 | 0.773 | 0.550 | before any turn |
+| 2026-08-26 | shader_v1 (re-judged, pro n=2, no acceptance) | 17 | *pending* | | | `bench/out/judge_calib_graphics/summary.md` |
+| 2026-08-26 | shader_v2 (re-judged, pro n=2, no acceptance) | 17 | *pending* | | | same run |