HPMC open-source GPU volumetric iso-surface extraction library

November 30th, 2009

HPMC is a small OpenGL/C/C++-library that extracts iso-surfaces of volumetric data directly on the GPU.

The library analyzes a lattice of scalar values describing a scalar field that is either stored in a Texture3D or can be accessed through an application-provided snippet of shader code. The output is a sequence of vertex positions and normals that form a triangulation of the iso-surface. HPMC provides traversal code to be included in an application vertex shader, which allows direct extraction in the vertex shader. Using the OpenGL transform feedback mechanism, the triangulation can be stored directly into a buffer object.

(C. Dyken, G. Ziegler, C. Theobalt, H.-P. Seidel, High-speed Marching Cubes using Histogram Pyramids, Computer Graphics Forum 27 (8), 2008.)

  • I have used HPMC library to generate an isosurfaces of Electron Localization Function (ELF) using a previously generated volumetric data from the other program. Here is my observations:

    1. If using without gradient, HMPC generates a “blocky” surfaces. However, using the simplest central 5-point residual derivatives applyed to a given scalar field to generate a gradient solves this problem.

    2. If using HPMC without a gradient, an algorithm generates a lot of zero-area triangles (can be 5 times more than “real” triangles). Indeed, this should fixed.

    3. HPMC does not generate indexed triangles, which are needed to export data from HMPC program to MatLab, 3DMax etc., also to separate isosurfaces. The straight algorithm for indexing a million of vertices leads to 1e12 operations and takes hours. To resolve this problem I had to create a qsort based algorithm, which grows as Nlog(N) (not N*N) and can solve this problem in seconds on CPU. Nevertheless, an indexation of triangles is an actual problem of the HPMC library and a real-time GPU imdexing is strongly needed.

    4. Another problem of HPMC isosurfaces, which complicates its practical application is a really huge number of triangles, which is proportional to volumetric mesh size. Therefore a triangles reduce algorithm should be included into HPMC library. For the moment I have only an idea of this algorithm: index triangles -> separate isosurfaces -> generate a bezier surface -> apply tesselation.

    5. The unsigned byte type for each grid point in the texture can be changed within a texture definition without any hack of the HPMC code. Each of the RGBA components are casted to float incide of HPMC, so int textures is the physical limit of HPMC. (There is no word about this in documentation).

    Finally. The HPMC library is very simple, and fast. Having a simple and self explaning examples. I do recommend this lib for everyone who needs a real time calculation of isosurfaces, especially if there is no need in its subsequent analysis.

    I’m opened to any discussions at: reaper@mail.univ.kiev.ua