loading...
Kernel profile: field of one blob vs distance (green = iso level T, vertical = outline radius)
running...
The science
A metaball is a level set. Each blob i has a centre ci, an influence radius Ri and a strength si. The scalar field is the sum of compact kernels, and the visible outline is the contour where the field equals the threshold T:
F(x, y) = Σi si · f(qi), qi = |p - ci|² / Ri² (f = 0 for q ≥ 1)
outline = { p : F(p) = T }
Kernels: Wyvill (1 - q)³, quadratic (1 - q)² and a clipped Gaussian (Blinn). The heat map shows F itself; the filled shape is the region F ≥ T.
Marching squares. The field is sampled on a grid. For every cell, the four corners are marked inside (F ≥ T) or outside, giving one of 16 cases. Each case has 0, 1 or 2 line segments whose endpoints lie on the cell edges where the sign changes. An endpoint is placed by linear interpolation, t = (T - Fa)/(Fb - Fa). The two ambiguous saddle cases (diagonal corners inside) are resolved with the average of the four corners. Neighbouring segments share edge points, so they link into closed loops. Use the Marching squares preset (coarse grid) to see the sample points, the 16 cases and the interpolated contour points.
When do two blobs fuse? For two equal blobs the field on the line between them has a saddle at the midpoint, Fmid = 2 s f((D/2)²/R²). The outlines merge exactly when Fmid = T; for Wyvill Dcrit = 2R √(1 - (T/2s)1/3). The graph shows Fmid against D, with Dcrit and the live closest-pair distance marked. A neck therefore appears with zero width at Dcrit and widens as the blobs approach, because the two fields keep adding up.
Gradient. ∇F = Σ s f'(q) · 2 (p - c)/R² points toward increasing field and is perpendicular to the outline. Cohesion in the drifting scenario is a = κ ∇Fothers, a toy attraction toward the neighbours' field; a short-range core repulsion keeps blobs from collapsing onto one point. This is a model, not fluid dynamics: real droplets conserve area and obey surface tension, metaballs do not.
Numerical checks (run in this page). (1) the contour polygon area from the shoelace formula vs the closed-form disc area; (2) the contour length vs 2πr; (3) an independent estimate of the same area by counting grid points; (4) the connected-body count at 0.88 and 1.12 times the analytic Dcrit must be 1 and 2; (5) the analytic gradient vs a central difference.