# Voxel mesh optimization

This topic is 2588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey everyone.

I've been battling with a problem and I haven't been able to make much headway. I'm about at my wits end, so I thought I would ask the community what they think or if they have any resources/ideas that might be beneficial to me.

I'm working on a program right now which lets me create voxel-based graphics. These graphics will then be used for a small adventure game that I've had in the back of my head for a while, but I've been unsure of the graphical style I wanted to use until now. If I had to make a direct comparison in style, the game would be somewhat similar in appearance to 3D Dot Heroes. It's still not the best comparison to make but it'll have to do.

However, I don't want to make my system requirements very high and I want to be able to put a lot of action on the screen without crippling my framerate, so I need to come up with a way to reduce the complexity of my voxel based graphics. The obvious first step is to purge any voxels that are obscured completely and only render faces which are visible which is a trivial matter. The next step is to group up large faces from the voxel grid and create a simplified mesh.

I've created an image here to illustrate my point:
http://dl.dropbox.co...l/voxelbake.png

My problem is I can't seem to wrap my head around doing the grouping of large faces part. I've tried a bit of searching on the net but the terms I'm choosing are not bearing much fruit. I was wondering if anyone has any experience doing something like this or knows of any papers which describe something similar?

Any help would be greatly appreciated!

##### Share on other sites
Hi!

Alright, simplifying box meshes. There is a very famous command line tool by Hang Si, called Tetgen. It is usually used to build tetrahedralizations from polygonal meshes. You could simply throw in your high quality meshes and this tool would merge coplanar faces and would produce Delaunay triangularizations of the rest. Among other things it can write out the new generated faces. Probably you can specify to only output boundary faces. If not, you can do something similar to the classical stencil shadow stuff to extract the boundary faces. You know, the part where you compute the silhouette of an object. Let’s have a look at some pseudocode.

list<cubeface> hull; // list of potential boundary faces for each Tetrahedron do for each Face f do if ( !hull.contains(f) ) hull.add(f); else hull.remove(f); 
This would give you all faces of the hull, since the hull faces are touched once and all other faces (inside the tetmesh) are touched twice. The second touch removes them from the hull candidate list.
You would have less to code for yourself to get this working and it would be one possible solution for dynamic updates of your world mesh.

If your world is static you can do this stuff with 3ds max or cinema 4D etc. They have mesh simplification algorithms included.

Your only problem is that you have to remove the internal faces. If you would only have the hull (which you could also extract with the aforementioned pseudocode stuff) and some neighborhood information, you could use standard stuff, like edge collapse, to update dynamic scenes. There are many mesh simplification algorithms out there and I would highly recommend to use a library for that.

Well, Tetgen is pretty easy to use. The source is available as well, so you wouldn’t even have to write your geometry to file, run Tetgen and read in the files containing the results.

Whether to go in this direction or not pretty much depends on your requirements. Can you give use more detail on how many boxes will end up in your scene? Which resolution (number of tiny boxes) will your meshes have? Makes a hierarchical approach for the representation of the geometry sense in your case? (Can they locally deform, does the color change, etc.)

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
13
5. 5
frob
12

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633667
• Total Posts
3013254
×