Low-poly asset generator
Builds meshes procedurally in Python (numpy + Pillow only, no Blender needed), exports binary FBX 7.4 (default) and/or OBJ + MTL plus a palette atlas PNG, and renders a 4-view preview PNG you must look at before calling an asset done.
Skill dir: ~/.claude/skills/lowpoly-assets/ or <project>/.claude/skills/lowpoly-assets/
(below: <SKILL>). Use python3 instead of python on macOS/Linux.
| File | Purpose |
|---|---|
scripts/lowpoly.py | modelling kit: primitives, transforms, palette, validate, export |
scripts/fbx_writer.py | binary FBX 7.4 writer used by export (Unity-verified) |
scripts/preview.py | software renderer → contact sheet (3/4, side, front, top) |
scripts/unity/LowPolyImportTest.cs | optional Unity batch check: import report + render |
assets/palette.json | own named palette (55 colours × 8 shades) |
references/style_guide.md | style rules: budgets, scale, naming, colour use – read first |
examples/build_examples.py | crate, barrel, rock, tree, pine, pistol, sign – copy the closest |
Workflow
- Read
references/style_guide.mdand the closest recipe inexamples/build_examples.py. - Plan in 3–6 bullets: real-world size in metres, category + name
(
Prop_…), tri budget from the guide, part breakdown into primitives, colour keys per part (base shade + lighter tops / darker trims). - Write a build script (in the user's project or a temp folder, not in
the skill dir) that imports the kit:
import sys; sys.path.insert(0, r"<SKILL>/scripts") from lowpoly import * m = merge_all([...], "Prop_Thing_01").to_ground() print(m.report()); print(validate(m, budget=400)) export(m, r"<out>/Prop_Thing_01") # fmt="both" (default) | "fbx" | "obj" - Run it with
python -E -P build.py, thenpython -E -P <SKILL>/scripts/preview.py <out>/Prop_Thing_01.objand Read the PNG. Check silhouette, proportions, colour contrast between parts, floating/intersecting parts, inverted faces (dark patches where light should be). Iterate until it reads well from the 3/4 view. - Deliver: FBX (+ OBJ/MTL if wanted) +
LowPoly_Palette.png(one atlas shared by all assets in the folder), the build script (so it can be regenerated), and the preview. Report tri count and size.
Kit cheat sheet
Primitives (sit on y=0, centred in XZ): box(size, color, top=, bottom=),
bevel_box(size, bevel, color, edge_color=, top=),
cylinder(r, h, sides, color, top=, radius_top=), cone, icosphere(r, subdiv),
lathe([(r, y), …], sides, colors=[…per segment]),
extrude(outline2d, depth, color, side_color, axis="z"|"y") (concave ok),
plane(size, color, subdiv), tube_between(p0, p1, r, sides).
Ops (chainable, mutate + return self): translate, rotate(axis, deg, origin), scale, taper, jitter(amount, seed), bend_noise, recolor(key, where=lambda n: …), to_ground(); mirror("x") returns original+mirror; array, radial,
merge_all, m1 + m2.
Colour keys: "wood" (= shade 3), "wood:0" lightest … "wood:7" darkest.
Unknown names raise with the list of valid ones. New colours: append to
palette.json (never insert/reorder – UVs of existing assets would shift),
then delete the old atlas PNG in the output folder so it is regenerated.
Recipes by category
- Hard-surface props:
bevel_boxbody (bevel 2–4 % of size) + battens, straps, handles as smaller bevel boxes in a darker shade. - Round props:
lathewith rims (step radius out 3 % for 2–3 cm), 8–10 sides. - Weapons: side silhouette outlines →
extrudeper part (slide, frame, grip, magazine), cylinders for barrels; rotate so barrel → +Z, grip origin. - Rocks/cliffs:
icosphere(subdiv=1)scaled flat +jitter, lighter tops. - Foliage: trunk
cylinder(radius_top=…)+ 2–4 jittered icospheres or stackedcones; darker undersides viarecolor(where=n[1] < -0.3). - Buildings: walls as
extrude(axis="y")floor-plan slabs or boxes with window openings built from frame pieces; doors as separateparts(Building_X_01_Door_01), pivot at the hinge. - Vehicles: body from 2–3 extruded side profiles + bevel boxes, wheels as
cylinderrotated on Z (8–10 sides), exported as separateparts.
Unity notes
- FBX is the default for Unity. Written as cm data with
UnitScaleFactor 1 → Unity applies file scale 0.01, object scale stays 1,
1 unit = 1 m. Normals import as hard edges, material is named
M_LowPoly_Palette. Verified in Unity 6000.3 (sizes, pivot on ground, normals, palette UVs). - OBJ alternative: metres → import scale 1, Normals = Import.
parts={...}become separate child GameObjects (doors, wheels).- Use one material for all assets: URP/Lit (or Simple Lit), Base Map =
LowPoly_Palette.png, Smoothness ≈ 0, texture Filter = Point or Bilinear with mip maps off/limited (swatches are 16 px). - Unity mirrors X on import (handedness, FBX and OBJ alike); the asset looks correct, just be aware when placing asymmetric parts.
- Optional verification:
scripts/unity/LowPolyImportTest.csin a throwaway project (instructions in the file header) →lowpoly_report.txtwith size / tris / hard-normal / UV checks andlowpoly_unity_render.png. Ask the user before launching Unity in batch mode (takes minutes, must not touch a project that is open in the editor). - If a writer change makes Unity report "Couldn't import file": the FBX SDK
needs the
Documents/Documentblock withRootNode(seefbx_writer.py).
Don'ts
- Don't import, trace or re-export meshes/textures from third-party assets – only original geometry built with this kit.
- No smooth shading, no per-asset textures, no UV unwrapping for plain colour.
- Don't exceed the category tri budget without a reason; don't model detail smaller than ~2 cm on props.