SET UP A LOCAL "TEXT TO GAME HERO" CHARACTER PIPELINE ===================================================== Give this whole file to a coding agent that can run commands on your PC (Claude Code, Codex CLI, Aider, or similar). It describes the pipeline Jim Rooney uses for his game Wrenchhaven and asks the agent to build a version of it for you, one checked stage at a time. Overview with pictures: https://art.jimrooney.com/character-generation/ Written 2026-11-30. Model names change fast: if something named here has been replaced by a newer, better equivalent, use the newer one and say so. ----------------------------------------------------------------------------------------------------------------- YOUR JOB (to the AI reading this) ----------------------------------------------------------------------------------------------------------------- You are setting up a local, mostly free pipeline on my Windows PC (NVIDIA GPU, 16 GB VRAM or more) that turns a short text description of a game hero into: 1. concept pictures of that hero, wearing a full set of gear at several gear levels ("tiers"), 2. one clean picture per gear piece (hat, coat, gloves, boots ...), 3. a textured 3D model (GLB) of every piece, 4. a rigged base body that plays standard animations, 5. every piece fitted onto that body, skinned to the same skeleton, as game-ready GLBs, 6. a small viewer page where I can put pieces on the body, turn it round and watch it animate. You write the glue code (Python and Blender scripts, a small web page or two). The heavy lifting is done by open models running locally in ComfyUI, and by Blender. Ground rules - Work in stages. At the end of each stage, show me a real output (a picture, a model, a screenshot) and tell me what you checked. Don't start the next stage on top of one that doesn't work. - Before you install anything or download models, list what you'll fetch and roughly how big it is (the models below add up to about 50 GB). Then go ahead unless I object. - Keep it tidy: tools in one folder (suggest D:\AI\ComfyUI and D:\AI\Studio), my art in another (suggest D:\CharacterArt), and the scripts in a git repo (suggest D:\CharacterArt\pipeline). Write a README as you go: how to start each piece, every command, every gotcha you hit. - Every step is a script with command-line arguments, so it can be rerun for the next hero without clicking. A UI is a convenience on top, never the only way. - Ask me before choosing anything that changes what I get: art style, game engine, which body to use. Everything else (folder names, script structure, numbers I can tweak later) is your call: decide, tell me, move on. - Check each model's licence and tell me if it limits selling a game (one of the editing models below is research / non-commercial; there are commercial alternatives). ----------------------------------------------------------------------------------------------------------------- STAGE 0: LOOK AT THE MACHINE ----------------------------------------------------------------------------------------------------------------- Report: GPU model, VRAM and driver (nvidia-smi), system RAM, free disk on each drive, Windows version, and whether Git, Python, uv, Node.js and Blender are installed. Recommend what's missing. 32 GB RAM works; 64 GB is comfortable. Use an NVMe drive for the models. Install what's missing: Git, uv (Python manager), Node.js LTS, Blender (an LTS release; Jim's scripts were written for Blender 3.6 LTS, 4.x works with small API changes). Blender usually isn't on PATH: find blender.exe and record its full path in the README. ----------------------------------------------------------------------------------------------------------------- STAGE 1: COMFYUI (the engine that runs the image and 3D models) ----------------------------------------------------------------------------------------------------------------- - Clone the official ComfyUI repository from GitHub. Make a Python 3.12 venv with uv inside it. Install the PyTorch CUDA build that matches the driver (the newest CUDA build the driver supports), then ComfyUI's requirements. Also install ComfyUI-Manager if the version doesn't already include a manager. - Start it with a .cmd file: listen on 127.0.0.1, port 8188. Check http://127.0.0.1:8188 opens. - Everything later talks to ComfyUI over its HTTP API: POST /prompt with an API-format graph, poll /history/, fetch outputs with /view. Write one small shared Python module for that (queue a graph, wait, download results, upload input images with /upload/image). - Tip: ComfyUI's own workflow templates (Workflow > Browse Templates) list the exact model files they need, with download links. Use the templates to find and download models, then convert the template to API format in your script (or build the API graph by hand if the template uses subgraphs). ----------------------------------------------------------------------------------------------------------------- STAGE 2: TEXT -> PICTURE ----------------------------------------------------------------------------------------------------------------- Model: Z-Image Turbo (int8 or fp8 build for 16 GB cards). Jim's settings: 8 steps, cfg 1.0, sampler res_multistep, AuraFlow shift 3, 1024x1024. About 5 seconds per picture on an RTX 4080 Super. Write make_image.py: make_image.py "prompt" [-n 4] [--seed N] [--size WxH] [--for-3d] [--init picture.png --strength 0.95] [-o folder] - --for-3d appends: "the whole object in frame, centred, plain light grey background, soft even studio light, three-quarter view". 3D models come out much better from pictures like that. - --init does picture-to-picture (needed in Stage 5). - Same prompt + same seed must give the same picture (cache by a hash of prompt + seed). Show me 4 pictures of a steampunk axe as the test. ----------------------------------------------------------------------------------------------------------------- STAGE 3: PICTURE EDITING (picture + instruction -> picture) ----------------------------------------------------------------------------------------------------------------- Model: Qwen-Image Edit, Turbo/distilled int8 build (Jim uses "Qwen-Image 2.1 Turbo" from ComfyUI's template "image_qwen_image_2_1_turbo_image_edit": cfg 1, 8 steps, 3-5 seconds per edit). Note its licence (Qwen Research, non-commercial). If I need commercial use, propose an Apache-licensed edit model instead (e.g. Qwen-Image-Edit-2511). Write edit_image.py: edit_image.py source.png "instruction" [-n 3] [--extra-image other.png] [-o folder] Short vague instructions often do nothing or add fake text labels. Explicit instructions work. Test it with the axe: "Show only the axe head, alone, centred, plain light grey background, no text". ----------------------------------------------------------------------------------------------------------------- STAGE 4: PICTURE -> 3D MODEL ----------------------------------------------------------------------------------------------------------------- Model: TRELLIS.2 (Microsoft). The official repo is Linux-only and wants 24 GB; ComfyUI's native reimplementation with int8 models fits 16 GB. Use ComfyUI's template "Pixal3D & TRELLIS.2: Image to Model" (its switch set to TRELLIS.2). If it isn't available in my ComfyUI version, update ComfyUI; if it still isn't, use Hunyuan3D 2.x through ComfyUI and tell me. Write to_3d.py: to_3d.py picture.png [--game] [--faces N] [--texture N] [--seed N] [-o folder] - --game = 30,000 triangles and a 1024 texture (about 8 MB, about 2 minutes). Full quality is 700k triangles and 4K textures (60 MB) and looks nearly the same in a game. Use --game by default. - Output: a GLB with a PBR texture. TRELLIS faces the model toward glTF +Z. Then chain it: make_image.py --for-3d --to-3d. Show me the axe as a GLB (render a turntable picture in Blender, or open it in a page). ----------------------------------------------------------------------------------------------------------------- STAGE 4b (optional but worth it): A LITTLE STUDIO PAGE ----------------------------------------------------------------------------------------------------------------- Jim's "Art Studio" is a local web page over ComfyUI: a session is a list of rounds; a round is a prompt and 4 pictures; each picture has buttons for "same seed, new words", "more like this" (picture-to-picture at 0.7), "modify" (edit), "extract parts", "prep for 3D", "to 3D" (game or full), star, download GLB/STL. Live updates by server-sent events, a turntable for models. Pictures jump ahead of waiting 3D jobs. It also has an HTTP API so scripts can drive it (start a round, poll, pick try N, make a model, collect the GLBs). Build a small version (Python, a single-file server is fine) if I want clicking as well as scripts. Offer it; don't block the pipeline on it. ----------------------------------------------------------------------------------------------------------------- STAGE 5: FROM A TEXT DESCRIPTION TO CONCEPT SHEETS, ONE PER GEAR LEVEL ----------------------------------------------------------------------------------------------------------------- A hero is a small data record. Example (Jim's Architect): id: architect name: Architect role: Town planner and builder person: "a woman with bright red hair in a high messy bun" idea: "a surveyor and builder" slots (head, chest, arms, hands, belt, legs, feet): "wide-brimmed hat", "long duster coat", "cuffed sleeves", "drafting gloves", "measuring-tape belt", "trousers", "field boots" weapon: "surveyor's staff" accessories: "plans tube slung on her back", "theodolite" A tier is a material sentence. Jim's ladder (adapt the words to my game): Scrap: the crudest home-made gear ... twigs, bark, woven grass, rough undyed sackcloth rags and twine lashings Iron: plain sturdy blacksmith work: dull dark hand-forged iron with hammer marks, rivets, thick plain brown leather straps, grey wool padding. Functional, plain, no decoration Brass: polished workshop gear: bright polished silver steel and smooth dark-brown dyed leather, small brass trim, etched patterns, brass buckles and rivets Aether: magical gear: dark brass and blued steel set with glowing blue-violet crystals, luminous runes, softly glowing seams Make the levels obviously different at a glance; the bottom tier must look far cruder than the next. Steps (write hero_sheets.py, data in one JSON/Python file per game): 1. Base picture per hero: "Game character concept art, standing straight facing the viewer, arms relaxed, on a plain light grey studio background. , wearing a snug plain grey t-shirt and snug plain dark grey shorts, barefoot. Nothing else: no armour, no hat, no belt, no gloves, no shoes, empty hands. Whole figure in frame, head to toe." Make 4, let me pick one per hero. 2. For each tier: build a canvas with the base picture on the left and blank parchment on the right, and run ONE picture-to-picture pass (strength ~0.95, the base half mask-protected or lightly weighted so the face stays) with a "costume design sheet" prompt: left = the person wearing every piece; right = the same pieces laid out separately ("knolling flat lay") on parchment. ONE picture for both halves is the trick: generated separately, the worn set and the laid-out pieces drift apart. 3. Tips that cost Jim time: use neutral slot nouns ("chest guard", not "cuirass") and let the tier's materials decide; an adjective like "brass apron" makes everything solid gold, so describe tiers by materials ("polished silver-steel-and-brown-leather"). Name the exact piece count. Say "nothing that is not on the right". 4. Make 4 tries per tier, contact-sheet them, and let me pick. The picked picture is the source of truth for the hero's look at that tier ("the hero picture wins over the laid-out pieces"). ----------------------------------------------------------------------------------------------------------------- STAGE 6: ONE CLEAN PICTURE PER PIECE ----------------------------------------------------------------------------------------------------------------- Edit (Stage 3) the whole sheet once per piece, with a job file listing the pieces: {"id": "coat", "kind": "apose", "desc": "long brown leather duster coat with wide lapels, open at the front, ... worn by the woman on the left", "extra": "the neck, sleeve and hem openings showing the hollow inside"} Prompt templates by kind (Jim's, they work; {desc} and {extra} come from the job): piece: Turn the {desc} from this picture into a finished 3D game asset. Show only that, whole and centred, small with a wide empty margin, slightly elevated front three-quarter view, {extra}. + TAIL one: (one of a pair: boots, gloves, bracers, shoulder plates) Show only ONE {desc}, the left one, alone and empty with nothing inside it, standing upright, small and centred with a wide empty margin, slightly elevated three-quarter view, {extra}. + TAIL apose: (coats, shirts) Show only the {desc} from this picture, as if worn by an invisible mannequin standing in an A-pose: both sleeves hollow and raised out from the body at 45 degrees to the sides, seen from the front, slightly above, whole and centred, small with a wide empty margin, {extra}. Keep its exact design, collar, buttons, buckles, colours and length. + TAIL legs: Show only the {desc} from this picture, with no belt, boots or armour on them, as if worn by an invisible mannequin standing straight: both legs hollow, waist to ankles. Front view, whole and centred, small with a wide empty margin, {extra}. + TAIL prop: Turn the {desc} from this picture into a finished 3D game asset. Show only that one object, whole and centred, small with a wide empty margin, seen from the side, slightly elevated, {extra}. No person, no hand, no stand, no other items, no text. TAIL = Plain uniform light grey background, soft diffuse studio lighting, matte PBR leather and lightly worn metal, clean simple silhouette, engraving and stitching as surface texture only. Remove everything else: no person or body, no mannequin or stand, no other items, no text. Keep its exact design, materials and colours. A clean 3D render from Blender, not a painting. Lessons: - Edit from the WHOLE sheet and say "worn by the woman on the left". Editing from a crop of just the hero redraws the whole person. - Small pieces worn on the body (shoulder plates, bracers) come out better from an upscaled crop of that area. - Coats MUST be drawn with sleeves out (A-pose). Sleeves hanging straight down can't be put on arms. - Pairs: make one; the fitting step mirrors it. - Make 2-4 tries per piece, write a contact sheet (every piece's tries in a grid), let me pick, then run Stage 4 on the picks only. Copy the GLBs to //src/NN_.glb. ----------------------------------------------------------------------------------------------------------------- STAGE 7: THE BASE BODY AND RIG ----------------------------------------------------------------------------------------------------------------- Ask me first: which body (or bodies: one per body type; one body morphed to fit every build looked bad). Options: a mannequin I make or buy (Jim made his in Vizcom and approved it before anything was built on it), a CC0 base like Quaternius "Universal Base Characters", or MakeHuman (CC0 exports). A-pose, about 170 cm, clean topology, no clothes. Show me the body before building on it. Rig: one skeleton shared by every body, so every animation plays on all of them. Easiest: Mixamo (free, Adobe account): upload the body for its auto-rigger, download it with skin, and download the animations you need (idle, walk, run, sprint, attack...) as FBX "without skin" on the same skeleton; convert to GLB in Blender. Mixamo files may be used in games but not redistributed raw, so keep the repo private. Jim instead fits Mixamo's skeleton to each new body by script (joint positions read from cross-sections of the mesh, the bones keeping the original bone axes so the clips play unchanged), then skins it in Blender. Head and hair: Jim's bodies are faceless mannequins. He gave one a face by editing a render of the bust together with a portrait (Stage 3, two images), turning the result into 3D (Stage 4, 200k faces / 2K texture), and grafting that head and hair onto the body in Blender (hair as separate meshes so hats can hide it). Check: load the rigged body in a three.js page and play each clip. Feet on the ground, no twisted wrists or hips. ----------------------------------------------------------------------------------------------------------------- STAGE 8: FITTING THE PIECES TO THE BODY (Blender, headless Python) ----------------------------------------------------------------------------------------------------------------- This is the hard part and where most of Jim's time went. Build it as: a recipes file (one line per piece with options) + one Blender script that fits a whole kit + a build script per kit: blender -b --factory-startup --disable-autoexec --python fit_kit.py -- Per piece: 1. Orient: turn it to face forward and stand it up (TRELLIS sometimes lays pieces down or faces hats backwards; check hats, helmets and goggles by where the band/goggles are in the hero picture). 2. Size and place it from body landmarks measured once per body: head top and circumference, neck, shoulder balls, chest, waist (a woman's waist is the narrowest part of the trunk, well above the hips), hips, knees, ankles, soles, hand and foot lengths. Size coats and hoods by length (collar to hem), not width (sleeves held out double a coat's width). Waistbands sit at the waist; skirts hang from the widest hip down. 3. Wrap: cloth and leather are laid onto the body (or onto the layer below) like cloth, a few mm off: move each point to the nearest body point plus a layer gap plus its own relief, then smooth the movement over the mesh (a few cm neighbourhood) so neighbours don't fold. Rigid metal keeps its shape: scale/bend gently, then push out anything still under the skin, repeating until nothing is under. 4. Special cases: boots: try rotations about the ankle (up to ~24 degrees each way) and keep the one showing the least foot. Hats: placed rigidly on the head (never pressed), lift/ease options. Shoulder plates: fit the shell onto the shoulder ball, bulge out and ~35 degrees up. Gloves: best made from the body's own hand surface offset outward, with the drawn glove's colours projected on. 5. Tight trousers/leggings: TRELLIS turns drawn folds and shading into lumpy geometry ("cracked mud" when pressed tight). Build them from the body's own leg surface instead (copy, offset outward a few mm) and project only the drawn colours onto it. 6. Pairs: fit the left one, mirror to the right. 7. Skin weights: copy from the body (Blender Data Transfer, nearest face interpolated); rigid plates take only the bones they ride on (a breastplate: the spine bones). 8. Layers: 1 underwear/shirt, 2 clothes, 3 armour, 4 outerwear. Each layer fits over the ones below it. Order on a woman's trunk: skirt, then breastplate, then belt. 9. Textures: TRELLIS bakes the picture's lighting in and turns shiny gold into khaki. Re-grade per piece: polished gold, polished steel, dull iron, matte leather; mark which pixels are metal. Without an environment map in the game, full metal draws black: either give the game an env map or keep metalness low. 10. Budgets: decimate (shiny metal needs more triangles than matte cloth: thin slivers each reflect differently), texture 768-1024, keep each kit file under a cap (Jim: 6 MB). Export GLB skinned to the body's skeleton. Blender gotchas that cost Jim days: - Importing a skinned GLB into Blender can re-aim bones (the hip bone turned 90 degrees). When exporting gear, restore the joints' rest pose and inverse bind matrices from the original body GLB, and test that every joint matches. - TRELLIS splits vertices at every UV seam: weld before decimating or measuring boundaries. - TRELLIS draws plates 1-1.5 cm thick and closes shells (inner and outer walls). Draw closed metal shells front-side only; double-sided, the inner wall shows black through the outer one. - Vertex groups that aren't bones export as stray "neutral_bone" joints and break skinning. - A Blender crash can leave the old output file in place: check the log for errors, not just the file. - Windows paths inside Python strings: use forward slashes (a backslash-a or backslash-f becomes a control byte). ----------------------------------------------------------------------------------------------------------------- STAGE 9: THE GAME SIDE AND AN "EQUIPMENT LAB" ----------------------------------------------------------------------------------------------------------------- Ask me which engine. Jim's game is TypeScript + three.js + Vite (browser, also VR on a Quest 3); Godot and Unity work the same way: load the body, load each piece's GLB, bind its skinned meshes to the body's skeleton, play the body's animations. - Hide the body's skin where clothing covers it (a per-piece "areas" list or a coverage mask), or skin pokes through in motion. - Build a dev-only "equipment lab" page: choose body, put pieces on and off, whole-kit buttons, play idle/walk/ sprint, turn the camera (front, 3/4, side, back, head close-up), and save a screenshot strip. Judge fits there, in motion, in the game's own lighting, not in Blender renders. ----------------------------------------------------------------------------------------------------------------- STAGE 10: THE REVIEW LOOP ----------------------------------------------------------------------------------------------------------------- For every kit, the lab writes a strip: concept picture, front, three-quarter, side, back, and four head views. Then a review pass: give the strip and the concept to a separate AI reviewer playing a tailor / armourer / hat expert, asking: does each piece sit where a real one would, gaps, skin showing, things facing the wrong way, proportions vs the concept? Fix the recipe, rebuild, re-shoot. Two to four rounds per tier is normal. I look last. ----------------------------------------------------------------------------------------------------------------- ACCEPTANCE TEST ----------------------------------------------------------------------------------------------------------------- One new hero, written as a text record by me, carried end to end at two tiers (one crude, one fancy): base picture -> two tier sheets -> per-piece pictures -> GLBs -> fitted kits on the rigged body -> both kits worn and animating in the lab, with review strips. Then write up in the README: every command in order, timings, and what still looks wrong. What to expect (Jim's numbers, RTX 4080 Super 16 GB): picture ~5 s, edit 3-5 s, 3D model 1.5-2 min, a 10-piece kit ~30 min of GPU, a kit fit a few minutes in Blender. The first working end-to-end hero takes days of iteration; after that a hero at a new tier is an afternoon. Hoods, hair and loose cloth are still the weakest parts.