# Metaballs

> Ten soft blobs that drift, merge and split again, with time animating.

Metaballs are a classic of computer graphics, introduced by Jim Blinn in 1982 to draw molecules: each ball is a field that is strongest at its center and fades with distance, and the drawn shape is the surface where the sum of all the fields reaches a fixed level. A single ball alone gives a sphere. When two balls come near each other their fields add, so the two spheres grow a neck and flow into one blob, and when they move apart the blob stretches and splits in two again.

Here ball $k$ sits at the point $(a(k), b(k), c(k))$ and contributes $\frac{2}{5r^2}$, where $r$ is the distance to it. The implicit surface $\sum_{k=1}^{10} \frac{2}{5r_k^2} = 1$ is found by marching cubes over the box, so a lone ball is a sphere of radius $\sqrt{2/5} \approx 0.63$. Each coordinate of a ball follows a sine of the time $T$, with a frequency and a phase that change with $k$. The ten balls therefore move on different Lissajous-like orbits and meet in ever new groups. The surface is colored by height through a rainbow colormap.

After a Desmos graph by nekonaomii.

- [Open the interactive version](https://graph-paper.io/showcase/en/metaballs)
- [Learn more on Wikipedia](https://en.wikipedia.org/wiki/Metaballs)
