Skip to content

feat: add high-to-low tangent normal bake skill, snippets, and example - #140

Open
TMHSDigital wants to merge 1 commit into
mainfrom
feat/bake-high-to-low
Open

feat: add high-to-low tangent normal bake skill, snippets, and example#140
TMHSDigital wants to merge 1 commit into
mainfrom
feat/bake-high-to-low

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

Summary

  • Skill bake-high-to-low, three snippets, and smoke-gated example bake-normal-high-to-low (closes the baking sub-track; UV/atlas and template integration stay unpinned).
  • Contract: a Cycles CPU cage bake from a ribbed hatch onto a DECIMATE COLLAPSE LOD is measurably not flat; the same bake from an undisplaced source is. --flat-source is the falsifier.
  • Byte-identity across 4.5 / 5.1 / 5.2 is not this example's contract. Cycles bake is stochastic (tile order, float accumulation) even at one CPU sample. The assertion form is statistical because the process is statistical, not because the example is weaker than AABB/count witnesses.

RNA (live-run-proven)

bpy.ops.object.bake.get_rna_type() dumped on all three local binaries: 22 properties, identical identifiers and enums. No shim. Pass type is type='NORMAL', not bake_type. cage_object is a string name.

Verified docs:

Bundled MCP RST for bpy.ops.object.bake matches the dump (type, use_selected_to_active, cage_extrusion, use_cage, cage_object, normal_space='TANGENT', margin, margin_type). Inspection of the RST plus live dump.

Tolerances (live-run-proven)

Euclidean distance from flat tangent (0.5, 0.5, 1.0); a pixel is deviant if distance > 0.04.

Gate Floor/ceiling Measured (all three versions this run) Why
Detail frac >= 0.40 0.7211 Half the measured hatch coverage; blank/inactive-node maps sit at 0.00
Detail MAD >= 0.05 0.09356 Half the measured hatch MAD; still ~30× a flat bake
Flat frac <= 0.05 0.0000 Tessellation-only bake must not look like the ribbed source
Flat MAD <= 0.03 0.00277 Noise band, not sculpt
Monotonic gap >= 0.30 0.7211 A tolerance that also passed --flat-source would have no power

--flat-source measured frac=0.0000 mad=0.00277 and cannot pass frac >= 0.40. Discriminating power is not a tuning accident.

--flat-source falsifier (live-run-proven)

Same check path, undisplaced high, still asserts the detail gates. All three binaries:

ERROR: detail frac 0.0000 < 0.4 (map is too close to flat tangent; --flat-source is the designed fail for this gate)
bake_stats source=flat-source frac=0.0000 mad=0.00277 thresh=0.04
EXIT=5

4.5.11, 5.1.2, 5.2.1 all exit 5.

Added smoke wall-clock (live-run-proven)

Check-only (what CI runs). Stopwatch around blender.exe --background --python … (includes Blender startup):

Binary Version Exit Elapsed
.scratch/blender-4.5.11-windows-x64/blender.exe 4.5.11 LTS 4db51e9d1e1e 0 734 ms
.scratch/blender-5.1.2-windows-x64/blender.exe 5.1.2 ec6e62d40fa9 0 1052 ms
.scratch/blender-5.2.1-windows-x64/blender.exe 5.2.1 LTS 9e2066aef7ef 0 1149 ms

None of the three grows a smoke job by ~90 s. None approaches three minutes. Bake is 256×256, 1 sample, CPU, no denoiser.

--output framing (not CI): fill x=0.809 / y=0.667 on 4.5.11, 5.1.2, and 5.2.1; exit 0.

Local binaries

  • E:\Blender-Developer-Tools\.scratch\blender-4.5.11-windows-x64\blender.exe → 4.5.11 LTS (4db51e9d1e1e)
  • E:\Blender-Developer-Tools\.scratch\blender-5.1.2-windows-x64\blender.exe → 5.1.2 (ec6e62d40fa9)
  • E:\Blender-Developer-Tools\.scratch\blender-5.2.1-windows-x64\blender.exe → 5.2.1 LTS (9e2066aef7ef)

Snippets

Three files, not a fold: save_baked_image.py exists because Image.save() on a GENERATED bake drops the buffer (image-pixels-testcard). That trap is its own contract.

Contact sheet (live-run-proven pixels, inspection verdict)

Committed: docs/gallery/contact-sheets/bake-normal-high-to-low-contact-sheet.webp vs pinned armature-bend, damped-track-aim, bmesh-gear.

Criterion Verdict
Stage darkness Pass — near-black floor/wall
Wedge warmth Pass — warm key on the bronze plate
Subject fill Pass — framing helper x=0.809 in band
Saturation Pass — bronze vs periwinkle card
Thumbnail legibility Pass — six lobes + eight rivets read at 640 px
Mean luma Candidate 90.4; calibration 70.8 / 44.5 / 77.7. The unlit nrm card is inherently light ((128,128,255) is the flat color). Stage around it stays dark.

Not an asset-kit example; no asset-sheet.

Evidence labels

Claim How
Bake RNA identical 4.5.11 / 5.1.2 / 5.2.1 Live-run dump
Detail/flat stats and --flat-source exit 5 Live-run all three binaries
Check-only wall-clock Live-run stopwatch
Framing fill/margins Live-run gallery_framing on --output all three
Gallery HTML alts / witnesses callout Inspection of generated docs/gallery/index.html and docs/gallery/bake-normal-high-to-low/index.html after build_gallery.py
5.1 CI smoke CI-proven once needs-5.1 is applied (this PR). Local 5.1.2 is supporting, not a substitute.
4.5 / 5.2 CI smoke CI on this PR; local runs are supporting

Out of scope

UV transfer / atlas (Phase 7). templates/ai-asset-pipeline-template/ (Phase 8). Agent bridge. #131, #138, LICENSE, VERSION, CHANGELOG.md, release.yml, smoke matrix/cron/push, existing 55 examples, any exit-code renumber.

Test plan

  • Validate / drift-check / Socket
  • blender-smoke 5.2 LTS
  • blender-smoke 4.5 LTS
  • blender-smoke 5.1 (needs-5.1 applied via REST; auto-label does not add it)
  • Confirm catalog row is check-only (no --output)

Cycles cage-bake is stochastic and CI is CPU-only, so the witness uses
tolerance gates and a --flat-source falsifier rather than byte-identity.

Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@TMHSDigital TMHSDigital added the needs-5.1 Opt-in Blender 5.1 smoke on this PR. Default matrix stays 4.5 + 5.2. Auto-label will not apply this. label Sep 12, 2026
@github-actions github-actions Bot added snippets documentation Improvements or additions to documentation labels Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation needs-5.1 Opt-in Blender 5.1 smoke on this PR. Default matrix stays 4.5 + 5.2. Auto-label will not apply this. skills snippets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant