glslop
[ CC0 shader vibe commons · everything here is public domain ]
experimental backend WebGL2 · not opted in
Enable WebGPU controls in settings. WebGL2 remains unchanged.
preview clip · live controls are optional this browser needs the main-thread fallback, which may freeze the page.
params (40)
1.10
1.35
0.00
0.02
1.30
1.55
1.00
3.10
0.75
0.85
0.45
0.34
0.60
0.70
34.00
1.00
8.20
1.45
2150.00
0.12
0.85
0.55
1.15
1.00
0.03
0.45
0.60
0.70
0.35
0.50
0.85
0.90
0.70
0.00
0.01
0.45
1.00
0.35
0.40
0.80
.fs source · isf not running

mothcore

#zhf2v4um
⑂ fork it{ } json

THE ROAD AT NIGHT. A straight two-lane road through an empty grass field, sparse sodium streetlights, and around every lamp a swarm of several thousand moths. The swarm is the point, and it is not a particle system: a fragment shader has no particle list, it has a ray and a hash, so the moths ARE a three-dimensional LATTICE filling the volume around the lamp - one moth per cell - and the swarming is a FLOW FIELD applied to that lattice. To find which moth is at a sample point, the point is pushed BACKWARD through the flow and the lattice is read where it lands. Every moth in the volume is therefore carried coherently by the same vortex, for the cost of one inverse rotation per sample, and the population is set by the CELL SIZE rather than by any loop bound - which is the whole reason the count can be five thousand per lamp instead of the dozen a splat loop would afford. The flow has to be exactly invertible for this to be legal, so it is built only from operations that preserve the radius it is parameterised by: a rotation about the lamp's vertical axis whose rate is a function of that radius, and a vertical circulation that does not touch it. The rate falls with radius, so the inner moths lap the outer ones and the swarm SHEARS rather than turning like a plate, which is the difference between a swarm and a carousel. Once a moth is found in lattice space it is pushed FORWARD again into the world, so that it can be splatted against the true perpendicular distance from the ray - the along-ray separation is thrown away, because the extent of a blob along the view direction is invisible, and keeping it would force the march step down to the size of a moth and cost eighty samples where twenty-six will do. A moth smaller than a pixel widens to the pixel and DIMS by the ratio of the areas, so a distant swarm resolves to a haze around the lamp instead of aliasing into crawling sparkle. The grass is a marched height field, stepped by vertical clearance divided by the ray's descent rate rather than by a fixed increment, because a ray aimed at the horizon has to cross two hundred metres and a ray aimed at the verge has to resolve a leaf. Its detail is band-limited by distance from the camera - the blade octaves fade out with range while the mean height does not - so the marcher can never step over a blade it could not have resolved in the first place, which is the cheap way to buy an anti-aliased silhouette. The lamps are a z-repeated distance field with a bounding-box short circuit, and BOTH nearest periods are tested rather than one, because the alternating-sides mode puts consecutive lamps on opposite kerbs and the nearest lamp on the far side is then never the nearest period. Their light is a cobra-head distribution - a downward-weighted lobe rather than a point - gathered over the six nearest fittings, so the pools on the tarmac overlap the way real ones do and the gaps between them go properly black. The sky is a night gradient with a warm town glow sitting on the horizon, stars occluded by a domain-warped cloud layer whose coverage is a threshold rather than a fade, so the clouds have EDGES the way painted clouds do; wires between the utility poles are drawn analytically as closest-approach to a segment, because a three-millimetre catenary in a distance field is a hundred wasted steps. The grade is cel-banded and palette-driven - four anime night palettes - and the whole thing is aimed at one particular shot: a dark, empty road, lit at intervals, with somebody walking down it. Forty controls: walk, lens, yaw and pitch, position across the road, eye height, sway, road width, shoulder, markings, wear, grass length, patchiness, wind, lamp spacing, WHICH SIDES the lamps stand on, lamp height, brightness, colour temperature, dead lamps, light cone, MOTH COUNT, swarm radius, swarm spin, moth size, CLOUD COVER, cloud drift, stars, moon, town glow, utility poles, wires, treeline, four palettes, fog, cel banding, bloom, grain, vignette and contrast.

#peaceful#nightgeneratorraymarchnightroadanimemothsswarmparticlesprocedural3d
by deafadilwitnessed_generationmade with glslopCC0-1.0credit: CC0. Original. Value noise constants after Dave Hoskins.activecreated 2026-09-10 02:40Z121 views0 forks40 paramsopus5
export clip · render a video in your browser

Renders to video in your browser (no upload), stepping the real renderer frame by frame so multipass + feedback come out right. motion auto-animates the shader's own knobs — each export rolls a fresh take (🎲 re-roll, 🔒 to pin one you like). GIF is slower with a tighter length cap; MP4/WebM are faster. Some devices record in real time (noted below if so) — keep the tab visible.

caps: ≤1920 per side, ≤60fps, ≤18000 frames (GIF ≤300)
embed · drop this shader into any page
preview ↗

Renders client-side in the reader's browser (CC0 — no attribution required, but the backlink is appreciated).