In the past, some people have asked for code or help with applying a smoothing algorithm to the meshes they get from the Marching Cubes algorithm (see: 'Polygonising a scalar field' by P. Bourke).

I've attached some sample C++ code to perform Taubin smoothing (see: 'Geometric Signal Processing on Polygonal Meshes' by G. Taubin and 'Implicit Fairing of Irregular Meshes using Diffusion and Curvature Flow' by M. Desbrun, et al.) on a Stereo Lithography (STL) file. The code assumes that the mesh is closed -- [attachment=15206:mc_smooth2.zip]

The code also eliminates the __cracks in the mesh that are unfailingly generated by the standard, original Marching Cubes algorithm__ (Google for 'marching cubes cracks' to see that it is a common problem).

__The cracks must be eliminated before smoothing occurs, otherwise the cracks will become holes, and the mesh will be ruined.__

Attached is a sample mesh (including cracks) -- [attachment=15174:fractal.zip]

Here is an image of the sample mesh as generated by Marching Cubes, rendered using flat shading -- very blocky:

[attachment=15175:1_raw_flat_shaded.png]

Here is an image of the cracks highlighted in red, rendered using flat shading:

[attachment=15177:3_raw_cracks.png]

Here is an image of the sample mesh after 10 iterations of Taubin smoothing, rendered using flat shading -- the cracks have now become holes, thanks to the smoothing. This is bad:

[attachment=15178:4_taubin_smoothed_holes.png]

Here is an image of the vertex pairs (highlighted in blue, and connected by green lines) that should have been merged -- in order to fix the cracks -- before the smoothing was applied, rendered using flat shading:

[attachment=15179:5_taubin_smoothed_merge_vertices.png]

Here is an image of the crackless mesh after 10 iterations of Taubin smoothing, rendered using flat shading -- no holes, looks less blocky:

[attachment=15180:6_taubin_smoothed_flat_shaded.png]

Here is an image of the crackless mesh after 10 iterations of Taubin smoothing, rendered using Gouraud shading -- no holes, looks much less blocky:

[attachment=15181:7_taubin_smoothed_gouraud_shaded.png]

Good luck.

P.S. The sample mesh is an isosurface of the escape value (where isovalue = 4.0) for the quaternion Julia set generated by Z' = Z^2 + C where C = {0.3, 0.5, 0.4, 0.2} and the maximum number of iterations is 8. (see: 'Quaternion Julia Fractals' by P. Bourke). The code to generate this mesh can be found at: http://code.google.com/p/qjs-isosurface/downloads/detail?name=qjs-isosurface-v2.0.2.1.zip