Nine metaballs drifting and merging. Move your mouse (or finger) to carve a void through the field.
Jim Blinn needed to render a DNA molecule for Carl Sagan's Cosmos in 1982. Polygonal meshes would have looked faceted and dead. So he placed point charges in space, summed their radial falloff at every pixel, and drew the surface where the total field crossed a threshold. He called them "blobby objects." Japanese researchers at Osaka University soon adopted the technique and gave it the name that stuck: metaballs.
The core idea fits in a few lines. For each pixel, you sum the contribution of every ball. Each ball emits a field that falls off with the square of distance:
let sum = 0;
for (const b of balls) {
const dx = (fx - b.x) * asp;
const dy = fy - b.y;
sum += b.r * b.r / (dx * dx + dy * dy + 1e-6);
}
When sum >= 1.0, you are inside the surface. When two balls drift close, their fields stack, and the threshold region swells outward to swallow them both. The merge is smooth because the math is continuous. There are no triangle seams, no edge cases to stitch. Two circles become one amoeba, then pull apart again.
This implementation runs the field evaluation on a small 200×140 grid, then scales the result up to fill the screen. The pixelation is deliberate: metaballs were a staple of the demoscene, where coders on Amiga and early PCs squeezed organic, blobby animations out of hardware that could barely push sprites. The low resolution is a nod to that lineage. Color comes from tracking which ball dominates each pixel and blending its hue with the runner-up, weighted by field strength. The rim glow at the boundary fades through alpha, giving each blob a luminous edge.
There is a mouse interaction worth noting. The pointer acts as a negative charge, subtracting from the field sum and punching a hole wherever it goes. It is the same equation in reverse: sum -= 0.004 / (dx*dx + dy*dy + 1e-5). You become an anti-blob, repelling the surface wherever you touch.
Blinn's original formulation used Gaussian falloff rather than inverse-square, which produces smoother blending at the cost of an exp() call per sample. The inverse-square version here trades some smoothness for speed, a tradeoff the demoscene would have approved of. Yoichiro Kawaguchi took metaballs further in the mid-1980s, using them on the LINKS-1 parallel computing system to create his "Growth" animations: organic, tentacled forms that looked like deep-sea creatures rendered decades before subsurface scattering existed. The technique survived into modern VFX. Pixar uses implicit surface blending for shapeshifting characters. The math is the same math Blinn wrote to make a helix look wet on television in 1982.