Bookshelf

showcase/bookshelf/

A procedural bookcase — two housed shelves, a base on a recessed plinth, lapped back boards and a stepped cornice, filled with thirty-eight rounded-spine hardbacks standing, stacked and leaning — carried through UVs, bake, LOD, convex collider, and Unity glTF, asserting recomputed budgets rather than an API contract.

Rendered headless by the showcase piece itself. Select it to enlarge.

witnesses Recomputed: 10908 tris, five materials with 338 wood, 2050 cloth, 1066 leather, 228 paper and 1976 gilt faces, UVs in 0..1 with zero AABB overlap, outer AABB 0.972×0.332×1.176 m, zmin 0, hygiene 0 including zero coplanar cross-shell pairs, both sides on the floor, four cross members 8 mm into both sides, 38 books each with one page block 0.6 mm into its boards and two gilt bands 0.3 mm into the spine and 0.8 mm proud, every book seated 1.0–3.2 mm, 44 mm headroom, thickness and height spread 2.90 and 1.65, both leaning books 0.8 mm onto their neighbour's head edge, zero unplanned book overlaps, zero right-angle wood edges, convex collider 68 tris. --air-lean and --deep-lean exit 22 on the lean contact while every seat, the envelope and the overlap budget still pass; --crowd-books exits 23; --uniform-books 21; --tall-book 20.

category Village

tags mesh export showcase

blender --background --python showcase/bookshelf/bookshelf.py --

A bookcase: a stained carcass with two shelves housed in its sides, a base on a recessed plinth, lapped back boards and a stepped cornice, filled with thirty-eight hardbacks. Twenty-nine stand upright, seven lie in three stacks, and two lean on a neighbour. Every book is a rounded-spine cover in cloth or leather, a page block glued into it, and two gilt bands tooled round the spine. A showcase piece, not an example — it witnesses no API contract. It asserts that generated geometry meets declared asset budgets, recomputed from the finished mesh.

What it composes#

Shipped contentUsed for
skills/mesh-editing-and-bmeshchamfered boards, U-section covers with rounded spines, page blocks and bands built on the spine's own chain, all in bmesh
skills/custom-propertiesface attributes (PlankTone, GrainDir, Tint) read by the shaders
skills/procedural-materials-and-shadersgrained stain, cloth, leather, ruled page edges, gilt
skills/bake-high-to-lowCycles tangent-space normal bake, high onto low
skills/engine-export-presetsUnity glTF (export_yup=True)
skills/depsgraph-and-evaluated-dataevaluated triangle counts for the LOD ratios
snippets/decimate_to_budget.pyLOD1 / LOD2 COLLAPSE chain
snippets/convex_hull_collider.pyone hull over the carcass
snippets/lod_chain.pyLOD naming and ratio pattern
examples/mesh-hygiene-audithygiene combinatorics (copied, not imported)

The budget that matters#

A leaning book has to rest on its neighbour's head edge and on the shelf, not in either. Tip it a few degrees too far and its board cuts through the neighbour's corner; not far enough and it stands in the air against nothing. Neither is visible to any other budget:

The piece finds the leaning books on the finished mesh (a book whose largest face, a board, is tilted between 3° and 80°) and the upright neighbour on the side its top leans toward, on the same shelf. It takes the plane of the leaning board's outer face off the mesh and measures how far the neighbour's deepest vertex sits behind it, as a band of 0.3–2.0 mm. Both lean at 0.80 mm.

A plane, not the cover solid: the board is 2.8 mm thick, and a head edge driven right through it lies in the hollow of the book, outside the cover again, so a solid test reads a deep cut as no contact at all. That is how the first --deep-lean passed.

--air-lean and --deep-lean are the falsifiers built for exactly this. One stops each leaning book 3 mm short of its neighbour, the other drives it 4.5 mm in. Both exit 22 while every seat, the envelope and the book overlap budget still pass.

Budgets#

Declared in the script as named constants, recomputed from the generated mesh. Measured values are from Blender 5.2.1; see the cross-version table below.

BudgetBandMeasured
Base triangles10400–1140010908
LOD1 ratio0.32–0.620.5000
LOD2 ratio0.10–0.350.2189 (0.2198 on 4.5 and 5.1)
Material slotsexactly 5, distinct5
Wood / cloth / leather faces≥ 300 / 1850 / 960338 / 2050 / 1066
Paper / gilt faces≥ 200 / 1780228 / 1976
UV boundsinside 0..1(0.0004, 0.0004)–(0.9996, 0.9996)
UV AABB overlap≤ 1e-50.000000
Outer AABB0.972 × 0.332 × 1.176 m ± 0.0200.9720 × 0.3320 × 1.1760
Collider triangles≤ 20068
Normal bake{'FINISHED'} with image data{'FINISHED'}, has_data=True
glTF exportfile written, non-empty~786 kB
Hygieneall zeroloose 0/0, non-manifold 0, zero-area 0, doubles 0, n-gons 0, coplanar cross-shell pairs 0
Grounded AABB\zmin\≤ 1e-40.00000
Named sides2 sides, each zmin ≤ 1e-42 at 0.00000
Dado4 cross members, each ≥ 5 mm into both sides and ≥ 6 mm clear of the far face8.00 mm in, 14.00 mm clear
Page block38 books, one block and two bands each; every block corner 0.3–1.2 mm inside its boards0.60 mm
Book seat38 books, each 0.5–3.6 mm into the shelf or the book it stands on1.00–3.16 mm
Band seatinner face 0.1–0.8 mm inside the spine, outer face ≥ 0.4 mm proud0.29 mm in, 0.80 mm proud
Headroomevery book ≥ 20 mm under the member above44.36 mm
Size spreadthickest / thinnest ≥ 2.5; tallest / shortest ≥ 1.52.900 / 1.645
Lean contact2 leaning and 7 lying books; each neighbour's head edge 0.3–2.0 mm behind the leaning board0.80 mm
Book overlaps0, book against book and against the carcass, designed contacts exempt0
Edge treatmentright-angle wood edges0

Real-world size: 0.97 m wide over the cornice, 1.18 m tall and 0.33 m deep. Each compartment is 318–348 mm clear, and the books run from a 186 mm octavo to a 305 mm folio.

Construction#

Findings the budgets forced#

Conventions walked#

Every convention in showcase/README.md, and whether it applies here.

ConventionAppliesHow
Deterministic, budgets declared, assertions recomputeyesno RNG; every value above is read off the mesh
Falsifier fails the budget it targetsyestable below, proven on all three binaries
Hygiene incl. cross-shell coplanaryesexit 15; square, yaw cycle, front-plane step and stack seat chosen to keep it at 0
Named supportsyesthe two sides (--float-side); the plinth stops 4 mm off the floor
Joint-fit budgetsyesdado bite and far-face clearance per cross member (--short-shelves)
A member is tenoned into its seatyestop over sides and back boards, cornice into the top, back boards into the base
A platform bears on somethingyesevery shelf housed in both sides and biting the back boards
Carried parts bite their bearersyesbooks into shelves and into the book below (--float-books)
A joint bites; touching is not joiningyespage blocks into their boards (--loose-pages); the lean contact as a band
Bands on a curved host are built on the host's arcyesgilt bands on the spine's own chain (--float-bands)
A leaning prop rests on somethingyesthe lean contact, exit 22 (--air-lean, --deep-lean)
Scattered parts do not interpenetrateyesexit 23 (--crowd-books), designed contacts exempt and counted
Scatter varies in sizeyesthickness and height spread, exit 21 (--uniform-books)
The subject hangs where it can be seen / headroomyesevery book under the member above, exit 20 (--tall-book)
Edge treatment: no right anglesyesexit 24 (--sharp-shelf), wood only; covers chamfered 0.8 mm by construction
Aim an edge falsifier at one memberyesone shelf left square: 12 edges
Sort bmesh operator inputsyesbevel edges sorted by index, carcass and covers
A plank wall is boardsyesfive lapped back boards
Identical boards read as CGyesper-board PlankTone and GrainDir; per-book Tint
Variation goes into surface, never into functionyessizes, tints, gaps and yaw vary; shelf pitch and seats are budgets
Shading is part of the modelyesspines smooth (round); every edge over 35° hard, so boards and chamfers read crisp
One substance, one slotyeswood, cloth, leather, paper, gilt
Iron is not chromen/ano iron; gilt is half metallic, roughness 0.45
Bake texels per UV cellmeasured, not a budget1024 px over a 76-cell grid, about 13 px per cell
The bake cage is narrower than the nearest neighbouryesCAGE_EXTRUSION 0.01 m
Level on the stage; stage 60 myesturned about Z only; 60 m floor and wall
Keep a falsifier's envelope stillyesevery falsifier leaves the AABB unchanged
Mirror symmetry, plumb, rope, masonry, roofs, rings, terrain, vesselsnothe piece has none of these

Falsifiers#

Each breaks one pipeline stage so a named budget fails. All fifteen were run on 4.5.11, 5.1.2 and 5.2.1 and exited the same declared code on all three.

FlagTarget budgetBreaksExit
--skip-decimateLOD1 ratiodrops the DECIMATE modifiers, LOD1 ratio goes to 1.00009
--stray-vertmesh hygieneadds one loose vertex inside the carcass15
--lift-zgrounded zminlifts the whole mesh 50 mm16
--float-sidenamed sideslifts the left side 5 mm; the right side still grounds the AABB16
--short-shelvesdado bitestops the two shelves 4 mm short of the sides; −4.0 mm17
--loose-pagespage-block bitebuilds every page block 0.9 mm clear of its boards; −0.9 mm17
--float-booksbook seatlifts every book 6 mm; −5.0 mm18
--float-bandsband seatbuilds every band 1.1 mm off its spine; −1.1 mm18
--tall-bookheadroomstretches one middle-shelf folio 1.20 into the shelf above; −3.9 mm20
--uniform-bookssize spreadone height and depth, thickness within ±1.5 %; 1.030 / 1.00021
--air-leanlean contactstops each leaning book 3 mm short of its neighbour; −3.0 mm22
--deep-leanlean contactdrives each leaning book 4.5 mm into its neighbour; 4.5 mm22
--crowd-booksbook overlapscloses the top shelf's gaps to −4.1 mm; 11 overlaps23
--sharp-shelfedge treatmentleaves the top shelf unchamfered; 12 right-angle edges24

Exit codes#

File-local and sequential. 9 is a valid check code. 1 is the FATAL wrapper — a crash, never a named check. 19 (plumb and real-world size) is reserved across pieces and unused here.

CodeMeaning
0Success
1Uncaught exception (FATAL wrapper)
2argparse / usage
3Mesh did not build, or has no UV layer
4Base triangle count outside band
5Material slots, or a material's face floor
6UVs outside 0..1
7UV AABB overlap above tolerance
8Outer AABB off declared size
9LOD1 or LOD2 ratio outside band (--skip-decimate)
10Framing gate (examples/gallery_framing.py, render path only)
11Collider triangles above ceiling
12Normal bake failed or produced no image data
13glTF export missing or empty
14--output produced no file
15Mesh hygiene (--stray-vert)
16Grounded zmin, or a side floating (--lift-z, --float-side)
17Dado or page-block bite, or a book without one block and two bands (--short-shelves, --loose-pages)
18Book or band seat (--float-books, --float-bands)
20Headroom under the member above (--tall-book)
21Size spread below floor (--uniform-books)
22Lean contact, or leaning / lying count (--air-lean, --deep-lean)
23Books overlap each other or the carcass (--crowd-books)
24Right-angle wood edges (--sharp-shelf)
25Gallery asset-quality violation (render path; the floors' 11 is remapped here)

Run it#

# Budget check, no render.
blender --background --python bookshelf.py --

# Falsifier: each leaning book stops short of its neighbour. Must exit 22.
blender --background --python bookshelf.py -- --air-lean

# Falsifier: each leaning book cuts into its neighbour. Must exit 22.
blender --background --python bookshelf.py -- --deep-lean

# Render the gallery still (EEVEE; --engine cycles on a GPU-less host).
blender --background --python bookshelf.py -- --output bookshelf.webp

Smoke runs the check-only path. It does not pass --output or any falsifier.

Cross-version measurements#

Value4.5.115.1.25.2.1
Base triangles109081090810908
LOD1 / LOD2 tris5454 / 23985454 / 23985454 / 2388
Face counts (wood / cloth / leather / paper / gilt)338 / 2050 / 1066 / 228 / 1976samesame
Outer AABB0.9720 × 0.3320 × 1.1760samesame
Collider tris686868
Headroom / spread / lean44.36 mm / 2.900, 1.645 / 0.80 mmsamesame
glTF bytes785836785836785828

LOD2 differs by ten triangles on 5.2 (DECIMATE COLLAPSE, the known divergence; the gate is a ratio band) and the glTF size by 8 bytes (exporter metadata, not a budget). Every other value is identical.

Source

showcase/bookshelf/bookshelf.py View the script on GitHub →
A stained wooden bookcase with three shelves of cloth and leather hardbacks with gilt spine bands, some standing, some stacked flat, and two leaning against their neighbours.