Skip to content

Commit 82e80b9

Browse files
authored
feat: add lod-decimate-chain example witnessing the modifier LOD contract (#76)
Game engines consume LOD chains, and the modifier-based chain is where AI-generated code drifts: baking the reduction into the base mesh, stacking ratios, or losing silhouette-critical extremes. A closed-form retro rocket evaluated at LOD0/1/2 through the depsgraph pins all three: non-destructive evaluation, ratio-bounded triangle counts, and bbox preservation. The Decimate API is stable across 4.5 LTS and 5.1; the example demonstrates that by producing identical measured values on both, and documents the aggressive-ratio nose-tip collapse as the caught silhouette failure mode. Signed-off-by: fOuttaMyPaint <TMhospitalitystrategies@gmail.com>
1 parent bd2ca4e commit 82e80b9

12 files changed

Lines changed: 1205 additions & 3 deletions

File tree

.cursor-plugin/plugin.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"examples/gn-sdf-remesh",
7373
"examples/grease-pencil-rosette",
7474
"examples/image-pixels-testcard",
75+
"examples/lod-decimate-chain",
7576
"examples/parent-inverse-orrery",
7677
"examples/png-exr-alpha",
7778
"examples/shader-node-group",

.github/workflows/blender-smoke.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,14 @@ jobs:
382382
# bindings within float tolerances. Exits non-zero on failure.
383383
xvfb-run -a "$BLENDER" --background \
384384
--python examples/gltf-export-roundtrip/gltf_export_roundtrip.py --
385+
386+
- name: Shipped example - LOD decimate chain (depsgraph + ratio bounds)
387+
run: |
388+
set -euo pipefail
389+
# Check only (no render): a lathed retro rocket evaluated at LOD0/1/2
390+
# through the Decimate modifier; asserts closed-form base topology and
391+
# bbox, evaluated-vs-original non-destructiveness (obj.data unchanged),
392+
# evaluated triangle counts within 5% of ratio*base, and silhouette
393+
# (bbox) preservation within 1e-3. Exits non-zero on failure.
394+
xvfb-run -a "$BLENDER" --background \
395+
--python examples/lod-decimate-chain/lod_decimate_chain.py --

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</p>
1919

2020
<p align="center">
21-
<strong>12 skills</strong> &nbsp;&bull;&nbsp; <strong>6 rules</strong> &nbsp;&bull;&nbsp; <strong>2 templates</strong> &nbsp;&bull;&nbsp; <strong>17 snippets</strong> &nbsp;&bull;&nbsp; <strong>24 examples</strong>
21+
<strong>12 skills</strong> &nbsp;&bull;&nbsp; <strong>6 rules</strong> &nbsp;&bull;&nbsp; <strong>2 templates</strong> &nbsp;&bull;&nbsp; <strong>17 snippets</strong> &nbsp;&bull;&nbsp; <strong>25 examples</strong>
2222
</p>
2323

2424
<p align="center">
@@ -36,7 +36,7 @@
3636

3737
## Overview
3838

39-
This repository ships **12 skills, 6 rules, 2 templates, 17 snippets, and 24 runnable examples** for Blender Python development targeting Blender 5.1 (current stable) with Blender 4.5 LTS fallback support.
39+
This repository ships **12 skills, 6 rules, 2 templates, 17 snippets, and 25 runnable examples** for Blender Python development targeting Blender 5.1 (current stable) with Blender 4.5 LTS fallback support.
4040

4141
The content is consumed by AI coding agents (Cursor, Claude Code, any MCP-capable client) when working on Blender add-ons, geometry nodes scripts, batch pipelines, or animation tooling. There is no build step. Edit the markdown and Python files directly.
4242

@@ -466,7 +466,7 @@ round-trips through the raw `POINT` buffer.
466466
</details>
467467

468468
<details>
469-
<summary><strong>Game asset pipeline</strong> — 1 example</summary>
469+
<summary><strong>Game asset pipeline</strong> — 2 examples</summary>
470470

471471
<table>
472472
<tr>
@@ -485,6 +485,23 @@ loop), V-flipped UVs, and per-triangle material bindings — all against the
485485
depsgraph-evaluated mesh. The exporter/importer RNA signatures are probed
486486
byte-identical on 4.5.11 and 5.1.2 and guarded against future renames.
487487

488+
</td>
489+
</tr>
490+
<tr>
491+
<td width="46%" valign="middle">
492+
<a href="examples/lod-decimate-chain/"><img src="examples/lod-decimate-chain/preview.webp" alt="LOD decimate chain: three retro rockets side by side on a dark studio floor - cream body, red nose and fins, teal porthole - showing smooth LOD0, halved LOD1, and visibly crunched LOD2 with a hexagonal porthole" /></a>
493+
</td>
494+
<td valign="middle">
495+
496+
### [lod-decimate-chain](examples/lod-decimate-chain/)
497+
498+
One recognizable asset at three LODs via `DECIMATE` modifiers evaluated through
499+
the depsgraph. Asserts the reduction is non-destructive (the original datablock
500+
keeps its closed-form counts), each LOD's evaluated triangle count lands within
501+
5% of `ratio x base` (measured 0.0–0.44%), and the silhouette-critical bbox
502+
survives within 1e-3 — with the aggressive-ratio nose-tip collapse documented
503+
as the caught failure mode.
504+
488505
</td>
489506
</tr>
490507
</table>

ROADMAP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ Not committed; target list for the next content version. (v0.3.0 shipped the smo
104104
- Light-linking collection witness: object light linking / receiver collections so a key illuminates only the hero (common AI miss when staging multi-light studios)
105105
- ~~VSE sequences-to-strips witness~~ **SHIPPED** as `examples/vse-cut-list/``.sequences` removed on 5.x (4.5 bridges to `.strips`), `new_effect` end kwarg `frame_end=` (4.5) vs `length=` (5.x), `frame_final_*` deprecated in favor of `left_handle`/`right_handle`/`duration`, TRANSFORM effect type removed, GAMMA_CROSS clamps to the source overlap, effect strips consume inputs only when stacked above them, same-scene scene strips render transparent; save/reload round-trip + tiny-render pixel witness
106106
- ~~glTF export round-trip witness~~ **SHIPPED** as `examples/gltf-export-roundtrip/``export_yup` bakes `(x,y,z)→(x,z,−y)` into vertex data with no node rotation (probed identical on 4.5.11 and 5.1.2), `export_apply` ships the evaluated mesh (one disk vertex per evaluated loop), TEXCOORD_0 is V-flipped on disk, per-triangle material bindings survive; exporter/importer RNA signatures byte-identical between 4.5.11 and 5.1.2 (guarded against future renames); `Mesh.calc_normals()` removal on 5.x surfaced during authoring
107+
- ~~LOD decimate chain witness~~ **SHIPPED** as `examples/lod-decimate-chain/` — Decimate COLLAPSE evaluated through the depsgraph is non-destructive (obj.data keeps closed-form counts), evaluated tris hit `ratio × base` within 5% (measured 0.0–0.44%), silhouette bbox survives within 1e-3 (measured 7.7e-6); a stacked Decimate halves the effective ratio, an aggressive 0.02 ratio collapses the nose tip — both caught failure modes
107108
- GAMMA_CROSS blend-curve witness: the cross blend is not the naive linear mix (mid-cross measured (0.341, 0.349, 0.463) from crimson (0.85, 0.10, 0.22) and teal (0.06, 0.75, 0.80)) — derive and assert the gamma-space closed form per frame; follow-up to `vse-cut-list`
108109
- Falsy `bpy_prop_collection` trap snippet: an empty collection is falsy, so `editor.strips or editor.sequences` silently falls through to the legacy accessor on an empty timeline — always branch on `hasattr`; likely generalizes across the API (found authoring `vse-cut-list`)
109110

15.7 KB
Loading
38.4 KB
Loading

docs/gallery/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,17 @@ <h2><a href="gltf-export-roundtrip/">gltf-export-roundtrip</a></h2>
469469
<a class="card-link" href="gltf-export-roundtrip/">View example <span aria-hidden="true">&rarr;</span></a>
470470
</div>
471471
</article>
472+
<article class="card" data-tags="depsgraph mesh">
473+
<a class="card-media" href="lod-decimate-chain/" aria-label="lod-decimate-chain example detail page">
474+
<img src="assets/lod-decimate-chain-hero.webp" alt="lod-decimate-chain — A retro rocket at LOD0/1/2 via the Decimate modifier evaluated through the depsgraph." loading="lazy" decoding="async" />
475+
</a>
476+
<div class="card-body">
477+
<h2><a href="lod-decimate-chain/">lod-decimate-chain</a></h2>
478+
<p class="teaches">A retro rocket at LOD0/1/2 via the Decimate modifier evaluated through the depsgraph. The check proves the reduction is non-destructive, the triangle count hits ratio x base within bounds, and silhouette-critical dimensions survive.</p>
479+
<p class="witnesses"><span class="tag">witnesses</span> Evaluated-vs-original: the depsgraph carries the reduction while obj.data keeps the closed-form counts. A stacked Decimate halves the effective ratio (caught); an aggressive ratio collapses the nose tip (caught).</p>
480+
<a class="card-link" href="lod-decimate-chain/">View example <span aria-hidden="true">&rarr;</span></a>
481+
</div>
482+
</article>
472483
</div>
473484
</main>
474485
<footer>

0 commit comments

Comments
 (0)