Mesh polish host add-on for generated meshes; headless intent runner; turntable recipe #22

Merged
eureka merged 6 commits from nibu/fable-mesh-polish into main 2026-12-01 01:40:21 +00:00
Owner

Tools for polishing meshes made by image-to-3D generators (Tripo and its kin), built while polishing two Tripo hulls through Brokkr. Not merged by the author: Self routes Soul.

Soul's first pass falsified this PR at 0921bec; the three commits after it are the fix batch (see "After Soul's pass").

What is added

  • surfaces/blender/brokkr_mesh_polish/: a host add-on (it imports nothing from Brokkr; brokkr_actions.json is its contract). Seven rows:
    • audit: triangles, welded topology (open and non-manifold edges, shells), triangles wound against their shading normals, UV islands, mirrored-texture triangles, overlap, coverage, texel density.
    • repair: weld (UV seams keep their UVs), drop degenerate, loose and small-shell geometry, fill small holes. It turns no face and carries the custom shading normals through; recalc_normals and sharp_angle are opt-in.
    • orient: principal axes, centre, scale for a root and its descendants (or the scene), baked into the mesh data; parents and pivots are kept; reports mirror error per axis.
    • delight: undo lighting baked into the base colour texture, as far as shading normals and ambient occlusion explain it (upper-envelope fit per hue cluster).
    • pick: the surface point at (u, v) of a camera's frame, so a place seen in a render can be named to another action.
    • scrub_markings: paint out baked lettering inside a world-space sphere.
    • cut_parts: cut one fused skin into named parts grown from seeds along concave creases; cap both sides; root each part at its cut and parent it to the body; optional ball joint.
  • surfaces/blender/tools/run_intents.py: run a JSON list of intents in a background Blender through BrokkrBlenderTarget.run_intent; receipts to a file.
  • surfaces/blender/tools/private_dirs.py: the guard both it and the live test use. It refuses unless the three BLENDER_USER_* variables point outside a person's own Blender folders and Blender is really using them.
  • surfaces/blender/tools/turntable_recipe.py: write such a recipe from Brokkr's own scene actions for an orthographic turntable.
  • surfaces/blender/docs/mesh-polish.md: each action, its report, and what it cannot do.

After Soul's pass

  • High, repair turned faces. repair ran recalc_face_normals unconditionally; on two further Tripo hulls it reversed 4,565 of 23,341 and 15,735 of 28,426 triangles, which a single-sided material culls. repair now leaves every winding alone; recalc_normals is opt-in and reports windingFlipped. cut_parts had the same call and lost it too. Welding also shifted the custom shading normals (Blender stores them against each corner's automatic normal): they are now carried through weld, fill and cut as plain directions and set back. delight reads those shading normals, not winding-derived ones. The live test's sphere is torn, half inside out under outward custom normals, and fails on 0921bec; with BROKKR_POLISH_HULLS the test also repairs real hulls (three Tripo GLBs here: 0 faces turned on each).
  • Medium, orient. object_name scopes it to a root and its descendants; every object keeps its parent and its pivot.
  • Medium, tests. Soul's 26 mutants and 11 of this batch's own all die (15 of Soul's 20 survived before). None is equivalent.
  • Low. uvFlippedTriangles is replaced by windingAgainstNormals and uvMirroredTriangles (texture parity against the shading normals). delight's limit on a smooth fade that follows the normal is documented (it keeps 0.35 of the slope), not mitigated. The private-directory guard checks where the variables point and what Blender uses.
  • Also found while fixing: a mesh with no material got the cap material on every face after cut_parts; new faces borrowed their neighbours' shading normals.

Structural delta

3,645 lines added, none removed; no built-in action, schema, Rust or C# change, no new dependency (numpy is Blender's own). The add-on is a new owned surface: owner Brokkr's Blender surface, consumer agents polishing generated hulls, and it exists as a host add-on because the action table admits no free Python.

run_intents.py is a second way to send intents beside the CultMesh node. It delegates admission to run_intent and keeps no opinion of its own, but its receipts are not in any node: that is the liability, stated in its docstring.

Proof

  • python -m unittest discover -s surfaces/blender/tests: 403 tests, OK (20 skipped as before). test_mesh_polish.py has 45: the arithmetic, the host file against action_table.check_host, the guard, and the turntable recipe against the action table. Bounds follow lodur:ruling:deterministic-bound-margin.
  • tests/live/mesh_polish.py in background Blender 5.3.0 with private user directories: 40 checks, 43 with three real hulls, all ok (mesh_polish.result.json).
  • 37 mutants (Soul's M1 to M26, with M12 and M16 re-aimed at the rewritten code, and N1 to N11), each applied alone to a scratch copy: all killed.
  • Build host and target: Windows workstation, Python only; nothing was compiled. Not run on Linux. Not run in a GUI session through the node.

The two hulls, before and after

Orchid before after Submarine before after
Triangles 11,667 13,421 10,406 10,813
Open edges 1 2 1,238 485
Non-manifold edges 2 8 96 96
Wound against normals 15 15 64 67
Mirrored-texture triangles 15 15 91 91
UV overlap 0.002% 0.008% 0.007% 0.007%
Up/down luminance ratio 3.06 1.27 1.60 1.08
GLB bytes 2,893,124 16,330,960 3,797,740 20,701,400

Known limits

  • cut_parts depends on seed placement; cuts follow triangle edges and are ragged on a coarse mesh.
  • delight cannot recover texels the generator left black, cast shadows or highlights, and flattens a smooth fade of one hue that follows the normal.
  • repair does not close a mesh assembled from open intersecting shells, and does not correct the faces a generator wound against their normals: it reports them.
  • Host fields are snake_case (they must be the operators' property names), unlike the built-ins' camelCase.

🤖 Generated with Claude Code

Tools for polishing meshes made by image-to-3D generators (Tripo and its kin), built while polishing two Tripo hulls through Brokkr. Not merged by the author: Self routes Soul. Soul's first pass falsified this PR at `0921bec`; the three commits after it are the fix batch (see "After Soul's pass"). ## What is added - `surfaces/blender/brokkr_mesh_polish/`: a host add-on (it imports nothing from Brokkr; `brokkr_actions.json` is its contract). Seven rows: - `audit`: triangles, welded topology (open and non-manifold edges, shells), triangles wound against their shading normals, UV islands, mirrored-texture triangles, overlap, coverage, texel density. - `repair`: weld (UV seams keep their UVs), drop degenerate, loose and small-shell geometry, fill small holes. It turns no face and carries the custom shading normals through; `recalc_normals` and `sharp_angle` are opt-in. - `orient`: principal axes, centre, scale for a root and its descendants (or the scene), baked into the mesh data; parents and pivots are kept; reports mirror error per axis. - `delight`: undo lighting baked into the base colour texture, as far as shading normals and ambient occlusion explain it (upper-envelope fit per hue cluster). - `pick`: the surface point at (u, v) of a camera's frame, so a place seen in a render can be named to another action. - `scrub_markings`: paint out baked lettering inside a world-space sphere. - `cut_parts`: cut one fused skin into named parts grown from seeds along concave creases; cap both sides; root each part at its cut and parent it to the body; optional ball joint. - `surfaces/blender/tools/run_intents.py`: run a JSON list of intents in a background Blender through `BrokkrBlenderTarget.run_intent`; receipts to a file. - `surfaces/blender/tools/private_dirs.py`: the guard both it and the live test use. It refuses unless the three `BLENDER_USER_*` variables point outside a person's own Blender folders and Blender is really using them. - `surfaces/blender/tools/turntable_recipe.py`: write such a recipe from Brokkr's own scene actions for an orthographic turntable. - `surfaces/blender/docs/mesh-polish.md`: each action, its report, and what it cannot do. ## After Soul's pass - **High, repair turned faces.** `repair` ran `recalc_face_normals` unconditionally; on two further Tripo hulls it reversed 4,565 of 23,341 and 15,735 of 28,426 triangles, which a single-sided material culls. `repair` now leaves every winding alone; `recalc_normals` is opt-in and reports `windingFlipped`. `cut_parts` had the same call and lost it too. Welding also shifted the custom shading normals (Blender stores them against each corner's automatic normal): they are now carried through weld, fill and cut as plain directions and set back. `delight` reads those shading normals, not winding-derived ones. The live test's sphere is torn, half inside out under outward custom normals, and fails on `0921bec`; with `BROKKR_POLISH_HULLS` the test also repairs real hulls (three Tripo GLBs here: 0 faces turned on each). - **Medium, orient.** `object_name` scopes it to a root and its descendants; every object keeps its parent and its pivot. - **Medium, tests.** Soul's 26 mutants and 11 of this batch's own all die (15 of Soul's 20 survived before). None is equivalent. - **Low.** `uvFlippedTriangles` is replaced by `windingAgainstNormals` and `uvMirroredTriangles` (texture parity against the shading normals). `delight`'s limit on a smooth fade that follows the normal is documented (it keeps 0.35 of the slope), not mitigated. The private-directory guard checks where the variables point and what Blender uses. - Also found while fixing: a mesh with no material got the cap material on every face after `cut_parts`; new faces borrowed their neighbours' shading normals. ## Structural delta 3,645 lines added, none removed; no built-in action, schema, Rust or C# change, no new dependency (numpy is Blender's own). The add-on is a new owned surface: owner Brokkr's Blender surface, consumer agents polishing generated hulls, and it exists as a host add-on because the action table admits no free Python. `run_intents.py` is a second way to send intents beside the CultMesh node. It delegates admission to `run_intent` and keeps no opinion of its own, but its receipts are not in any node: that is the liability, stated in its docstring. ## Proof - `python -m unittest discover -s surfaces/blender/tests`: 403 tests, OK (20 skipped as before). `test_mesh_polish.py` has 45: the arithmetic, the host file against `action_table.check_host`, the guard, and the turntable recipe against the action table. Bounds follow `lodur:ruling:deterministic-bound-margin`. - `tests/live/mesh_polish.py` in background Blender 5.3.0 with private user directories: 40 checks, 43 with three real hulls, all ok (`mesh_polish.result.json`). - 37 mutants (Soul's M1 to M26, with M12 and M16 re-aimed at the rewritten code, and N1 to N11), each applied alone to a scratch copy: all killed. - Build host and target: Windows workstation, Python only; nothing was compiled. Not run on Linux. Not run in a GUI session through the node. ## The two hulls, before and after | | Orchid before | after | Submarine before | after | |---|---|---|---|---| | Triangles | 11,667 | 13,421 | 10,406 | 10,813 | | Open edges | 1 | 2 | 1,238 | 485 | | Non-manifold edges | 2 | 8 | 96 | 96 | | Wound against normals | 15 | 15 | 64 | 67 | | Mirrored-texture triangles | 15 | 15 | 91 | 91 | | UV overlap | 0.002% | 0.008% | 0.007% | 0.007% | | Up/down luminance ratio | 3.06 | 1.27 | 1.60 | 1.08 | | GLB bytes | 2,893,124 | 16,330,960 | 3,797,740 | 20,701,400 | ## Known limits - `cut_parts` depends on seed placement; cuts follow triangle edges and are ragged on a coarse mesh. - `delight` cannot recover texels the generator left black, cast shadows or highlights, and flattens a smooth fade of one hue that follows the normal. - `repair` does not close a mesh assembled from open intersecting shells, and does not correct the faces a generator wound against their normals: it reports them. - Host fields are snake_case (they must be the operators' property names), unlike the built-ins' camelCase. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
run_intents.py sends a JSON list of intents through BrokkrBlenderTarget.run_intent in a
background Blender (the action table admits or denies each, host rows included) and writes
the receipts to a file. It refuses to start without private Blender user directories.
turntable_recipe.py writes such a recipe from Brokkr's own scene actions, so a before and
an after of one subject are framed identically.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Seven agent-callable operators for image-to-3D output (Tripo and its kin): audit (welded
topology, UV overlap, texel density), repair, orient, delight (undo baked lighting that
normals and occlusion explain), pick, scrub_markings (paint out baked lettering) and
cut_parts (cut a fused skin into capped, rooted, parented parts from seeds).

The arithmetic is core.py, numpy only, tested without Blender; the host file is tested
against Brokkr's own checker; tests/live/mesh_polish.py proves every row through run_intent
in Blender 5.3.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The guard only checked that the three variables were non-empty. tools/private_dirs.py now
refuses a variable set inside %APPDATA%/Blender Foundation, ~/.config/blender or the macOS
folder, and a Blender whose own answer for CONFIG, EXTENSIONS or SCRIPTS is not under the
variable. (Soul finding run-intents-guard-checks-non-empty, PR 22.)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Soul falsified PR 22: repair's unconditional recalc_face_normals reversed 4,565 of 23,341
and 15,735 of 28,426 triangles on two further Tripo hulls, which a single-sided material
culls. repair now leaves every winding alone; recalc_normals is opt-in and reports
windingFlipped. cut_parts no longer recalculates either. Custom shading normals are carried
through weld, fill and cut as plain directions and set back, new faces are shaded by their
own direction, and delight reads those shading normals instead of winding-derived ones.

audit: windingAgainstNormals, and uvMirroredTriangles (texture parity against the shading
normals) in place of uvFlippedTriangles, which changed whenever a winding did.
orient: object_name scopes it to a root and its descendants; parents and pivots are kept.
cut_parts: a mesh with no material keeps a bare first slot, so only caps take the cap material.

Tests: 13 more unit tests and 18 more live checks (43 with BROKKR_POLISH_HULLS). The live
sphere is now torn, half inside out under outward custom normals. Soul's 26 mutants and 11
of this batch's own all die.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
eureka merged commit 82196e5f26 into main 2026-12-01 01:40:21 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/Brokkr!22
No description provided.