open the demo · how it works · make your own · the skill · publish it on patch
Five small worlds, each a few dozen SDF shapes in plain JavaScript, covered in 35,000 to 50,000 Gaussian splats and drawn through a pixel-art pass: one palette per scene, two-colour dithering, dark outlines. They render live in WebGL2, from one HTML file with no dependencies. Drag a scene to turn it, and press P to see the splats without the pixel pass.
The idea is @JungleSilicon's: make SDFs, place Gaussian splats along their surfaces, then run a pixel-art post-process. This repo is our own take on that recipe, written from scratch, with a skill to make more.
how it works.
| 1 · sdf shapes.Each scene is a few dozen signed distance functions: ellipsoids, boxes, cones, tapered capsules, smooth unions, noise.the fox is 14 shapes | |
| 2 · splats on the surface.An octree walks each shape's distance field and drops a splat about every 2 px, oriented along the surface.35,656 splats in this one | |
| 3 · gaussian splats.Each splat is a flat 3D Gaussian, lit, shadowed and blended back to front every frame.what you see with the pixel pass off | |
| 4 · the pixel pass.About 216 px tall, a hand-made palette, two-colour dithering, outlines on depth edges.384 x 216, scaled up with hard edges |
- Splats from distance fields. For each shape, an octree skips space the distance field says is empty and, in each surface cell, steps a point onto the surface along the gradient. Splats buried inside another shape are dropped. Ambient occlusion comes from the distance field too.
- Splatting. Each splat has two radii in the surface and a thin third, projected to a 2D ellipse every frame (the EWA Jacobian), counting-sorted back to front on the CPU and blended. Light is per splat: a key light with a shadow map drawn from the splats themselves, sky and ground fill, up to four point lights, rim and specular.
- The pixel pass. The scene renders at about 216 px tall and scales up with hard edges. An opaque depth pass of the same splats gives the outlines. Each pixel maps to the scene's palette in OKLab: the nearest colour and the one that best brackets it, dithered on a 4x4 Bayer grid. Surfaces only get flat colour or a 50% checker.
- Motion. Groups move with rigid poses and four procedural deforms (sway, water, swim, breathe). Particles do flames, embers, smoke, fireflies, rain and light beams.
- One file.
index.htmlis all of it. Each scene builds in a web worker in about half a second.
make your own.
git clone https://github.com/patch-gg/pixel-splats && cd pixel-splats
python3 -m http.server 8000 # then open http://localhost:8000
Drag to turn a scene, scroll to zoom, double-click to reset. The arrow keys change scene, P turns the pixel pass off
and on, and space pauses. #campfire, #koi-pond and so on open one scene.
A scene is one block in index.html: its shapes and materials, palette, lights, camera and animation.
skills/pixel-splats/REFERENCE.md has the whole API. Copy the closest scene, change
it, and look at it:
node tools/shot.mjs campfire --angles 3 # three views at 4x, in out/shots/
node tools/shot.mjs mimic --crop 150,40,90,70 # a close look at part of the frame
node tools/shot.mjs geode --mode clay --size 768x432 --scale 1 # the shapes alone
node tools/film.mjs lighthouse --seconds 8 # an MP4 at 1920x1080 (or --out out/lighthouse.gif)
The demo on Patch is this page with Patch's controls around it: node tools/block.mjs builds that release into dist/
(the controls are in recipe.json), and pch publish sends it.
The tools need Node 22 or later and Chrome (set CHROME if it isn't found; under WSL they use Windows Chrome so the
graphics card does the work). film.mjs needs ffmpeg. --plan cuts several shots together.
the skill.
The pixel-splats skill teaches Claude Code to make new dioramas the way these were made: model, render from three
angles, look, fix the worst thing, repeat. Install it as a plugin:
/plugin marketplace add patch-gg/pixel-splats
/plugin install pixel-splats@pixel-splats
or copy skills/pixel-splats into ~/.claude/skills/. Then ask for what you want:
- "Make a diorama of a witch's hut in a swamp, with fireflies and a bubbling cauldron."
- "Give the mimic a purple palette and make it chomp faster."
- "Film the koi pond as a 6 second loop for my README."
publish it on patch.
Made a browser game with these? Put it on Patch, where people play and remix browser games and
mods. Install pch, Patch's command line, then restart your coding agent and ask it to publish the game: the install
gives every agent on your PC Patch's tools. Or run it yourself:
npm i -g @patchgg/cli # or: curl -fsSL https://patch.gg/install.sh | sh
pch login
pch init # in your game's folder; it says what's next
pch publish
Publishing needs Patch Desktop open on a Windows PC: it plays your game once to test it before it goes live. The quickstart has the rest.
licence.
Apache-2.0, see LICENSE. The Patch name, mark, wordmark and Patch Pixel belong to Patch and aren't covered by it. The page loads Silkscreen (SIL Open Font License) from Google Fonts.