blender-lookdev: self-iteration loop
Project rules file: checklists/light-fog.md (each rule with a source URL). Read it before starting.
The standard is locked: implementers must not move the goalposts
- Acceptance criteria (thresholds + measurement parameters) live in
acceptance/stageN.yaml; the measurement and rendering pipeline is intools/measure*.py,tools/round.sh,tools/acyaml.py. These, pluscontrols/,tools/test_metrics.sh,tools/independent_check.sh, and the guard itself, are protected paths. - Gatekeeper:
tools/guard.py(git hook installed intools/hooks, also run by CI). First read the rules inpython3 tools/guard.py. Do not modify guard/hooks/workflow/test_guard.py, do not use--no-verify, do not force push. - Commits that touch protected paths: first line
AC-CHANGE: …, body one lineReason: …(at least 10 characters); the message must not contain PASS/pass/all_pass; cannot simultaneously modifystages/,rounds/,evidence/; changingacceptance/stageN.yamlrequires bumpingversionand taggingac-stageN-vM. - ac_hash:
python3 tools/guard.py hash Nis the hash of the stage's standards and measurement pipeline.measure.pywrites it into every round JSON. If any protected measurement file changes, the hash changes, and old PASS results are automatically invalidated — must re-run.python3 tools/guard.py statusshows each stage's current status: PASS/FAIL/RESET. - A commit claiming ALL PASS must also include
rounds/NN.jsoncontainingstage, a validac_hash, andall_pass: true. - When measurements fail, the order is: first suspect the scene, following the failure rules below. Only when the control group proves the measurement method cannot distinguish good from bad should you change the standard, and that must be a separate AC-CHANGE commit with a clear Reason explaining why the old method fails to distinguish; do not adjust thresholds just to make the scene pass.
Control group and independent verification
- Control group (
controls/stageN/*.py): each criterion has at least one deliberately broken counterpart, withEXPECT_FAILdeclared in the file, usingOVERRIDES(overriding constants) orpatch(bpy, scene)(modifying the scene) to produce a bad version. They run through the exact same pipeline as official rounds, no separate judgment. tools/test_metrics.sh N: runs all control groups plus one reference scene, listing "whether each expected FAIL criterion actually FAILs". Exits non-zero if any criterion cannot be distinguished. Must run after adding or modifying criteria. Results written torounds/controls-stageN.md, and also note coincidental distinctions (e.g., barely different, or relying on two values being exactly equal).tools/independent_check.sh <commit>: in a temporary worktree, re-renders and re-measures from scratch, comparing against the latest round JSON of that commit (judgment match, same ac_hash, numerical difference < 5%). Run once on the final commit at the end of a stage; results written torounds/independent-stageN.md.
Techniques learned from Stage 2 (geometry)
- One instance of light and fog, injected into geometry.
stages/02_geometry.pyonly definesbuild_shell(), then usesrunpy.run_path("stages/01_godrays.py", init_globals={"build_shell": ...})to execute Stage 1; light, fog, and camera constants live in one place, no duplication. - Bmesh face creation:
bmesh.ops.create_icosphereas a skeleton, then for each vertex, the centers of its adjacent triangle faces form a dual plate (hexagon/pentagon); corner points are ordered counterclockwise around the normal usingatan2, so the normal points outward. Shrinking the plate toward its center creates seams. API: https://docs.blender.org/api/current/bmesh.ops.html - Thickness and bevel via modifiers: Solidify (
offset = -1grows inward), Bevel (limit_method = "ANGLE"bevels only sharp edges,Clamp Overlapprevents overlap). Manual: https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/bevel.html , https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/solidify.html - Instancing: Ribs have only one mesh, placed in a collection not linked to the scene; each seam gets an Empty with
instance_type = "COLLECTION", positioned/directed/scaled usingmatrix_world(including scaling along X). 1421 ribs share 1 mesh data. Manual: https://docs.blender.org/manual/en/latest/scene_layout/object/properties/instancing/collection.html , https://docs.blender.org/manual/en/latest/modeling/geometry_nodes/instances.html - Fixed seed: Random numbers come only from
random.Random(seed). In this project, experiments show:bmesh.ops.create_uvspheremay produce different face order and triangulation across runs (though vertices are identical), so "determinism" for verification must use geometry hashes independent of order, not bitwise index comparison. - Holes should be large and sparse. Random small holes per face caused god rays to blur (Stage 1 godray structure between 1.7–2.1); switching to a few full circular openings gave 2.3–4.4.
- Small protrusions must stand fully on the surface. When ribs were embedded 0.01 into the plate with only 0.014 exposed, clay render's small-scale energy was only 1.08; after full 0.024 section exposure, it reached 1.60 (this project's empirical finding, not documented in the manual).
- Measurement imposes requirements on construction: panels and ribs must be separate mesh islands, ribs must be straight strips. See weakness list in
rounds/controls-stage2.md. - Starting from Stage 2: first write measurements and control group and tag (
ac-stageN-vM), then writestages/0N_*.py; each roundtools/round.sh NN "one thing" Nautomatically re-runs all criteria from previous stages using the new scene (the round JSON forstageNcontainsstage1_rerun). Object naming avoidsbeam|ray|shaft(alsoArray,Traytrigger).
The loop (do this every round)
- Write down the "one thing" to change this round and the expected result (into
rounds/NN.mdor a commit draft). Do not change two variables at once. - Modify the script (only
stages/NN_*.py; light and fog constants at the very top of the script). - Render a 1/4 resolution preview and measure:
tools/round.sh NN "one thing this round" [STAGE](480×270, headless; one command renders all comparison images and measures). - Measurement content (
tools/measure.py, all thresholds fromacceptance/stageN.yaml): outputs a JSON containing at least: average brightness, overexposure ratio (excluding stars), beam region brightness (with/without shell), background brightness variance (noise on/off), list of emissive objects, render seconds. The same round must also render the "shell-hidden" A/B; no A/B means not passing. - Compare against acceptance: use
acceptance/stageN.yaml(checklists/light-fog.md§E is a human-readable explanation). Per-item PASS/FAIL andac_hashare written bymeasure.pyintorounds/NN.json, do not modify manually. - You personally inspect the images (read the PNGs). If numbers pass but the image is gray blur, fake god rays, dead blue, it is FAIL, and write down observations.
git commit, message format:round NN: <one thing> | mean=0.xxx clip=x.xx% beam_ab=PASS/FAIL fog_var=x.x t=x.xs | <one-sentence conclusion>Before committing, you can runpython3 tools/guard.py check-staged-nomsgfor a self-check. Round commits only containstages/,rounds/,evidence/; do not include protected files.
Failure rules (hard constraints)
- Same defect, first fix fails → stop, do not tweak the same number again. First consult expert practices:
- Check if
checklists/light-fog.mdhas a corresponding rule with source; - If not found or already tried → consult primary sources (Blender 5.3 manual, developer.blender.org release notes, Blender Studio, well-known artist articles, Blender StackExchange);
- Write the "found URL + one-line practice" into
checklists/lookup-log.mdand the commit message, then act.
- Check if
- If still failing after following the lookup: mark this defect as "needs human review", clearly state what was tried and looked up, stop and report, do not continue blind testing.
- New effective practices must be added to
checklists/light-fog.md(with URL) — this is the loop's "learning".
Other hard constraints
- Verify Blender attribute names with
dir()first (5.x differs from 4.x; e.g., EEVEE identifier isBLENDER_EEVEE). - Since 5.0, volumes default to unbiased (null scattering);
volume_step_rate/volume_max_stepsare meaningful only in Biased mode. - Do not copy code or structure from any unauthorized repository (e.g., mechanical-moon); use sources only to learn principles.
- Preview ≤ 5 seconds; if exceeded, first use Render Time pass and per-item toggles to diagnose, do not reduce quality prematurely.
- Do not write model-facing time limits like "you have five minutes"; use scope constraints ("this round only change fog density").
- Do not install Toggle Studio / ToggleOps MCP; do not enable always-allow or bypass permission modes.
- Each round's artifacts go into
rounds/; large images are not tracked by git, only small PNGs (< 300 KB) selected forevidence/.