Metaballs are a fun way of creating blobby looking shapes. The idea stems from a method for rendering molecules, where each atom contributes to the overall electron density1.

In the easy case of hydrogen, this contribution is a radially symmetric shape centered around the atom’s center \(c\):

$$ f(v; c) = a \exp(- \|v - c\|_2^2) $$

To render a collection of such atoms, one then takes the sum over these contributions, and renders a level-set:

$$ \left\{\,v \,\middle|\, \sum_{i=1}^n a_i\exp(- \|v - c_i\|_2^2) = L\,\right\} $$

Here’s a visualization in two dimensions with moving centers: