Hardware Heritage
Metaballs represent one of the first popular uses of "implicit surfaces" in the demoscene. By treating moving points as centers of a potential field and drawing only the regions where the combined field strength exceeds a threshold, coders created organic, fluid-like shapes that appeared to merge and split with mesmerizing smoothness.
PC Optimization
On PC, calculating square roots for distances was slow. Programmers used pre-computed tables of 1/(x^2 + y^2) to avoid sqrt entirely.
Amiga Blitter
Amiga coders achieved a similar look by XOR-blitting circular gradients. It created the merging look with hardware speed.
Modern Fields
This example treats metaballs as implicit surfaces in the fragment shader, summing the potential field of every ball for every pixel simultaneously.
Metaballs
Organic fluid-like merging shapes via additive fields.
Legacy C (Software)
// Sum influence of each ball
field = distTable[ball1.x - x][ball1.y - y] +
distTable[ball2.x - x][ball2.y - y];
if (field > THRESHOLD) PutPixel(x, y, color);
Modern GLSL
float field = 0.0;
for(int i=0; i < 6; i++) {
field += 0.012 / length(uv - ballPos[i]);
}
gl_FragColor = vec4(vec3(smoothstep(0.4, 0.5, field)), 1.0);