metasurf - a library for implicit surface polygonization

volume rendering (CT head) implicit surfaces (metaballs)


Metasurf is a library for implict surface polygonization. You only need to set a callback that returns the scalar field value at any given point in 3-space, and another callback to accept isosurface vertices. Then at any point just call msurf_polygonize, and the library handles everything else for you.


The following snippet is sufficient to draw the surface of an implicit unit sphere, centered around the origin.

/* initialization */
ms = msurf_create();
msurf_eval_func(ms, eval);
msurf_vertex_func(ms, glVertex3f);

/* drawing */

/* evaluator */
float eval(float x, float y, float z)
    return (x * x + y * y + z * z) - 1.0;

See the examples subdirectory for more examples.


Latest release: metasurf 1.0

Source repository (git):

git clone


Copyright: John Tsiombikas <>

Metasurf is free software, you may use, modify, and redistribute it freely under the terms of the GNU Lesser General Public License (LGPL) v3 (or at your option, any later version published by the Free Software Foundation). See COPYING and COPYING.LESSER for more details.


If you'd like to fix the marching tetrahedra implementation or have any other ideas for improving this library drop me an email at: Also feel free to submit patches for bugfixes.