Daniel White's Sprite Stacking Turns Four Pixel-Art Views Into Rotatable 3D Game Assets
A new agent skill pipes four pixel art views into a voxel carver and spits out spinnable fake-3D sprites, with a browser viewer and export sheet included.
Takeaways
- Sprite Stacking is an agent skill that turns four pixel art views into fake-3D rotatable sprites.
- Works with Claude Code, Codex, Cursor, OpenCode, Gemini CLI and Pi via the Vercel skills CLI.
- A voxel survives only where all four orthographic views overlap, then gets sliced into stacked layers.
- Python CLI exposes slice count, round carving, palette control, normal maps and emissive masks.
- Standalone HTML viewer ships turntable, scene, drive, wind, shatter, day-night cycle, rain and snow modes.
- Exports 16-direction baked PNG sprite sheets for drop-in use in any 2D engine.
Daniel White’s GitHub repository packages sprite stacking as an agent skill for Claude Code, Codex, Cursor, OpenCode, Gemini CLI, and Pi. Give the agent top, side, front, and back views of an object, and the included tools generate a layered sprite that can rotate, respond to lighting, and export to a 2D game engine. The project attracted more than 1,000 GitHub stars during its first week.
Sprite stacking renders a solid-looking object from flat horizontal slices. Each slice receives a small vertical offset, and every output angle rotates the full stack. The technique gives 2D games much of the visual depth of voxel art while keeping assets in a sprite-based pipeline. White’s project adds four-view carving, a Python CLI, lighting maps, a browser viewer, and instructions that coding agents can invoke.
Four silhouettes carve one volume
The reconstruction starts with a single image containing four aligned orthographic views in one row. Each pixel in the proposed volume is projected against the top, side, front, and back silhouettes. A voxel survives only when all four views include it.
- Prepare the source: Arrange clean top, side, front, and back views on one sheet.
- Carve the volume: Intersect the four silhouettes on a voxel grid.
- Build the stack: Cut the volume into horizontal layers and place the ground layer first.
- Render an angle: Rotate each layer, compress it vertically to set the viewing pitch, and raise successive layers by one pixel.
- Export the asset: Write the layer strip, optional lighting maps, viewer, or baked directional sprites.
The carving method produces a visual hull, the volume consistent with every supplied silhouette. It works well for chunky vehicles, trees, buildings, and props with readable outlines. Hidden cavities and details absent from the silhouettes cannot be recovered, while misaligned views can remove valid voxels or add unwanted mass. Consistent dimensions and outlines therefore matter more than fine shading in the source sheet.
Install it where agents can find it
The Vercel skills CLI installs the package into the current project:
npx skills add danielwh2/sprite-stacking
The installer also supports global installation and agent-specific targets. For manual setup, copy skills/sprite-stacking into the skills directory used by the chosen coding agent.
Prompts can describe the asset and desired output in ordinary language:
Make a rotatable pixel art car.Sprite stack this four-view sheet and create a turntable.Add a fake 3D pixel art tree to my Godot game.
If the agent has access to an image generator, it can use generated orthographic views as input. In text-only environments, the skill can create those views with a short Python script, keeping the workflow self-contained.
The CLI controls shape, palette, and light
The underlying slicer runs on Python 3 with Pillow and NumPy. Its main options control geometric detail and the auxiliary textures required by a game engine.
| Option | Effect | Typical use |
|---|---|---|
--slices N |
Sets the number of horizontal layers. | Use 15 to 20 for a chunky style or 32 to 48 for finer detail. |
--round |
Applies cylindrical carving. | Useful for towers, balloons, pots, and other rounded forms. |
--colours N |
Limits all slices to a shared palette. | Keeps color treatment consistent across the asset. |
--normals |
Writes a matching normal-map strip. | Allows supported engines to calculate dynamic lighting. |
--emissive |
Detects bright regions and writes an emissive mask. | Targets headlights, windows, signs, and neon accents. |
A normal map stores the apparent surface direction at each pixel, allowing engine lights to shade the stack as the object turns. An emissive mask identifies pixels that should remain luminous in dark scenes. Automatic bright-region detection may require inspection when an asset contains pale paint or other non-luminous highlights.
The browser viewer doubles as a test bench
The --html flag writes a standalone viewer for checking geometry, animation, lighting, and effects before integrating the asset into a game. Its modes cover both presentation and diagnosis:
- Turntable: Rotates the completed stack.
- Scene: Places the asset among Neon Street or Meadow Island procedural props.
- Slice scan: Displays the model layer by layer.
- Exploded view: Separates layers to expose the stack’s construction.
- Play: Adds WASD driving, drifting, and procedurally extended worlds.
- Effects: Includes wind sway, shattering, and rebuilding.
Lighting controls include a Day, Sunset, and Night cycle; automatic emissive glow; ground light pools; a draggable sun; and projected shadows. Weather effects add rain, ripples, reflected scenery, and snow accumulation based on the upward component of each voxel’s normal.
The rendering pipeline uses a zero-allocation typed-array software rasterizer with cached sprites keyed by viewing angle and lighting state. NumPy handles the voxel carving stage. The repository reports frame times of roughly 0.2 to 1.5 milliseconds in Chrome, although browser, hardware, scene complexity, and effect settings will affect results.
For engine integration, the tool can bake a 16-direction PNG sprite sheet. That export works with conventional directional-animation systems in 2D engines, while the layer strip, normal map, and emissive mask support more dynamic renderers.
A repeatable asset pipeline for small teams
Sprite stacking predates this repository as an indie game technique. White’s contribution combines visual-hull carving with an agent-facing workflow and practical export tools. The Python implementation also makes generation repeatable, which helps teams keep source views and generated assets under version control.
The approach suits solo developers, game-jam teams, and projects built around chunky pixel art. Artists still need four consistent views, and complex concave geometry may require a dedicated 3D tool. For suitable assets, the skill moves the repetitive carving, slicing, palette reduction, and export work into a deterministic command-line process while the coding agent handles project-specific integration.