<!-- skill: Blender Models | version: 1.0.0 | description: Create 3D models with Blender + Python scripting — modeling, materials, export | category: Video & Design -->

## Instructions
- Model low-poly first (quads, clean topology), subdivide later. Apply scale (`Ctrl+A`) before export or dimensions break.
- Name every object/material meaningfully (`Body`, `Wheel_FL`) — exporters and game engines use these names.
- UV unwrap before texturing; check with a grid texture for stretching.
- Materials: Principled BSDF, PBR maps (base color/roughness/normal); bake when targeting games.
- Export: FBX for Unity/Unreal (apply transforms, forward -Z / up Y), glTF for web, STL for 3D printing (manifold check).
- Automate repetition with Blender Python (`bpy`): batch rename, batch export, scene setup.

## Examples
- Low-poly tree: cone + cylinder, two materials, FBX export for Unity.
- Product turntable: model + 3-point lighting + 60-frame camera orbit render.

## Workflows
1. Reference images → blockout shapes → refine → UV → materials → lighting.
2. Origin to geometry base, apply transforms, name everything.
3. Test export early (import into target engine, check scale/orientation).
4. Render preview (Eevee for speed, Cycles for quality).
5. Save `.blend` + export final format beside it.

## Templates
```python
# Blender Python — batch export every top-level object as FBX
import bpy, os
outdir = bpy.path.abspath("//export/")
os.makedirs(outdir, exist_ok=True)
for obj in bpy.context.scene.objects:
    if obj.parent or obj.type != 'MESH':
        continue
    bpy.ops.object.select_all(action='DESELECT')
    obj.select_set(True)
    bpy.ops.export_scene.fbx(filepath=os.path.join(outdir, obj.name + ".fbx"), use_selection=True)
```

## Tools
- Run Blender headless for scripts: `blender -b scene.blend -P script.py`.
- SARAH `file_write` for `.py` scripts; heavy modeling itself happens in the Blender GUI.

## Advanced
- Non-destructive everything: Mirror/Subdivision/Bevel/Array modifiers in a sane stack order (mirror first, subdivision last-ish); Geometry Nodes for procedural variants (scatter, patterns) instead of manual duplicates.
- Retopology for animation/games: shrinkwrap + snapping, quads only, edge loops at joints; check with MatCap + wireframe overlay.
- Rigging basics: armature with proper bone rolls, automatic weights then weight-paint cleanup, test every major pose before texturing.
- Texture painting + baking: high-poly sculpts bake normals/AO onto the game mesh (multires or cage bake); 2K maps minimum for hero assets.
- Troubleshooting: black faces → flipped normals (recalculate outside) or non-manifold edges (Select All by Trait); export 100x too big → unit scale (metric 1.0 = 1m, apply scale); pink textures → missing files, pack or relink.

## Documentation
- Blender manual: https://docs.blender.org/manual/en/latest
- Python API: https://docs.blender.org/api/current
