Cactus Garden

showcase/cactus-garden/

A procedural Sonoran cactus garden on a raised sand-and-gravel disc — a 2.2 m saguaro, a column of fourteen pleated ribs with rounded crests, three arms that leave the trunk through a smooth collar, run out and turn up, a corky boot and scars, cream flowers on its crown, and a row of felt areoles down every rib crest, each with a radiating spine cluster; a fishhook barrel cactus of eighteen ribs with a red hooked central spine at every areole and a ring of yellow fruit round its crown; a prickly pear of twelve broad sage paddles grown pad on pad in four tiers, each fused into the rim of the one below, dotted with glochids and carrying magenta fruit; a blue agave rosette, cleaved sandstone rocks, a sun-bleached branch, two fallen saguaro ribs, dry bunchgrass and gravel — through UVs, bake, LOD, 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: 45364 tris, ten materials with 3694 sand, 9332 skin, 13254 spine, 432 fruit, 976 flower, 481 agave, 1080 rock, 600 gravel, 666 wood and 1222 grass faces, UVs in 0..1 with zero AABB overlap, outer AABB 2.995×2.608×2.375 m read off the vertices, zmin 0, hygiene 0 including zero coplanar cross-shell pairs, all three saguaro arms biting 0.1154–0.1222 m into the trunk (band 0.080–0.160), all nine child pads fused 0.0297–0.0313 m into their parents' rims along their own axes (band 0.022–0.040), the saguaro plumb (lean 0.000°, cap 1°) with its mass 0.0012 m off its foot (cap 0.050), 2.2004 m tall (2.20 ± 0.05) and 0.3376 m across its crests (band 0.30–0.37), 14 trunk and 18 barrel ribs with a 0.000° crest-gap spread (cap 2°), all 898 spine clusters rooted 0.00363–0.00602 m under the skin (band 0.0030–0.0080), saguaro, barrel and root pads bedded 0.0498–0.0829 m in the sand (band 0.025–0.150) and 13 agave leaves 0.0424–0.0531 m (band 0.020–0.100), all 1118 shells joined to the sand, LOD ratios in band, sand collider 112 tris, non-empty glTF. --skip-decimate exits 9; --stray-vert 15; --lift-z 16; --short-arm 17; --shallow-pad 18; --lean-saguaro 19; --skew-ribs 20; --float-spines 21; --perch-barrel 22; --float-cover 23.

category Nature

tags mesh export showcase

blender --background --python showcase/cactus-garden/cactus_garden.py --

A showcase piece, not an example, and the fifth in the nature category. It builds a procedural, game-ready Sonoran cactus garden on a raised sand-and-gravel disc:

Every seeded draw comes from random.Random(SEED) in plan_garden(), before anything is built. Per-areole variety (spin, spine tilts and lengths) comes from a closed-form hash of the areole's indices, so no flag can shift it. Which pebble candidates are used is decided once against the default layout (Layout), which also refuses a pad that grows downward or a tuft off the disc.

Ten materials, one per substance: sand, cactus skin (saguaro, barrel and pads, told apart by a face zone), spine (spines, areole felt, hooked centrals and glochids), fruit, flower, agave, rock, gravel, dry wood (the branch, the fallen ribs and the saguaro's boot and scars) and dry grass. Point attributes carry what the shaders need: Rib (1 on a rib crest, 0 in a valley), Along (height up the saguaro, the run along a leaf, spine, petal or blade, a pad's radius) and Skirt (the disc's cut edge). A Tone face attribute is seeded per part. Gravel is flat-shaded, as chips; everything else is smooth-shaded, and every material boundary and every fold sharper than 60° (32° on the rocks, so each cleavage plane stays a broken face) is a hard edge.

It asserts budget conformance of the generated result. It does not witness an API contract. "It rendered without error" is not a check.

Composes skills mesh-editing-and-bmesh, bake-high-to-low, depsgraph-and-evaluated-data, engine-export-presets, and snippets bake_normal_high_to_low.py, setup_bake_target_image.py, lod_chain.py / decimate_to_budget.py, convex_hull_collider.py, export_preset_unity.py (helpers copied inline, not imported).

Intended size: a disc 3.00 × 2.61 m, its mound 0.14 m high, the saguaro's crown flowers 2.38 m off the floor. The outer AABB is 2.9950 × 2.6077 × 2.3754 m, read off the vertices. The sand sets X and Y, a crown flower the top; the sand's underside is the ground. The collider is the convex hull of the sand disc alone, coarse: players brush through the plants.

Budgets#

Every budget is declared as a named constant. Every gate recomputes its value from the mesh, materials, UVs, evaluated LOD, collider, or export file.

AxisDeclaredMeasured (5.2.1)
Base triangles44700–4600045364
LOD1 ratio0.32–0.62 of base0.5000
LOD2 ratio0.10–0.35 of base0.2200
Materialsexactly 10 distinct; ≥3400 sand, ≥8400 skin, ≥12100 spine, ≥420 fruit, ≥900 flower, ≥440 agave, ≥990 rock, ≥550 gravel, ≥610 wood, ≥1120 grass faces10 slots; 3694 / 9332 / 13254 / 432 / 976 / 481 / 1080 / 600 / 666 / 1222
UVsin 0..1, AABB overlap ≤ 1e-5in range, overlap 0
Outer AABB(2.9950, 2.6077, 2.3754) m ± 0.01(2.9950, 2.6077, 2.3754), zmin 0
Collider tris (sand hull)≤ 120112
Exportwritten, size > 0, removed after measuring3772228 / 3772228 / 3772220 bytes (4.5.11 / 5.1.2 / 5.2.1)

No falsifier changes the triangle count: every falsifier run measured 45364 tris. Only --lean-saguaro moves the envelope, by 6.5 mm in Z against a 10 mm tolerance, because it tips the flowers that set the top.

DECIMATE COLLAPSE triangle counts are not identical across Blender series, so the LOD gate is a ratio band, not an exact count. Bake pixels are stochastic, so the bake gate is has_data plus operator FINISHED, not byte-identity. The plan is seeded and nothing else is random; the geometry is pure Python math. Two default runs print identical measurements.

Hygiene#

Recomputed from the generated mesh, not asserted about the script.

AxisDeclaredMeasured
Non-manifold edges00
Loose verts / edges0 / 00 / 0
Doubles merged at 1e-500
Zero-area faces00
N-gons00
Coplanar cross-shell face pairs (KD range 0.05 m, plane ε 1e-4)00
Grounded: zminwithin 1e-4 of 00.0000

Nearly nine hundred spine clusters sit on straight vertical ribs, and a cluster translated straight up a rib keeps every face whose plane holds the vertical on the same plane. Each cluster is therefore turned about its own normal by a hashed spin, and each spine's tilt and length are hashed too, so no two clusters share a plane.

Arms, pads, the column, the ribs, the spines, the bedding and the cover#

These are the organic invariants. A cactus garden has no joinery, but a cactus is jointed all the same: a saguaro's arms grow out of its trunk, a prickly pear's pads grow out of each other, and every spine grows out of an areole in the skin. A saguaro stands plumb, its ribs stand at even stations round the column, and every plant stands in the sand, not on it.

AxisDeclaredMeasured
Arm joints: each arm's deepest vertex inside the trunk, measured radially from the trunk's axis at the vertex's own height (a ray out onto the trunk shell alone)3 arms, each 0.080–0.160 m3; 0.1154–0.1222 m
Pad joints: each pad's joint, the extreme vertex down its long axis (principal axis). A root pad's joint lies under the sand; a child's lies inside another pad (ray parity), and its seat is how far the child's axis runs on inside that pad before it leaves9 child pads, each 0.022–0.040 m9; 0.0297–0.0313 m
Saguaro: the trunk's axis through a low and a high slab's centroids, its lean; the mass centre of trunk and arms off the low slab's centroid in plan; the height from the sand at the foot to the crown; the crest diameter 1 m uplean ≤ 1°; mass ≤ 0.050 m off; height 2.20 ± 0.05 m; diameter 0.30–0.37 m0.000°; 0.0012 m; 2.2004 m; 0.3376 m
Ribs: the ring nearest 1 m up the trunk (measured in the trunk's own frame, turned upright about its axis) and the barrel's mid ring; the crests as local maxima of radius about the ring's centroid; the spread of the angular gaps between crests14 trunk and 18 barrel crests; spread ≤ 2°14 and 18; 0.000° and 0.000°
Spines: every spine cluster, hooked central and glochid tuft, its deepest vertex inside the skin of the cactus whose surface is nearest its centre (ray parity, distance to the nearest face)0.0030–0.0080 m898 clusters; 0.00363–0.00602 m
Bedding: the saguaro and the barrel, each body's most-buried vertex in each of eight sectors round its foot, under the sand straight above it, the shallowest sector; each root pad's joint under the sand; each agave leaf's lowest vertex under the sandbodies and root pads 0.025–0.150 m; 13 leaves, each 0.020–0.100 msaguaro 0.0829, barrel 0.0550, root pads 0.0498–0.0499 m; leaves 0.0424–0.0531 m
Cover joined: every shell unioned with the sand through BVH overlapsevery shell joined1118 shells; 0 loose

Two measurements needed care. A nearest face's normal is no witness of inside and outside near a thin pad's rim, where the nearest face can stand edge-on to the point: a joint vertex read 0.11 m "inside" a pad it was nowhere near. Every inside test is ray parity. And a leaning trunk's rings are cut obliquely by a horizontal slab, which biases the slab centroids a fifth of a degree; the rib budget groups a ring by gaps in height rather than by one exact height, so the tipped trunk, turned back upright, still shows whole rings.

Falsifiers#

Each falsifier violates one named budget. Every one was run on 5.2.1 and exited its declared code, and every other piece-specific budget stayed green on that run.

FlagBudget violatedExit
--skip-decimateLOD1 ratio band (measured 1.0000)9
--stray-vertloose vertex count is 0 (measured 1, placed inside the envelope)15
--lift-zbounding box zmin is 0 (measured 0.05000)16
--short-armarm joints (every arm drawn 70 mm out along its bearing, its collar still in the trunk: 0.0465–0.0545 m)17
--shallow-padpad joints (the top right pad slid 22 mm out of its parent's rim, still inside it: seat 0.0093 m)18
--lean-saguarosaguaro plumb and mass over its foot (the whole saguaro tipped 3.5° about its foot: lean 3.702°, mass centre 0.0606 m off)19
--skew-ribsribs at equal stations (one trunk rib turned 7° off its station: spread 13.908°)20
--float-spinesspines rooted (every cluster, hook and glochid lifted 3 mm off the skin, still touching it: 0.00096 m)21
--perch-barrelbedding (the barrel raised 35 mm, its foot still in the sand: shallowest sector 0.0200 m)22
--float-covercover joined (every pebble, grass blade, branch and fallen rib lifted 50 mm: 109 of 1118 shells loose)23

Each falsifier moves only what its budget measures, and none is sized past the point where a second budget would see it. --short-arm moves each arm rigidly, so its spines stay rooted, and its areoles are chosen by arc length along the arm, not by distance from the trunk, so the count does not change. --shallow-pad slides a pad that carries no pad, so no other seat moves. The lifts in --float-spines and --perch-barrel leave every part still touching its host, so the cover stays joined. --lean-saguaro passes the rib budget because that budget measures in the trunk's own frame.

Run#

blender --background --python cactus_garden.py --
blender --background --python cactus_garden.py -- --skip-decimate
blender --background --python cactus_garden.py -- --stray-vert
blender --background --python cactus_garden.py -- --lift-z
blender --background --python cactus_garden.py -- --short-arm
blender --background --python cactus_garden.py -- --shallow-pad
blender --background --python cactus_garden.py -- --lean-saguaro
blender --background --python cactus_garden.py -- --skew-ribs
blender --background --python cactus_garden.py -- --float-spines
blender --background --python cactus_garden.py -- --perch-barrel
blender --background --python cactus_garden.py -- --float-cover
blender --background --python cactus_garden.py -- --output cactus.png

Smoke passes no flags.

The hero keeps the piece unturned (HERO_YAW_DEG 0°) and looks in from the south-south-west, a little above the disc, so the saguaro stands at the back with an arm to each side, the barrel in front of it on the left, the pear clump behind the agave on the right. The fill is 0.506 × 0.883.

Exit codes#

File-local. 9 is a valid check code. 10 is reserved for gallery_framing.check_framing on the --output path. 15–19 are the hygiene, grounding, joint, seat and plumb family. 20–23 are file-local. 24 is the asset-quality floor on the render path: check_asset_quality returns 11, which this piece already spends on the collider ceiling, so the call site remaps it.

CodeMeaning
0Success
1Uncaught exception (FATAL wrapper)
2argparse / usage
3Mesh did not build, no UV layer, or no sand, trunk or barrel shell
4Base triangle count outside range
5Material count ≠ 10 distinct slots, or a face-count floor missed
6UVs outside 0..1
7UV AABB overlap above tolerance
8World AABB off declared outer size
9LOD ratio band (--skip-decimate lands here)
10Framing gate (render path only)
11Collider triangle count above ceiling
12Bake did not finish or image has no data
13Export file missing or empty
14--output produced no file
15Mesh hygiene: loose, non-manifold, zero-area, doubles, n-gons, coplanar cross-shell pairs
16Not grounded: bounding box zmin off 0 (--lift-z)
17Arm joints: not 3 arms, or an arm's deepest vertex inside the trunk outside 0.080–0.160 m (--short-arm)
18Pad joints: not 9 child and 3 root pads, or a child's seat outside 0.022–0.040 m (--shallow-pad)
19Saguaro: lean above 1°, mass centre more than 0.050 m off its foot, height off 2.20 ± 0.05 m, or crest diameter outside 0.30–0.37 m (--lean-saguaro)
20Ribs: not 14 trunk or 18 barrel crests, or a crest-gap spread above 2° (--skew-ribs)
21Spines: a cluster's deepest vertex under the skin outside 0.0030–0.0080 m (--float-spines)
22Bedding: the saguaro, the barrel or a root pad outside 0.025–0.150 m under the sand, or an agave leaf outside 0.020–0.100 m (--perch-barrel)
23Cover: a shell not joined to the sand (--float-cover)
24Asset-quality floor (render path only; remapped from 11)

Source

showcase/cactus-garden/cactus_garden.py View the script on GitHub →
A Sonoran cactus garden on a raised sand disc: a ribbed, many-armed saguaro and cream crown flowers, a red-hooked barrel cactus, a prickly pear with magenta fruit, an agave and sandstone rocks.