sprite-stacking is an open-source agent skill by Daniel White that turns four pixel art views of an object (top, side, front and back) into a "sprite stack": a strip of flat slices that a game draws on top of each other to fake a 3D object you can spin. It works with Claude Code, Codex, Cursor, OpenCode, Gemini CLI and Pi. The repository was created on 20 November 2026 and had 187 stars when we checked on 21 November 2026. It is MIT-licensed.
This guide covers what sprite stacking is, what the skill adds, how to install it, what you need to give it, and where it falls short. Every command below is copied from the repository's README or its SKILL.md. We read the files on 21 November 2026 but did not run the skill ourselves, so the outputs described are what the docs say should happen.
What sprite stacking is
A sprite stack is a top-down object cut into horizontal layers, like a loaf of bread sliced from the floor up. The game draws the layers bottom to top. Each one is rotated by the same angle, squashed vertically for the camera's pitch, and lifted 1 pixel above the layer before it. The result looks like a small voxel model that turns smoothly, but it's still plain 2D drawing: no 3D engine, no meshes, and every angle stays in crisp pixels.
The README is clear that the technique is not new: "Sprite stacking is a long-standing indie game technique, not invented here." What the skill adds is the four-view carving and an agent workflow around it.
The usual pain point is drawing the slices. A 30-slice car means 30 small images that must line up. The skill skips that: you (or your agent) draw four ordinary views, and a script carves the slices from them.
What the skill does
The README describes four steps:
- Views: a sheet with top, side, front and back views, orthographic, in one row.
- Carve: a voxel is kept only where all four views cover it.
- Slices: the carved volume is cut into a strip of flat layers, ground layer first.
- Render: each layer is rotated, squashed for pitch and lifted 1 px.
The skill folder holds:
SKILL.md, the instructions your agent reads: how to get a good four-view sheet, a checklist before slicing, the slicer's flags, the render loop and its numbers, a "done when" checklist, and a table of past mistakes with their fixes.scripts/views_to_slices.py, the slicer. It removes the background, strips the 1px outlines around each view, reduces everything to one shared palette, carves the slices, and can write a check image and a standalone viewer page.scripts/viewer.html, a browser viewer that also opens on its own and accepts dropped slice strips.references/engines.md, short recipes for web Canvas and React, Godot 4, Unity, and Phaser, Pygame or anything else.
Install it in Claude Code or Codex
The README's one-line install uses the skills CLI, which needs Node 22.20 or later:
npx skills add danielwh2/sprite-stacking
That installs the skill into the current project. According to the README, add -g to install it for every project, and -a claude-code (or codex, cursor and so on) to pick which agent it goes to.
The other option is to copy the skills/sprite-stacking folder from the repository into your agent's skills folder:
| Agent | Folder |
|---|---|
| Claude Code | ~/.claude/skills/ |
| Codex, Cursor, OpenCode, Gemini CLI, Pi | ~/.agents/skills/ |
The slicer is a Python script, so you also need Python 3 with Pillow and NumPy. The README's command:
pip install pillow numpy
Use it: what to ask your agent
You don't call the skill by name. Once it's installed, ask for what you want and the agent picks it up. The README's examples:
- "Make a rotatable pixel art car."
- "Sprite stack this 4-view sheet and give me a turntable."
- "Add a fake 3D pixel art tree to my Godot game."
SKILL.md tells the agent to choose a path based on what you give it:
- A slice strip PNG or a MagicaVoxel layer export: it goes straight to rendering.
- A four-view sheet: it checks the sheet, then carves it.
- Only a prompt or an idea: it first makes the four-view sheet, then carves and renders.
If you have no sheet, the agent uses an image generation tool when it has one, with a prompt written out in SKILL.md. If it has none, it draws the four views itself as pixel art in a short Python script. The README puts it simply: "No image generator? The agent draws the views itself in a short Python script."
In an existing game, SKILL.md tells the agent to read your renderer first (engine, pixel scale, how sprites are drawn and sorted) and fit the stack into it, never adding a second canvas or render pipeline.
What input it needs
The four-view sheet has strict rules, and most bad results come from breaking them. From SKILL.md:
- One row in the order TOP, SIDE, FRONT, BACK, on flat white, with clear gaps between views.
- TOP looks straight down, with the object's front pointing down. SIDE has the front pointing left.
- Strictly orthographic: no perspective, no tilt, no 3/4 view.
- The same scale in all four views: TOP length equals SIDE length, TOP width equals FRONT and BACK width, SIDE height equals FRONT and BACK height.
- Flat colour fills and crisp outlines. Soft airbrushed edges and thin 1px inner lines smear once the slices rotate, and the skill says to redraw rather than try to save them.
It also gives three size tiers:
- Chunky retro: 15 to 20 slices, about 25×48 px, shown at 8 to 10× scale.
- Detailed hi-bit: 26 to 44 slices, 36×72 to 46×107 px, enough for vents, logos and spoked rims.
- Showcase / 1080p video: 36 to 56 slices, 30×30 to 148×148 px, shown at 4 to 6× scale.
Run the slicer yourself
The agent normally runs the slicer, but you can run it from the repository root with the README's command:
python3 skills/sprite-stacking/scripts/views_to_slices.py views.png slices.png \
--slices 36 --preview check.png --html viewer.html
views.png is your four-view sheet and slices.png is the slice strip it writes. The flags the README lists:
--slices N: number of layers. 15 to 20 for chunky, 32 to 48 for detailed.--order reading: force the TOP, SIDE, FRONT, BACK order. By default the script matches views by their proportions.--round: carve towers, balloons and pots round instead of square.--side-nose right: use this when the SIDE view faces right.--colours N: size of the shared palette;0keeps every colour.--normals path.png: also save a matching normal-map slice strip.--emissive path.png: also save an auto-detected glow mask (headlights, windows, neon).
SKILL.md lists a few more, including --top-nose (pass down for anything that isn't a vehicle), --shade, --bg-tol and --dark-thresh.
check.png shows the four extracted views, four turntable angles and an exploded view. The skill tells the agent to look at it before writing any game code.
The viewer
--html writes a standalone page. According to the README it has a turntable, a Scene mode with procedural props, a slice scan, an exploded view, and a Play mode where you can drive with WASD or the arrow keys. It also has time of day, a draggable sun with shadows, rain and snow, and an export button that bakes a 16-direction PNG sprite sheet. That last one is handy if your engine just wants ordinary directional sprites.
Getting it into a game
The render loop is the same everywhere: for each slice from the ground up, rotate it around its centre, scale y by the squash value, lift it by its index times the spacing, snap to whole pixels, and draw with nearest-neighbour filtering. SKILL.md gives the defaults: spacing 1.0 and squash 0.75 for an angled top-down camera (1.0 looks straight down). references/engines.md has a ready-made Canvas 2D function and a Godot 4 Node2D script, and notes for Unity (one SpriteRenderer per slice, Point filter) and for Phaser or Pygame.
Two tips from the skill matter for performance and looks. Sort whole stacks by their ground point and never interleave slices of two objects. And bake static stacks into plain sprites when the game loads: the skill points out that 200 trees of 30 slices each would be 6,000 draws a frame.
Limits
These come from the skill's own checklist and its table of past mistakes:
- Hidden hollows fill in. The carve keeps only what all four silhouettes cover, so a truck bed or a hollow arch that none of the views shows comes out solid. Overhangs that show daylight in the side view, like a raised rear wing, survive. Hollows have to be fixed by hand after carving.
- Round parts carve square unless the top view has a pixel circle, or you pass
--roundwhen the round part is narrower than its base. - 1px parts blink in and out as the stack turns. Posts, ropes and antennas need to be at least 2px wide; the slicer prints a warning.
- Protrusions become ledges. Something sticking out of a wall, like a flower box or a sign, carves a ledge along the whole wall. Paint small ones flat.
- Enclosed gaps carve solid. Background fully enclosed inside a view (between legs, fins or ropes) is treated as part of the object. Every gap must reach the outside of its view.
- Off-centre objects wobble. The stack spins around the middle of its bounding box, so centre the object in its views.
- Pixel art only. The technique and the slicer are built for small, flat-shaded sprites. It's not a way to get a real 3D model for a three.js or Unity 3D game.
Licence
The repository is under the MIT License (copyright 2026 Daniel White), shown on GitHub and in its LICENSE file. You can use, change and ship it in commercial projects as long as you keep the copyright and licence notice with copies of the code. The README does not say anything about the licence of sprites you make with it.
FAQ
What is sprite stacking?
A way to fake 3D in a 2D game. An object is stored as a strip of flat top-down slices, and the game draws them bottom to top, each rotated by the same angle and lifted 1 pixel. It looks like a small voxel model that turns, while staying in crisp pixel art.
Is the sprite-stacking skill free?
Yes. It is open source under the MIT License. You only need Python 3 with Pillow and NumPy, and Node 22.20 or later if you install it with npx skills. Your AI agent's subscription or API use is separate.
Does it work with Claude Code and Codex?
Yes. Both are listed in the README. Install with npx skills add danielwh2/sprite-stacking (with -a claude-code or -a codex to pick the agent), or copy skills/sprite-stacking into ~/.claude/skills/ for Claude Code or ~/.agents/skills/ for Codex.
Do I need an image generator?
No. If your agent has one, the skill gives it a prompt for the four-view sheet. If not, the agent draws the views itself in a short Python script. You can also hand it a sheet you drew, a slice strip, or a MagicaVoxel layer export.
Can I use the result in Godot, Unity or Phaser?
Yes. references/engines.md has a Godot 4 script, notes for Unity, a Canvas 2D function for the web and React, and the general loop for Phaser and Pygame. The viewer can also export a 16-direction PNG sprite sheet for engines that want ordinary sprites.
Why do parts of my sprite come out solid or square?
The slicer keeps a voxel only where all four views cover it. Hollows hidden from every view fill in, round parts need a circle in the top view or the --round flag, and gaps fully enclosed inside a view carve solid. The Limits section above lists the fixes.
Related guides
- Game dev agent skills and MCP servers: more skills for Godot, Unity, three.js, pixel art and sprites.
- Blender MCP: when you need a real 3D model instead of a sprite stack.
- Polyfork free 3D models: free low-poly GLBs for three.js games.
Sources
Checked 21 November 2026: danielwh2/sprite-stacking README, SKILL.md, references/engines.md, LICENSE, and the repository details on GitHub (created 20 November 2026; 187 stars on 21 November 2026).
Made a game with sprite-stacked cars or props? Submit it to VibeGamer.



