Metaballs and Isosurface Rendering

Kannan Goundan, kannan@ucsc.edu
CMPS 161, Final Project, Winter 2003


Introduction

Metaballs are used to model blobby objects such as liquids. Metaballs are essentially point sources of density fields. Visualizing a metaball is usually done by selecting a density threshold and considering all points above the density threshold to be within the metaball.

A single metaball by itself will produce regular spheres. It is when multiple metaballs' density fields are superimposed that some of the interesting properties of metaballs are visible. The metaballs exhibit behavior that resembles the cohesion of water. In my case, they behaved more like the liquid in a lava lamp.

Left click on the window to add a metaball, middle click to delete the one that was added last. Changing the color of the metaball doesn't do anything. The interesting options are the ones at the top right corner. Press play to use the default animator on the current scene.


Rendering the Surface - Marching Cubes

A field of metaballs is often modelled by choosing a threshold and rendering all the values at this threshold as a surface. Marching cubes is a popular technique used to do this (developed by W. E. Lorensen and H. E. Cline 1).

The algorithm divides the space into small cubes that have density values at the corners. Using the threshold, each corner is classified as either ouside of or within the surface object. Since a cube has eight corners, there are a total of 28 (256) different cases the algorithm needs to consider when deciding what should be drawn at the cube. The 256 cases can be reduced to 15 cases by taking into consideration rotation along the three axes and inversion of the corner values. These 15 cases are:

http://www.exaflop.org/docs/marchcubes/ind.html

To generate the rest of the cases, I wrote a program to take these 15 cases and rotate/flip them and output an array containing the information to handle all 256 cases (got the idea from Dan Royer).

Unfortunately, there were some problems. The resulting surface has "holes" in it. Apparently, this is the result of the way certain ambiguous cases are handled (since for the same corner values, there may be more than one, equally valid polygonization). The main problem comes from the cases that are generated by inverting some of the 15 primary cases.

Thankfully, somebody (Shoeb, 1998) figured out that by adding 8 more cases and disallowing inversion, this situation can be remedied. I found the geometry for the 8 additional cases at http://www.cosc.brocku.ca/Project/info/grossi/detmarch.html.

Though the example images show the triangle corners always at the midpoint of an edge, each edge's endpoint densities should be interpolated to get a more accurate image. In addition, conventional surface smoothing (by using per-vertex normals) improves the visual quality of the final rendered image. The other factor that determines image quality is the size of the cube subdivisions.


An ordinary sphere-based rendering.

10 subdivisions 20 subdivisions 30 subdivisions
straight-forward rendering

with interpolation along the edges

with interpolation along the edges and smoothing (per-vertex normals)

Animations

Lava Lamp. Metaballs look great when animated. This animation is of 5 different-sized objects moving around in a bounded region, bouncing off of walls when necessary. Even this simple motion produces visually interesting results when combined with metaballs.

Water Drops. I tried using metaballs to model the effect of a drop of water splashing into a pool. While the simulation does resemble this, it doesn't model it too closely. I think that using metaballs directly wont yield the best results and that some other construction is required because strictly spherical density fields is kind of limiting.


1 "Marching cubes: A high resolution 3D surface construction algorithm," Proc. ACM Conference on Computer Graphics, Anaheim, USA, July 1987.