Advanced Metaballs

January 8, 2011 General News 0 Comments

Ever since the successful implementation of Marching Cubes into my engine, I've been experimenting with ways to model things procedurally. Naturally, metaball modeling is the first thing that comes to mind. Unfortunately, metaballs, as described in literature, are somewhat restricted. They usually contain four pieces of information: x, y, z, and radius. The first three control the origin of the metaball's field of influence, and the radius describes how far that field extends.

In an attempt to allow more flexibility, I introduced several new parameters: scale and power. This adds an addition six pieces of information to the metaball (scale and power are each three-dimensional vectors). The scale controls how far an influence field extends in each dimension. The power then controls how quickly the field falls off in each direction. Interestingly, one can achieve completely different primitives just by changing the power: spheres, cylinders, capsules, and even cubes.

Even with these additions, metaballs did not have the power to recreate more complex topologies. For this reason, I began to explore rotation as another parameter of the metaball. After much trial-and-error, brushing up on matrix math, and poking around forums, I was able to get rotation right.

The advanced metaball, as I casually call it, has still four more pieces of information on top of the position, radius, scale, and power information contained in the original. It contains a 3-component vector that specifies a rotation axis, and a scalar rotation angle. Together, these components tell the metaball how to orient itself about an arbitrary axis of rotation.

With the power of rotation now at hand, it remains to be seen just how flexible advanced metaballs will prove to be as tools in implicit surface modeling.