feat(assets): add 3D-to-2D sprite render pipeline and /render-sprite skill

Godot @tool render scene that takes a textured 3D model and produces
2D sprites at 1024/256/64 from 4 cardinal directions with outlines
applied at working resolution. Camera at "the angle" (-72.5deg ortho).
Includes two POC wall models with Nano Banana textures, CLI wrapper
script with headless import step, and .uid files added to gitignore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 23:21:41 +01:00
co-authored by Claude Opus 4.6
parent 0358eedbc5
commit 2ed8fb5b37
10 changed files with 313 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
---
name: render-sprite
description: >
Render a 3D model to 2D sprites via the Godot render pipeline. Produces
sprites at 3 resolutions (1024, 256, 64) from 4 cardinal directions (north,
east, south, west) with outline applied at working resolution. Use when the
user says "render sprite", "render model", "run the render pipeline",
"test the pipeline", "/render-sprite", or asks to render a specific model
(e.g., "render wall_structural"). Output: 12 PNG files in
client/tooling/sprite_renderer/output/.
---
## Render Pipeline
Run the render script with the model name:
```bash
.claude/skills/render-sprite/scripts/render.sh <model_name>
```
### Available Models
Models live at `client/tooling/sprite_renderer/models/<name>.tscn`. List them:
```bash
ls client/tooling/sprite_renderer/models/*.tscn | xargs -I{} basename {} .tscn
```
### Output
12 files per model in `client/tooling/sprite_renderer/output/`:
```
<model>_north_1024.png <model>_north_256.png <model>_north_64.png
<model>_east_1024.png <model>_east_256.png <model>_east_64.png
<model>_south_1024.png <model>_south_256.png <model>_south_64.png
<model>_west_1024.png <model>_west_256.png <model>_west_64.png
```
### After Rendering
1. Read the 64x64 output files to visually inspect the runtime sprites
2. Read the 256x256 files to check outline quality
3. Report: does it read as the intended object at runtime scale?
### Troubleshooting
- **No output files**: Godot needs a display. If running headless, prefix with `xvfb-run`.
- **Model not found**: Check the model .tscn exists in `models/` directory.
- **Godot not found**: Pass path as second arg: `render.sh wall_structural /path/to/godot`
### Adding New Models
1. Create model scene at `client/tooling/sprite_renderer/models/<name>.tscn`
2. Apply texture from `textures/` via StandardMaterial3D
3. Run: `.claude/skills/render-sprite/scripts/render.sh <name>`
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
# Render a 3D model to 2D sprites at 3 resolutions from 4 cardinal directions.
# Usage: render.sh <model_name> [godot_path]
# Example: render.sh wall_structural
set -euo pipefail
MODEL_NAME="${1:?Usage: render.sh <model_name> [godot_path]}"
GODOT="${2:-$HOME/bin/godot}"
REPO_ROOT="$(cd "$(dirname "$0")" && git rev-parse --show-toplevel)"
PROJECT="$REPO_ROOT/client"
SCENE="res://tooling/sprite_renderer/render_scene.tscn"
OUTPUT="$PROJECT/tooling/sprite_renderer/output"
# Verify model exists
MODEL_FILE="$PROJECT/tooling/sprite_renderer/models/${MODEL_NAME}.tscn"
if [ ! -f "$MODEL_FILE" ]; then
echo "ERROR: Model not found: $MODEL_FILE"
echo "Available models:"
ls "$PROJECT/tooling/sprite_renderer/models/"*.tscn 2>/dev/null | xargs -I{} basename {} .tscn
exit 1
fi
echo "Rendering: $MODEL_NAME"
echo "Godot: $GODOT"
echo "Project: $PROJECT"
# Ensure resources are imported (headless, no display needed)
echo "Importing resources..."
"$GODOT" --path "$PROJECT" --headless --import 2>&1 || echo "Warning: import step had errors (may be non-fatal)"
# Run Godot with the render scene, passing model name as user arg
"$GODOT" --path "$PROJECT" "$SCENE" -- "$MODEL_NAME" 2>&1
# Check output
EXPECTED_FILES=0
for dir in north east south west; do
for res in 1024 256 64; do
f="$OUTPUT/${MODEL_NAME}_${dir}_${res}.png"
if [ -f "$f" ]; then
EXPECTED_FILES=$((EXPECTED_FILES + 1))
fi
done
done
echo ""
echo "Generated $EXPECTED_FILES/12 files in $OUTPUT/"
ls -la "$OUTPUT/${MODEL_NAME}"_*.png 2>/dev/null || echo "No output files found."