Let me try that again.
The 10s millions of polys is a problem. Short of waiting a couple of years for technology to catch up, you might consider starting with a low res mesh and use feature extraction for the interesting parts. A lot of work has been done in the medical imaging field on this problem. A simple and direct approach is a 3D paint algorithm. The 3D paint algorithm will automatically grab only connected regions. This would work well for the Mandelbox with its many isolated parts. The other application could be patch enhancement. Imagine pointing at a patch you would like to see in better detail. The paint algorithm could be used to grab 100K smaller triangles centered on that spot.
3D paint is not to complicated. It consists three main parts: a painter function, an ordered to_do_list, and a bit per cube to indicate scheduled_or_done. Since the walking cube algorithm operates on cubes of 8 mesh points, it is useful to think in terms of cubes.
The painter starts in a cube that is cut by the iso-surface. The painter calculates (paints) the triangles. The painter then looks at his 6 neighbors. Any neighbor who shares a triangle edge and has not been scheduled_or_done gets added to the to_do_list and marked as scheduled_or_done. He then either clones himself to work on the to_do_list or he does it himself.
This is an ideal application for recursion because the to_do_list and scheduled_or_done is handled on the stack by the magic of the stack programming model. Unfortunately recursion uses a LIFO to_do_list. This tends to paint the furthermost cubes first which does not work for patch extraction. A FIFO (First in first out) to_do_list will then to paint closest points first. The following pseudo code captures the basic algorithm.
// add the starting point to the to_do_list and mark scheduled_or_done.
to_do_list.add(start_cube);
scheduled_or_done.add(start_cube);
// Do the painting job. Add the triangles to the mesh.
cube.paint();
// The Painter lives here.
while(cube = to_do_list.next()) {
for(n =0; n < 6; n++){
if( (cube.shares_edge[n]) && (scheduled_or_done.val[cube.neighbor[n]]){
to_do_list.add(cube.neighbor[n]);
scheduled_or_done.add(cube.neighbor[n]);
}
}
}
The to_do_list object is a FIFO with add and next functions. The next function returns void when it is empty. It only needs to include the growing boundary of cubes so it will be limited to a few thousand at most.
The scheduled_or_done is more complex since in general it needs a bit per possible cube (mesh point). A hash of some kind is likely a better idea. The entries of a simple hash will be on the order of the number of triangles. With a little more storage it is possible to remove painted cubes which can no longer be scheduled (for geometric reasons). When all the children cubes that a parent cube added to the to_do_list are done, then no cube that it shares a wall with will be evaluated again. This list will be about twice the size of the to_do_list.
The patch will tend to grow in such a way to minimize the taxi cab distance from the start_cube.
Fractower