# Character art: one animation, any outfit
Player sprites are paper dolls. PixelLab is called a fixed number of times to build a
**layer library**; every look a player can create is composed from it on the CPU with no
further API calls.
```mermaid
flowchart LR
A[create-character-with-4-directions
bald, white tee, grey shorts, barefoot] --> B[walking-4-frames template
south, east, north]
B --> C[15 base frames
3 dirs x stand + 4 walk]
C --> D[edit-animation-v2 per item
all 15 frames in one call,
item drawn in pure green]
C --> E[split base: skin / tee / shorts
shade layers + fixed pixels]
D --> F[extract green hue -> shade layer
outline + details -> fixed pixels]
E --> G[assets/characters/<body>/]
F --> G
G --> H[client composes any look:
skin tone, item per slot, color per slot]
```
## Why it works
- The base walk is generated once per body. `edit-animation-v2` edits all 15 frames in one
request and keeps the motion, so an item's frames line up pixel-for-pixel with the base
frames. No per-outfit animation calls.
- Items are drawn in a stand-in color (bright pure green) that no base pixel uses. The
extractor (`tools/character_art.py build`) keeps the green pixels as a **shade layer**: each
pixel stores a shade index 1..4 (luminance relative to the frame's median, so frames the
model rendered a bit brighter or darker still band the same). The dark outline and small
details right next to the green become **fixed pixels**.
- The base body is split the same way: skin, tee and shorts become shade layers, everything
else (outline, eyes, mouth) stays fixed. Skin tone is therefore just a color, like a shirt.
- Tops are clipped two rows below the shorts' waistline (the edit model sometimes turns a
sweater into a robe).
- West is east mirrored at runtime, so only three directions are stored.
## Cost
| Step | Calls | Generations |
| --- | --- | --- |
| Base body (x2) | `create-character-with-4-directions` | ~1 each |
| Walk (x2) | `characters/animations` template mode, 3 directions | ~0 (template) |
| Item (x18 per body) | `edit-animation-v2`, 15 frames | 20 each |
| Professor Henry | character + walk + `create-image-pixen` portrait | ~2 |
18 items x 2 bodies = 720 generations for every combination of 5 hair styles, 3 hats,
4 tops (+ the base tee), 3 bottoms (+ the base shorts) and 3 shoes, in any color and any of
6 skin tones. A new item is one more call per body.
## Files
```
art_src/characters/