philomatics.com• Jul 26, 2026• 1 min read
Show HN: Organic cell simulation with infinite zoom (100k cells, raw WebGL)Made this little cell simulation with an infinite zoom mechanic in raw WebGL. Renders up to 100k cells on my laptop (M1 MBA).It's a single HTML file, not minified, without dependencies, so you can just inspect the source code. It's just raw JS and WebGL shaders. No assets, everything is procedurally generated.For each cell, I draw a single quad using instanced rendering. To create a nice organic wobble, I use SDF (Signed Distance Fields) to draw a circle (or another base shape), which is then distorted by adjusting the radius using multiple overlapping sine waves. I explain this visually here. [1]To get the cells to stretch dynamically based on their velocity, I use a technique called Domain Warping. Basically in the fragment shader, the fragmentPosition is adjusted inwards/outwards depending on the current velocity, which squashes/stretches the entire coordinate system of the quad in either direction. Gives it a very organic look. I explain this in more detail here. [2]Physics are als