$npx -y skills add htdt/godogen --skill asset-genGenerate visual assets from text prompts: PNG images (Gemini / xAI Grok), GLB 3D models (Tripo3D), rigged biped characters, retargeted animations, and frame-by-frame animated sprites, plus background removal. Use whenever a game needs generated art.
| 1 | # Asset Generator |
| 2 | |
| 3 | Generate PNG images (Gemini or xAI Grok) and GLB 3D models (Tripo3D) from text prompts. These are paid APIs — every call costs real money. Tools live at `${ASSET_GEN_SKILL_DIR}/tools/`; run from the project root and keep runtime-loaded outputs under `${RUNTIME_ASSET_DIR}/`. |
| 4 | |
| 5 | ## Models |
| 6 | |
| 7 | | Model | Flag | Cost | Best for | |
| 8 | |-------|------|------|----------| |
| 9 | | Gemini | `--model gemini` | 5¢ (512) · 7¢ (1K) · 10¢ (2K) · 15¢ (4K) | Precise prompt following — references, characters, 3D refs, exact layouts | |
| 10 | | Grok | `--model grok` (default) | 2¢ | High quality but imprecise — textures, simple objects, item kits, scenic backgrounds | |
| 11 | |
| 12 | Grok produces great-looking output but often ignores specific instructions; reach for Gemini when the result must match what you described. |
| 13 | |
| 14 | ## Images |
| 15 | |
| 16 | ```bash |
| 17 | python3 ${ASSET_GEN_SKILL_DIR}/tools/asset_gen.py image \ |
| 18 | --prompt "the full prompt" -o ${RUNTIME_ASSET_DIR}/img/car.png |
| 19 | ``` |
| 20 | |
| 21 | `--model` (default `grok`) · `--size` (default `1K`; Gemini also `512`/`4K`) · `--aspect-ratio` (default `1:1`; also `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3`). |
| 22 | |
| 23 | **Image-to-image:** pass `--image ref.png` and the model sees the reference — prompt only for what changes (angle, pose, recolor), don't re-describe appearance. Use this for style families (one hero asset → the rest), variants, and multi-view sets. |
| 24 | |
| 25 | **Small sprites:** minimum generation is 1K, so a 1024px image downscaled to 64px looks muddy. Design display sizes ≥128px, or generate a kit (multiple objects in one 1K image) and slice it with `tools/grid_slice.py ... --grid 2x2 --names "a,b,c,d"`, or prompt for bold flat forms that survive downscaling. |
| 26 | |
| 27 | Review every PNG before any GLB conversion — a bad image wastes 30¢+ downstream. |
| 28 | |
| 29 | ### Background removal |
| 30 | |
| 31 | Read `${ASSET_GEN_SKILL_DIR}/rembg.md`. Key rule: **never prompt for a "transparent background"** (the generator bakes a checkerboard) — prompt a solid color, then matte it out. |
| 32 | |
| 33 | ## Animated sprites |
| 34 | |
| 35 | Recipe: **reference → pose → video → extract frames → loop-trim → rembg.** |
| 36 | |
| 37 | 1. Reference (Gemini 1K, neutral pose, solid BG) — anchors everything; review carefully. |
| 38 | 2. Pose per action: image-to-image from the reference, prompt only the action. |
| 39 | 3. Video from the pose frame: `asset_gen.py video --image pose.png --duration 2 -o walk.mp4` (`--duration` 1–15s, `--resolution` 720p; cost 5¢/s). |
| 40 | 4. Extract: `ffmpeg -i walk.mp4 -vsync 0 frames/%04d.png`. |
| 41 | 5. Loop-trim looping cycles (walk/idle): `tools/find_loop_frame.py frames/` returns the loop frame; delete frames past it. Skip for one-shots (attack/death). |
| 42 | 6. Batch matte: `tools/rembg_matting.py --batch frames/ -o clean/`. |
| 43 | |
| 44 | Reuse one reference for all of a character's actions. **Chaining** (feed action A's last frame as action B's start) keeps positional continuity — keep chains ≤2 deep, they drift. |
| 45 | |
| 46 | ## 3D models |
| 47 | |
| 48 | ```bash |
| 49 | python3 ${ASSET_GEN_SKILL_DIR}/tools/asset_gen.py glb --image ref.png -o model.glb # 30¢ default / 60¢ --quality hd |
| 50 | python3 ${ASSET_GEN_SKILL_DIR}/tools/asset_gen.py rig --image ref.png -o rigged.glb # +25¢, biped only |
| 51 | python3 ${ASSET_GEN_SKILL_DIR}/tools/asset_gen.py retarget --rigged rigged.glb \ |
| 52 | --animation preset:biped:walk -o walk.glb # 10¢ per clip |
| 53 | ``` |
| 54 | |
| 55 | Source image for `glb`: 3/4 elevated angle, solid white/gray background, matte finish, opaque glass, single centered subject — and **do not** rembg it (Tripo3D needs the solid bg). `rig` is biped-only and aborts if the mesh isn't humanoid; quadrupeds use plain `glb`. `retarget` reuses the rigged task id — run it once per animation against the same rigged GLB (no re-rigging). Don't assume the preset name survives into the GLB; inspect the imported clip names before wiring playback. |
| 56 | |
| 57 | Biped retarget presets (pass as `preset:biped:<name>`): |
| 58 | |
| 59 | ``` |
| 60 | afraid agree angry_01/02/03 basketball_shot bow box_01/02/03 cast_a_spell cheer chop |
| 61 | clap climb complain_01/02 cross_body_crunch crossover_dribble cry dance_01..06 |
| 62 | defeat_02/03 depressed dig dive dribble fall fire flee_01/02 flip fold_arms |
| 63 | football_catch/save/pass freaky frightened front_kick_01/02 frustrated_01/02 golf |
| 64 | greet_01..04 heart_pose hit_to_body_01/02 hit_to_head/side/stomach hug hurt idle |
| 65 | jump jump_down jump_rope_01/02 laugh_01/02 lift_heavy look_around make_a_call_01/02 |
| 66 | pitch_baseball play_mobile_game play_video_game press-up run run_upstairs scared_01/02 |
| 67 | scratch shoot shovel sing_01..04 sit slash sob stand |