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:
+47
@@ -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."
|
||||
Reference in New Issue
Block a user