Communitygithub.com

keepprogress/blender-lookdev

Use when building or iterating a procedural Blender 5.x Cycles scene (volumetric light, fog, god rays, lookdev) by script and you must verify each change with numbers. Defines the measure → change one thing → 1/4-res preview → check → (one failed fix → look up an expert source) loop. 用 Blender 5.x Cycles 純 Python 做光霧/光柱/look-dev 並要用量測驗收時使用。

blender-lookdev 是什么?

blender-lookdev is a Claude Code agent skill that use when building or iterating a procedural Blender 5.x Cycles scene (volumetric light, fog, god rays, lookdev) by script and you must verify each change with numbers. Defines the measure → change one thing → 1/4-res preview → check → (one failed fix → look up an expert source) loop. 用 Blender 5.x Cycles 純 Python 做光霧/光柱/look-dev 並要用量測驗收時使用。.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/keepprogress/dyson-sphere-lookdev/tree/HEAD/.claude/skills/blender-lookdev

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

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 in tools/measure*.py, tools/round.sh, tools/acyaml.py. These, plus controls/, tools/test_metrics.sh, tools/independent_check.sh, and the guard itself, are protected paths.
  • Gatekeeper: tools/guard.py (git hook installed in tools/hooks, also run by CI). First read the rules in python3 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 line Reason: … (at least 10 characters); the message must not contain PASS/pass/all_pass; cannot simultaneously modify stages/, rounds/, evidence/; changing acceptance/stageN.yaml requires bumping version and tagging ac-stageN-vM.
  • ac_hash: python3 tools/guard.py hash N is the hash of the stage's standards and measurement pipeline. measure.py writes 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 status shows each stage's current status: PASS/FAIL/RESET.
  • A commit claiming ALL PASS must also include rounds/NN.json containing stage, a valid ac_hash, and all_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, with EXPECT_FAIL declared in the file, using OVERRIDES (overriding constants) or patch(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 to rounds/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 to rounds/independent-stageN.md.

Techniques learned from Stage 2 (geometry)

  • One instance of light and fog, injected into geometry. stages/02_geometry.py only defines build_shell(), then uses runpy.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_icosphere as 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 using atan2, 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 = -1 grows inward), Bevel (limit_method = "ANGLE" bevels only sharp edges, Clamp Overlap prevents 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 using matrix_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_uvsphere may 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 write stages/0N_*.py; each round tools/round.sh NN "one thing" N automatically re-runs all criteria from previous stages using the new scene (the round JSON for stageN contains stage1_rerun). Object naming avoids beam|ray|shaft (also Array, Tray trigger).

The loop (do this every round)

  1. Write down the "one thing" to change this round and the expected result (into rounds/NN.md or a commit draft). Do not change two variables at once.
  2. Modify the script (only stages/NN_*.py; light and fog constants at the very top of the script).
  3. 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).
  4. Measurement content (tools/measure.py, all thresholds from acceptance/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.
  5. Compare against acceptance: use acceptance/stageN.yaml (checklists/light-fog.md §E is a human-readable explanation). Per-item PASS/FAIL and ac_hash are written by measure.py into rounds/NN.json, do not modify manually.
  6. 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.
  7. 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 run python3 tools/guard.py check-staged-nomsg for a self-check. Round commits only contain stages/, 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:
    1. Check if checklists/light-fog.md has a corresponding rule with source;
    2. 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);
    3. Write the "found URL + one-line practice" into checklists/lookup-log.md and the commit message, then act.
  • 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 is BLENDER_EEVEE).
  • Since 5.0, volumes default to unbiased (null scattering); volume_step_rate / volume_max_steps are 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 for evidence/.

相关技能