How we built all of Burrow's pixel art with Retro Diffusion
529 approved game assets, 23 seamless terrain families and 97 animation sheets built in 17 hours via the Retro Diffusion v2 API, with zero redrawing.
Burrow is a falling-sand underground adventure written in Rust/WebAssembly and WebGL 2. Every cell in the world is simulated — soil crumbles, water floods tunnels, spore gas ignites, lava cools into stone — and one simulation cell equals one pixel of art.
That constraint is unforgiving. Nothing can be resampled, rotated by odd angles, or blurred to hide inconsistencies. A 16×16 terrain tile sits right next to a 16×16 beetle and a 64×40 badger boss on the exact same pixel grid, all lit in real time by 2D Radiance Cascades.
When we first tried generating Burrow's art with AI, we did it the naive way and threw away our first two tile sets — they looked like a grid of randomly colored squares. Then we rebuilt the process like an engineering pipeline: locked style references first, content-hashed job specs, automated pixel QA, model routing across four Retro Diffusion families, 2-pixel ring inpainting, and a Voronoi terrain shader.
Over 17 hours, 791 API requests through the Retro Diffusion v2 API produced 1,804 candidate images and 529 approved game assets (911 PNGs on disk, 658 registered sprites, 23 seamless terrain families, and 97 frame-by-frame animation sheets) — with zero manual redrawing.
Here is everything that worked, everything that broke (all 1,767 rejected PNGs are still on disk), and the exact rules we ended up with.
1. Why our first two tile sets failed — and why we locked style references first
Our early attempts made every classic mistake at once:
- Terse prompts (
"dirt","stone"), one take per material. - Small ramp palettes that crushed organic ground into harsh, noisy speckles.
- No shared visual anchor, so sprites, props, and tiles drifted into incompatible styles.
The result looked loud, flat, and painfully tiled. Drag across the cross-section below to compare our discarded single-take tiles against the finished Retro Craft families with Voronoi patching and ragged material joins:

Early single-take tilesRetro Craft + VoronoiWe scrapped both early sets and wrote two rules before generating anything else:
- Dark, quiet ground; bright, rare accents. Two-thirds of any underground screen is dark matrix or mid-tone body rock. Shadows fall toward dark plum (
#1c1424), never neutral grey or pure black. Warm amber light (#ffc878) and bioluminescent glowcaps carry the focal points. - Lock the world before generating a single production asset. We first generated 17 approved visual references with
rd_pro__default,rd_pro__platformer, andrd_pro__painterly— one primary target scene (scene_rootlands_default, 256×144), mood boards for all six deeper layers (Hollow,Mycelium,Rustworks,Crystal Depths,Mantle,Abyss), creature turnarounds, a tinkerer's equipment sheet, and a UI kit sheet.
Every production asset afterward passed those locked references in reference_images and was judged against a strict luma value table (for example: dirt mean #3c2a21 luma 46, clay #8f583e luma 101, limestone #d4b891 luma 187).

2. Never call the API by hand: our one-command pipeline (tools/rd)
Once you are generating hundreds of sprites and textures, ad-hoc scripts waste runs and lose provenance. We built a single Python package (tools/rd) that owns every interaction with https://api.retrodiffusion.ai/v2:
- Content-hashed, idempotent specs. Every job lives in a declarative JSON file (
assets/jobs/*.json). A SHA hash covers the prompt, parameters, and the byte hashes of any input/reference images. Before sendingPOST /inferences, the tool writes a run record to disk with a freshIdempotency-Key. If a run is interrupted, rerunning polls the existingtask_idinstead of resubmitting. - Free estimates + hard budgets. Every run calls
"check_cost": truefirst and aborts if a batch exceeds--budget. - Catalog linting. Before any call leaves the machine,
tools/rdchecks dimensions, reference limits, and frame counts againstGET /v2/styles/selectorandGET /v2/edit/tools. It also rejects anti-patterns outright — writing"pixel art", pixel dimensions, or"transparent background"in a prompt, or settingbypass_prompt_expansion: true, is blocked by the linter. - Full provenance. Raw PNGs land in
assets/raw/, every request is logged with its exact spec and task ID, and only explicitly approved assets enterassets/approved/andASSET_MANIFEST.json.
A typical job spec looks like this:
{
"id": "textures/clay",
"style": "rd_craft__texture",
"size": [16, 16],
"count": 4,
"prompt": "Dense reddish-brown compacted clay, smooth heavy earth with soft mottled blotches of terracotta and rust, a few small dark inclusions, earthy mineral texture, restrained contrast"
}
Automated pixel QA (tools/rd/check.py)
Every image returned by Retro Diffusion is measured automatically as it arrives. A failing check blocks tools/rd approve unless explicitly waived with a recorded reason:
| Asset Type | Hard Failures (Block Approval) | Warnings (Require Visual Check) |
|---|---|---|
| **Sprites** | Partial alpha (`0 < a < 255`), background not removed (`coverage > 0.92`) | Stray pixels, detached islands, enclosed transparent holes, touching canvas edge (`margin == 0`) |
| **Textures** | Any transparency, visible wrap seam (`edge / interior > 1.5`), darker/lighter border ring, baked light gradient | Mild seam, per-pixel lone-pixel noise, harsh contrast, single bold feature that repeats as an icon |
| **Family Variants** | Size mismatch, mean color drift from base, off-family colors, seam against base | Contrast shift, barely changed from base |
| **Animations** | Single/empty frame, palette drift away from frame 0 | Size drift between frames, foot-line bounce, loop pop between last and first frame |
Here is the seam metric that saved us hours of squinting at tiled fields — it compares the mean RGB jump across the wrap edge against the average pixel-to-pixel jump inside the tile itself:
def seam(left, right):
"""1.0 means the wrap join is as quiet as the interior; above ~1.5 it shows."""
l, r = left[..., :3], right[..., :3]
inside = np.concatenate([
_dist(l[:, 1:], l[:, :-1]).ravel(),
_dist(r[:, 1:], r[:, :-1]).ravel(),
]).mean()
return float(_dist(l[:, -1], r[:, 0]).mean() / max(inside, 1.0))

3. Solving the tile grid: 16×16 families + ring inpainting + Voronoi shader
Even a mathematically seamless 16×16 tile betrays a grid the moment it fills a 427×240 cave screen. A single pebble or dark crumb repeating every 16 pixels turns an atmospheric cavern into wallpaper.
We solved this in two halves: how we generate a material family, and how our WebGL 2 shader draws it.
The variation experiment (exp02_variation_methods.json)
Starting from an approved 16×16 rd_craft__texture base tile, we benchmarked four ways to generate variants of the same material:
| Method | Measured Result | Role in Burrow |
|---|---|---|
| **`inpainting` with a 2-px locked ring mask** (`ring16_2.png`) | Repaints the 12×12 interior while keeping the outer 2-px border **pixel-identical** to the base. Swaps next to the base anywhere with zero seam. | **Primary method for `plain` variants** |
| **`rd_craft__texture` img2img (`strength: 0.40–0.45`)** | Preserves grain and palette while introducing pebbles, roots, cracks, or richer ore nuggets. | **Primary method for `feat` (feature) variants** |
| **`rd_craft__texture` img2img (`strength: 0.55–0.65`)** | Looser repaint, still on-family when the calmest of 4 candidates is picked. | Secondary `plain` variants |
| **`rd_craft__texture` with `reference_images`** | Mean brightness drifted 10–22 levels and contrast spiked. **Not a family.** | Never used for texture variants |
We also learned three prompt rules the hard way:
- Describe clusters, never speckles. Words like
"coarse speckled"produced 28–43% lone single-pixel noise. Asking for"soft organic clusters","mottled blotches", and"restrained contrast"fixed it immediately. - Let the world generator draw strata and veins. Prompting
"sedimentary layering"broke seams in 3 of 4 limestone candidates; prompting"vein"on copper ore created one repeating icon. Asking for"one continuous chalky rock face"and"a few small scattered nuggets embedded in the rock"gave clean, tileable surfaces. - Judge values under the game's actual light. In the Abyss, teal gloom turned a luma-40 navy tile bright royal blue. We switched
voidstoneto near-neutral black-graphite (luma 33) and let the renderer's light supply the blue.

Try the Voronoi shader live
Below is a live port of Burrow's web/shaders.js running on six real 16×16 Retro Craft material families straight from the game. Switch materials, flip between naive 16×16 repeat and Voronoi patching, toggle the patch boundaries, or hover any pixel to see which 16×16 family tile it sampled:
In the WebGL 2 renderer, every material is uploaded as a sampler2DArray (base + plain1–3 + feat1–2). Instead of sampling w & 15, web/shaders.js warps world coordinates with smooth value noise, finds the nearest Voronoi patch center, and samples a random plain member at a random tile offset. Feature tiles (feat1–2) only appear through ragged circular windows inside rare, noise-clustered pockets:
// Natural ground is laid in ragged Voronoi patches, each with its own plain
// member at its own offset, so nothing repeats on a grid.
vec2 q = (vec2(w) + (vec2(vnoise(vec2(w) / 5.0 + 31.0),
vnoise(vec2(w) / 5.0 + 87.0)) - 0.5) * 11.0) / 21.0;
// ... find closest Voronoi cell `at` ...
off = ivec2(vec2(hash(at + ivec2(mi * 29, 311)),
hash(at + ivec2(733, mi * 37))) * 15.99);
layer += int(hash(at + ivec2(mi * 131, 977)) * float(plains) * 0.9999);
c = texelFetch(u_img, ivec3((w + off) & 15, layer), 0).rgb;
Where two materials meet, drawnAs() offsets the boundary by ±2 cells of noise so rock strata interlock like natural geology instead of straight lines — without ever alpha-blending two materials into mud. Every texture is albedo only; our 2D Radiance Cascades pass computes light transport, rock light-soak, and cool plum gloom dynamically at ~1.2 ms per frame.
4. Routing across four Retro Diffusion model families
The biggest leverage in the Retro Diffusion API isn't finding one "best" model — it's knowing which model shines at which pixel resolution and geometry:
| Asset Class | RD Model / Tool | Native Size | Why This Model Won |
|---|---|---|---|
| **Terrain tiles** | `rd_craft__texture` | 16×16 | Seamless by design; accepts `input_image` + `strength` for feature variants. |
| **Small items, parts, props** | `rd_craft__item` | 16–32 px | Clean transparent silhouettes; 3 approved icons in `refs` lock a whole set together. |
| **Micro creatures & side fixtures** | `rd_core__platformer` | 12–32 px | **Beats Pro below 16 px.** Clean silhouettes and level side elevations (non-square 24×16 / 32×16 works great). |
| **Hero references, bosses, UI** | `rd_pro__platformer`, `rd_pro__default` | 40–256 px | Unmatched form shading, texture richness, and multi-reference adherence (up to 9 `refs`). |
| **UI kits & title logo** | `rd_pro__ui_panel`, `rd_pro__typography` | 208×80 / 256×256 | Generates cohesive multi-element UI kits and custom illustrative logos in one shot. |
| **Creature & boss motion** | `rd_advanced_animation__*` | 32–96 px | Preserves palette and form on padded canvases; `walking`, `idle`, `attack`, `destroy`, `custom_action`. |
| **Exact state & border edits** | `inpainting` | 12–16 px | Keeps every unmasked pixel bit-for-bit intact (ring tile variants & HUD hearts). |
5. Micro creatures, towering bosses, and frame-by-frame motion
Because one cell equals one art pixel, Burrow's world is small and intimate. The player mole is drawn at 10×11 cells (the one intentional exception to our RD-only rule — rendered directly in game/mole.rs so its silhouette stays ultra-crisp at micro scale). Everything else around it — 28 underground creatures, 6 layer bosses, 79 props, 28 fixtures, 107 items, and 12 held tools — comes from Retro Diffusion.
The 16-pixel boundary: why RD Core beat RD Pro for small fauna
When we piloted 12×12–16×16 creatures on rd_pro__platformer, Pro fell apart: a grub came back as an olive mound, a cave fish as a grey blob, a moth as a square of noise, and each request took over a minute. Switching to rd_core__platformer at 16×16 (and 20–32 px for long creatures like worms and magma swimmers) solved it overnight — crisp, readable animals with bold dark warm outlines in seconds.
One small prompt detail mattered enormously: without explicitly adding "No ground, no floor and no shadow under it, on a plain white background", Core liked to stand creatures on a tiny strip of dirt. Adding that sentence, keeping remove_bg: true on every sprite, and requesting generous canvas margin eliminated almost all retakes.
Meanwhile, rd_pro__platformer dominated the 48–64 px layer bosses (The Old Badger, Great Worm, Elder Bloom, The Foreman, Sump Pump, Crystal Lens), where the extra canvas room let Pro shine with shaggy fur, corroded brass, glowing spores, and faceted crystal.
And for wide, floor-resting fixtures (beds, altars, sarcophagi, mine carts, girders), rd_craft__item tended to draw them diagonally like isometric inventory icons. Moving them to rd_core__platformer at non-square sizes (24×16, 32×16) with "seen exactly from the side, standing level on the ground" gave clean side elevations in the exact same hand.
Padding before animation (33 of 33 usable on take 1)
rd_advanced_animation__* requires a canvas at least 32×32, and content within 3 pixels of the canvas edge animates badly — limbs clip, wings stall, jumps hit an invisible ceiling.
Our lossless local utility (tools/rd/local.py) pads every approved 12–16 px creature onto a roomy 32×32 canvas with feet resting 4 pixels above the bottom edge (and bosses onto 64×64 or 96×96 canvases) before calling walking, idle, attack, or destroy. The prompt names only the motion ("scuttling forward to the right on its short legs in a steady march, shell bobbing slightly"), never re-describing the character.
The payoff: 33 of 33 small creature movement and attack animations came back usable on the first take. At 16×16, there is too little noisy detail for the animation model to hallucinate or drift.
And when an animation model does fight a design? Listen to it. Our original beetle was a stag beetle with twin mandibles — across three animation takes, the model fused those twin mandibles into a single curved horn. Rather than fighting it for ten more takes, we made it a rhinoceros beetle, and every animation since stayed rock-solid on model.

Inspect the live animations and padding guides
Step through seven real approved Burrow animation sheets below — four 16×16 RD Core micro creatures padded to 32×32 and three 64 px RD Pro layer bosses padded to 96×96. Toggle the padding and foot-line guides, switch between walk and attack cycles, or click any frame to inspect it pixel by pixel:
6. UI kits, pixel-locked heart states, and the BURROW logo
We applied the same "never fight the model" mindset to the interface (if you want a deeper dive into cutting one UI sheet into reusable frames, see our one-image game UI guide):
- Treat
rd_pro__ui_panelas a kit sheet. Passing our lockedui_panelsreference caused Pro to regenerate a rich 256×256 sheet of carved-wood borders, brass corners, sockets, and buttons. Instead of trying to prompt individual 18×18 pieces from scratch, we cut the best pieces out losslessly (local cut), stitched 9-slice frames together (local nine), and cleaned unwanted insets with maskedinpainting. - Use masked
inpainting— notimage_edit— for tiny sprite states. On a 12×12 HUD heart,image_editreturned an opaque white background and softened the outline, and runningbackground_removerate the rim. Instead, we created two tiny masks (heart12_right.pngandheart12_inner.png) and raninpaintingdirectly on the approved full heart. Because unmasked pixels are preserved verbatim, the full, half, and empty hearts share the exact same outer rim down to the single pixel. - Shrink held tools with RD Pro +
refs. Retro Craft's smallest canvas is 16×16, which made a hand drill look as long as our 10-pixel mole. Passing each finished 16×16 Craft tool as a reference tord_pro__defaultat 12×12 cleanly redrew all 12 tools at paw-sized scale — the one case where Pro held up below 16 px, because it was simplifying a finished reference rather than inventing form from scratch. - One request for the title logo.
rd_pro__typographyat208×80generated the completeBURROWlogo — carved timber letters, turf, hanging roots, and a headlamp-wearing mole peeking out of the O — with 4 of 4 takes usable.

7. Production breakdown: 791 API calls across 17 hours
Every generation and edit in the pipeline is tracked in ASSET_MANIFEST.json and assets/metadata/. Here is the complete breakdown of what each Retro Diffusion model produced:
| Model / Tool | Requests | Candidate Images | Used For |
|---|---|---|---|
| `rd_craft__item` | 290 | 695 | 65 crafting/item icons, lower-layer props, small fixtures |
| `rd_craft__texture` | 122 | 464 | 23 seamless 16×16 terrain families (bases + img2img variants) |
| `rd_pro__default` | 70 | 223 | Locked references, large props, 12 px held tools, small UI sprites |
| `rd_advanced_animation__*` | 147 | 147 | Creature & boss walks, idles, attacks, deaths, custom actions |
| `rd_core__platformer` | 37 | 87 | 28 micro-scale creatures & wide side-elevation fixtures |
| `rd_pro__platformer` | 30 | 78 | Hero scene references & 6 layer bosses |
| `inpainting` | 52 | 52 | 2-px ring-inpainted tile variants, pixel-exact hearts, UI cleanup |
| `rd_tile__tileset_advanced`, `image_edit`, `seam_tiling`, utilities | 36 | 36 | Material transition references, backdrop tiling, downscaling |
| `rd_pro__painterly` + `ui_panel` + `typography` + `spritesheet` | 7 | 22 | Surface backdrop, UI kit sheets, BURROW logo |
| **Total Pipeline** | **791** | **1,804** | **529 approved assets (911 PNGs, 658 game sprites)** |

7 rules you can steal for your own game
- Lock style references before touching production assets. Generate
rd_promood boards and character turnarounds first, then pass them inreference_imageseverywhere. - Wrap the API in an idempotent CLI with free
check_costdry runs. SaveIdempotency-Keyandtask_idto disk before every POST, and automate pixel QA (seams, clipping, partial alpha, loop drift) so bad takes never slip into your build. - Never ship a single terrain tile. Build a 4-to-6-tile family from one
rd_craft__texturebase using 2-px ringinpaintingfor zero-seam plain variants andstrength: 0.4img2img for rare feature variants, then break up repetition in your shader with Voronoi patching. - Match the model to the pixel count.
rd_core__platformerbeatsrd_pro__platformerbelow ~16 px;rd_prodominates 40–256 px heroes, bosses, and backdrops;rd_craft__itemowns 16–32 px transparent icons. - Pad generously before calling
rd_advanced_animation. Keep at least 3–4 pixels of empty margin around sprites (pad 16 px sprites to 32×32, 40+ px bosses to 64–96) and prompt only the motion. - Use masked
inpaintingfor micro sprite states. When an outline cannot shift by even a single pixel (hearts, switches, tiles), mask only the interior and letinpaintingpreserve the border verbatim. - Keep assets albedo-only and let your renderer light the world. Evenly lit tiles and sprites let real-time lighting, gloom, and atmosphere unify every biome seamlessly.
Every metric, prompt, GLSL shader snippet, and PNG in this post comes directly from Burrow's production repository, built with the Retro Diffusion v2 API.
Frequently asked questions
Which Retro Diffusion model should I use for 16x16 terrain tiles and small sprites?
Use rd_craft__texture for seamless 16x16 terrain tiles, rd_craft__item for 16-32 px transparent icons and props, and rd_core__platformer for 12-32 px creatures and side-elevation fixtures. Save rd_pro__platformer and rd_pro__default for 40-256 px hero references, bosses, UI sheets and backdrops.
How do you stop a seamless 16x16 pixel art tile from looking repetitive?
Generate a 4-to-6-tile family from one rd_craft__texture base: lock the outer 2-pixel border with a mask and use inpainting for zero-seam plain variants, run low-strength img2img (0.40-0.45) for rare feature tiles, and sample the family in your shader with noise-warped Voronoi patches and random tile offsets.
How do you get clean pixel art sprite animations on the first take?
Pad sprites generously before calling rd_advanced_animation — keep at least 3 to 4 pixels of empty margin around the sprite (for example, pad 16x16 creatures to 32x32 with feet 4 px up, and 48-64 px bosses to 96x96) and describe only the motion in the prompt.
How do you edit small HUD sprites like 12x12 hearts without shifting the outline?
Use masked inpainting rather than general image editing. Mask only the interior pixels you want to change so every unmasked pixel on the border stays bit-for-bit identical across full, half and empty states.
Can you automate an entire game's pixel art with the Retro Diffusion API?
Yes. Wrap POST /v2/inferences with content-hashed job specs, Idempotency-Key tracking, free check_cost dry runs, reference_images style locking, and automated pixel QA checks for seams, partial alpha, canvas margin and frame drift.

