**Use for**: a character, a rider, trees, props or a moon as flat images in a 3D scene, a "paper theatre" or stop-motion look, a hero seen mostly from one side. **Status**: the method comes from a verified demo (a cut-out rider with a pedalling rig and turned views, sprite trees on scrolling banks); the scripts below pass their offline checks and have not yet been run in Play.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Sprites?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/josazar-sprites)
<!-- sub-skill of endless-scene: read ../../SKILL.md first (shared rules, build order) -->
# Sub-skill: sprites (2.5D cut-outs from generated images)
**Use for**: a character, a rider, trees, props or a moon as flat images in a 3D scene, a "paper theatre" or
stop-motion look, a hero seen mostly from one side. **Status**: the method comes from a verified demo (a cut-out
rider with a pedalling rig and turned views, sprite trees on scrolling banks); the scripts below pass their offline
checks and have not yet been run in Play.
## When a sprite beats a mesh
The camera sees the subject from a narrow range of angles (a chase camera behind a rider, trees passing at the
side), and the image carries the style (felt, paint, paper) better than a material would. Outside that range, use
turned views (rule 4) or a mesh.
## Build
1. **One sheet per subject**, all parts at the same scale, on a flat screen colour the subject does not wear (green,
or magenta for a green coat), from the camera's angle: parts separate (body, each leg, vehicle, loose accessories)
so they can be rigged. For trees or a loop: one row per kind, frames along the row, on a regular grid. The prompts
and the choice between a sheet, a Spline generation and a 3D model are in
[references/hero.md](../../references/hero.md).
2. **Key it and write its layout by script**, never by eye:
`node subskills/sprites/scripts/key.mjs sheet.png keyed.png layout.json --names Body,Bike,Lantern` (parts, found as
connected regions in reading order) or `--grid 4x3 --names Cypress,Oval,Shrub` (frame rows, each frame cropped on
its content and aligned on its foot so the loop does not jitter). Node only, PNG in (convert a JPEG first).
Check the printed sizes; `--join` merges parts a few pixels apart, `--min` clears specks; `--key ff00ff` for a
magenta screen. An image generated inside Spline never reaches the disk: give its sheet `"chroma": "#00ff00"` and
an inline layout of one full-image part, and the shader keys it.
3. **Describe the sheets** in `scene.json` (`sprites.sheets`): `name`, `unitsPerPixel` (one scale per sheet),
`layout` (the file), `parent` (`Hero Anchor` for the hero), and per part `at` (position from the parent),
`pivot` (`foot`, `centre` or `[u, v]`), `swing` (degrees about the pivot) and `hz`, `lean` (top sway, units),
`fps` (frame loops), `boil`, `bulge`, `glow`, `shadow`. `scatter` puts copies of some parts on the ride's bank
pieces (`perPiece`, `x` range from the road's axis, `parts`).
4. `node scripts/compose.mjs scene.json out/` writes `sprites-planes` (one quad per part with its origin on the pivot,
so it turns about it; copies parented to their bank piece; a `Tex <Sheet>` slot per sheet) and the document part.
Run the recipe, set the document, then ask the user to drop `keyed.png` on `Tex <Sheet>`
([references/images.md](../../references/images.md)). Until then those sprites are hidden and a banner names the
empty slots.
5. The material: the part's rect (or its frame loop, per-instance phase from world x and y), alpha cut-out with the
same mask in the shadow pass (`maskShadowNode`), a normal bulged from the silhouette for volume, and the motion in
the vertex stage with `positionPrevious` written.
## Rules
1. **Warp or cut**: soft parts (scarf, hair, pompom) bend as one piece with a warp; rigid parts that move far
(a swinging lantern) are erased and redrawn turned (two lookups). A warp inside a tight rect clips; a cut through a
soft part shows a seam.
2. **Explicit mip level**: when the lookup coordinate switches per pixel (atlas rows, dithers, bends), sample with a
level computed from the smooth coordinate, or the GPU picks the smallest mip and flashes the sheet's average.
3. **Volume without a mesh**: bulge a normal from the alpha gradient at a few radii and paint the light in the shader
(rim on the key side, darker contour on the shadow side). Mark the "cut ends" of parts cut in the picture itself
(a scarf at the neck), where bevel and rim must not apply.
4. **Turned views** come from the same sheet as reference: generate the two bounding views first, then the halfway one
with both attached. Check which side a view is by the road's direction in a capture, not by the prompt's words.
Switch with thresholds plus hysteresis, and force the switch when a fast swing changes side.
5. **Measure sizes between views** with forced poses at the same camera and instant; rescale per view and anchor on
the contact point (the wheel, the feet).
6. **Dither thresholds** compare as `step(threshold, hash)` with the hash in [0, 1): an exact 0 leaks.
7. **Phase from what does not scroll**: on a treadmill, a per-instance phase from world z flickers as the pieces move;
use world x and y.
## Verify
`node scripts/check.mjs` here (PNG reading, keying, parts, frame alignment on a synthetic sheet). In Play: frozen
mid-loop frames from the shot camera, a fast swing both ways, the shadow's shape, the rendered colour against the
sheet.