HPMC is a small OpenGL/C/C++-library that extractes iso-surfaces of volumetric data directly on the GPU.
HPMC is an implementation of the method described in the paper
C. Dyken, G. Ziegler, C. Theobalt, H.-P. Seidel, High-speed Marching Cubes using Histogram Pyramids, Computer Graphics Forum 27 (8), 2008.
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.
HPMC is released under GNU General Public License ("GPL") version 2 as published by the Free Software Foundation. For use of HPMC with software than can not be combined with the GNU GPL 2, please contact SINTEF for aquiring a commercial license and support.
The best way of helping out is to use HPMC. Bug reports and patches are always welcome; If you have trouble with HPMC on a system configuration that should be able to run it, please contact the author. Also, if you find this software useful, sending the author an email stating this is an excellent motivation for continuing the development.
The HPMC distribution currently contains five sample applications:
This example demonstrates the most basic use of HPMC, providing the scalar field as a 3D texture. The example gets volume dimensions and a file name of a 8-bit raw dataset from the command line, reads the data into a 3D texture and passes this texture to HPMC. For each frame, a time-dependent iso-value is calculated, passed to HPMC which analyzes the scalar field using this iso-value. Then, HPMC renders the corresponding iso-surface. Wireframe rendering is done straight-forwardly by rendering the surface twice (traversing the HistoPyramid both times), one time with solid triangles in a dark color offset slightly away from the camera, and the second time using the line-drawing polygon mode to render the actual wireframe in white.
This example is similar to the texture3d example. The difference is that instead of fetching scalar values from a texture 3d, the scalar value is fetched from an application provided shader function, which in this example evaluates the algebraic surface defined by 1 - 16xyz -4x^2 - 4y^2 - 4z^2 = iso. The application also provides the gradient field for this function, which is used instead of forward differences to determine surface normals.
For each frame, a time-dependent iso-value is calculated, passed to HPMC which analyzes the scalar field using this iso-value. Then, HPMC renders the corresponding iso-surface. Wireframe rendering is done straight-forwardly by rendering the surface twice (traversing the HistoPyramid both times), one time with solid triangles in a dark color offset slightly away from the camera, and the second time using the line-drawing polygon mode to render the actual wireframe in white.
This example demonstrates the use of a custom fetch function and how the application can get hold of program names to update uniform variables. In principle, the fetch calculates the distance field defined by eight metaballs, whose position is provided through uniform variables. To make the example more interesting, the domain is twisted time-dependently along the z- and y-axes.
Extracting iso-surfaces from a scalar field defined in terms shader code, and use transform feedback to capture geometry for wireframe rendering. This example is basically the same as cayley, the main difference is that instead of traversing the HistoPyramid twice when rendering wireframe, transform feedback is used to capture the geometry in the flat shading pass, and the result of this is rendered again using plain OpenGL to produce the line rendering.
The actual surface is an algebraic surface defined by 1 - 16xyz -4x^2 - 4y^2 - 4z^2 = iso. The application also provides the gradient field for this function, which is used instead of forward differences to determine surface normals.
This example demonstrates using the surface generated by HPMC as input to a geometry shader that emits particles randomly over the surface. The particles are pulled by gravity, and uses the scalar field passed to HPMC to determine when particles hit the surface, and in this case, they bounce. To test if a particle hits the surface is done by evaluating the sign of the scalar field at the position of the particle at the beginning of the timestep and at the end. This approach is a bit too simple for these shapes, as they usually have a great deal of regions with multiple zeros, and this leads to the artefact of particles falling through the surface at some places.
The following render loop is used:
HistoPyramids are used and discussed in the following papers:
C. Dyken, M. Reimers, J. Seland, Semi-uniform Adaptive Patch Tessellation, Computer Graphics Forum, to appear.
C. Dyken, M. Reimers, J. Seland, Real-Time GPU Silhouette Refinement using adaptively blended Bezier Patches, Computer Graphics Forum 27 (1), 2008, pp. 1-12.
I. Ihrke, G. Ziegler, A. Tevs, C. Theobalt, M. Magnor, H.-P. Seidel, Eikonal Rendering: Efficient Light Transport in Refractive Objects, ACM Transactions on Graphics (Proc. ACM SIGGRAPH) 26 (3): 59-1 - 59-8, 2007
G. Ziegler, R. Dimitrov, C. Theobalt, H.-P. Seidel, Real-time Quadtree Analysis using HistoPyramids, Real-Time Image Processing 2007, San Jose, USA, 2007, 1-11
G. Ziegler, A. Tevs, C. Theobalt, H.-P. Seidel, On-the-fly Point Clouds through Histogram Pyramids, 11th International Fall Workshop on Vision, Modeling and Visualization 2006 (VMV2006), Aachen, Germany, 2006, 137-144