Voxel mesh generation

Started by
5 comments, last by robotichrist 16 years, 9 months ago
Hey, I'm representing a deformable surface using a 3D lattice of voxels. The voxels define a closed surface visually, but of course it displays rather slow as I am drawing millions of cubes rather than drawing a closed mesh wrapped around the surface. Can anyone point me to any algorithm for such voxel -> mesh generation? I tried google, but just seem to get 3rd party apps and research papers. Oh and I'm using Direct3D9 if it makes any difference. Any help much appreciated.
Dave.
Advertisement
Hi,

I think the marching cube algo is what you are looking for. Just google for it.
hey

I'm not sure if this will help in any way, but I came across it recently and thought I would post a link. See Voxel Mesh Creation and Rendering.

cya
I've made up a small sample C++ implementation of the code found on Paul Bourke's web site:

http://cpp.criticaldamage.com/index.php/Marching_Cubes_Field_Tesselation

http://cpp.criticaldamage.com/uploads/8/8b/Tesselate.zip

The sample input file takes a 3D array of density values from 0 to 1 and turns it into a mesh.
AFAIK, voxels can be rendered much efficiently by raytracing than rasterising...
-----------------------------------"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrashstickman.hu <=my game (please tell me your opinion about it)
As people have pointed out, you can use the marching cubes algoithm to convert voxels to meshes. That is assuming your voxels lie on a regular grid, rather than being some kind of arbitrary point cloud. However, you typically expect 2-3 triangles per surface voxel so it's still a lot of triangles.

Are you building vertex buffers with the resulting data, or are you sending it to the GPU each frame? The later will really kill the performance. If your voxels are moving then ideally you only want to send the the GPU the parts which have changed between frames.

There are other approaches which produce less triangles in flat areas of the volume... google for "volume surface extraction" or something similar. Or ask me if you still can't find anything.

Otherwise use marching cubes and consider mesh decimation techniques as a second step.

You may find my project here interesting, it represents game environments as voxels and runs marching cubes for destructible environments:

http://www.ogre3d.org/phpBB2/viewtopic.php?t=27394
You may be interested in Sven Forstmann's work. He's a semi-regular visitor here, and has done some great work with generalizing the geometry clip-maps algorithm to 3D spaces. Right now, it is probably the most efficient method for generating surfaces from voxels using the GPU.

http://www.xinix.org/sven/main/publications.htm

This topic is closed to new replies.

Advertisement