Case study

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.

Burrow running live with its finished Retro Diffusion assets: 23 seamless terrain families, 28 micro creatures, 6 layer bosses, 65 crafting items and a 9-sliced UI kit under 2D Radiance Cascades lighting.

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 discarded single-take dirt, clay and limestone tiles repeating on a rigid 16x16 gridApproved 16x16 Retro Craft dirt, clay and limestone families laid with Voronoi patching and ragged geological joinsEarly single-take tilesRetro Craft + Voronoi

We scrapped both early sets and wrote two rules before generating anything else:

  1. 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.
  2. Lock the world before generating a single production asset. We first generated 17 approved visual references with rd_pro__default, rd_pro__platformer, and rd_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).

The 7 locked RD Pro biome references at 256x144 native alongside Burrow's value table
The 7 locked rd_pro biome references (256×144 native) and value table that anchored every downstream generation.

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 sending POST /inferences, the tool writes a run record to disk with a fresh Idempotency-Key. If a run is interrupted, rerunning polls the existing task_id instead of resubmitting.
  • Free estimates + hard budgets. Every run calls "check_cost": true first and aborts if a batch exceeds --budget.
  • Catalog linting. Before any call leaves the machine, tools/rd checks dimensions, reference limits, and frame counts against GET /v2/styles/selector and GET /v2/edit/tools. It also rejects anti-patterns outright — writing "pixel art", pixel dimensions, or "transparent background" in a prompt, or setting bypass_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 enter assets/approved/ and ASSET_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 TypeHard 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 gradientMild 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 baseContrast shift, barely changed from base
**Animations**Single/empty frame, palette drift away from frame 0Size 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))
Three real QA failure case studies from assets/rejected compared with their approved fixes
Real failures preserved in assets/rejected/ and how each changed our pipeline rules — canvas edge clipping on 32×32 RD Pro sprites, seamed sedimentary stripes in limestone, and stag beetle mandibles morphing during animation.

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:

MethodMeasured ResultRole 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 voidstone to near-neutral black-graphite (luma 33) and let the renderer's light supply the blue.
Diagram of Burrow's 16x16 dirt texture family pipeline, ring mask, naive repeat vs Voronoi shader, and in-game Radiance Cascades lighting
Top — how one 16×16 rd_craft__texture base becomes a 5-tile family via 2-px ring inpainting and img2img. Bottom — copper_ore tiled naively vs. Burrow's Voronoi shader vs. the exact same tiles lit live in-game.

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:

LIVE SHADER PORTVoronoi terrain patcher (16×16 Retro Craft families)
Basebase
Plain 1ring
Plain 2ring
Plain 3ring
Feat 1img2img
Feat 2img2img
Ragged circular pockets reveal img2img feature tiles (ore clusters, pebbles, roots) only inside rich veins. Hover the terrain to inspect which 16×16 tile member each cell samples.

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 ClassRD Model / ToolNative SizeWhy This Model Won
**Terrain tiles**`rd_craft__texture`16×16Seamless by design; accepts `input_image` + `strength` for feature variants.
**Small items, parts, props**`rd_craft__item`16–32 pxClean 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 pxUnmatched 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×256Generates cohesive multi-element UI kits and custom illustrative logos in one shot.
**Creature & boss motion**`rd_advanced_animation__*`32–96 pxPreserves palette and form on padded canvases; `walking`, `idle`, `attack`, `destroy`, `custom_action`.
**Exact state & border edits**`inpainting`12–16 pxKeeps 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.

Lineup of 12 RD Core micro creatures, 6 RD Pro layer bosses, and full 8-frame RD Advanced Animation strips for spider and Old Badger
Top — rd_core__platformer micro-scale creatures (12–22 px) beside rd_pro__platformer layer bosses (48–64 px). Bottom — complete 8-frame rd_advanced_animation__walking sheets with foot-line reference guides.

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:

LIVE ANIMATION INSPECTORPadded sprites through RD Advanced Animation
RD Corerd_core__platformerNative 16×16 → padded 32×32 (6× view)
Frame 1 / 8
Dashed blue shows the original 16×16 sprite; the lime line marks the foot plane 4 px above the bottom edge. Click any frame to pause and inspect pixel-for-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_panel as a kit sheet. Passing our locked ui_panels reference 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 masked inpainting.
  • Use masked inpainting — not image_edit — for tiny sprite states. On a 12×12 HUD heart, image_edit returned an opaque white background and softened the outline, and running background_remover ate the rim. Instead, we created two tiny masks (heart12_right.png and heart12_inner.png) and ran inpainting directly 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 to rd_pro__default at 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__typography at 208×80 generated the complete BURROW logo — carved timber letters, turf, hanging roots, and a headlamp-wearing mole peeking out of the O — with 4 of 4 takes usable.
UI panel reference sheet sliced into frames and sockets, masked heart state progression, 16px to 12px tool trick, BURROW logo, and in-game Tool Bench
Left — rd_pro__ui_panel kit cut losslessly into 9-slice frames, sockets, and buttons. Center — pixel-locked heart states via inpainting masks and the 16 px → 12 px held-tool trick. Right — rd_pro__typography BURROW logo and the live in-game Tool Bench.

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 / ToolRequestsCandidate ImagesUsed For
`rd_craft__item`29069565 crafting/item icons, lower-layer props, small fixtures
`rd_craft__texture`12246423 seamless 16×16 terrain families (bases + img2img variants)
`rd_pro__default`70223Locked references, large props, 12 px held tools, small UI sprites
`rd_advanced_animation__*`147147Creature & boss walks, idles, attacks, deaths, custom actions
`rd_core__platformer`378728 micro-scale creatures & wide side-elevation fixtures
`rd_pro__platformer`3078Hero scene references & 6 layer bosses
`inpainting`52522-px ring-inpainted tile variants, pixel-exact hearts, UI cleanup
`rd_tile__tileset_advanced`, `image_edit`, `seam_tiling`, utilities3636Material transition references, backdrop tiling, downscaling
`rd_pro__painterly` + `ui_panel` + `typography` + `spritesheet`722Surface backdrop, UI kit sheets, BURROW logo
**Total Pipeline****791****1,804****529 approved assets (911 PNGs, 658 game sprites)**
KPI summary cards, horizontal generation volume bar chart by Retro Diffusion model, and 6 real 1080p in-game stills across Burrow's biomes
The full production breakdown (529 approved assets across 791 requests in 17 hours) alongside six real 1080p gameplay stills running the finished Retro Diffusion assets under Burrow's WebGL 2 Radiance Cascades lighting.

7 rules you can steal for your own game

  1. Lock style references before touching production assets. Generate rd_pro mood boards and character turnarounds first, then pass them in reference_images everywhere.
  2. Wrap the API in an idempotent CLI with free check_cost dry runs. Save Idempotency-Key and task_id to disk before every POST, and automate pixel QA (seams, clipping, partial alpha, loop drift) so bad takes never slip into your build.
  3. Never ship a single terrain tile. Build a 4-to-6-tile family from one rd_craft__texture base using 2-px ring inpainting for zero-seam plain variants and strength: 0.4 img2img for rare feature variants, then break up repetition in your shader with Voronoi patching.
  4. Match the model to the pixel count. rd_core__platformer beats rd_pro__platformer below ~16 px; rd_pro dominates 40–256 px heroes, bosses, and backdrops; rd_craft__item owns 16–32 px transparent icons.
  5. 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.
  6. Use masked inpainting for micro sprite states. When an outline cannot shift by even a single pixel (hearts, switches, tiles), mask only the interior and let inpainting preserve the border verbatim.
  7. 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.