Let me add something David completely forgot to mention.
Cubic Surface Extratror is straight forward. You have cube for each voxel.
Marching cubes, however, is another beer:
We have a vertex placed in BETWEEN the voxels.
How much, much, MUCH special cases exists because of that, one of them is why have walls only on TWO sides
The algorithm itself is somehow ambigous! If you have 4x4x4 density volume (3d array of floats), you end up with... well... 5x5x5 mesh. Not 4x4x4. Polyvox's implementation takes strange decisions that I have no idea WHY, but I just ended up tweaking my regions with +1/-1 to be happy with it. Then another questions start to arise: WHAT is the ambigous material ID of the vertex? What is... well, WHAT IS? This is the next question that we all asks us when we decide to use Marching Cubes and look at all possible borderline cases. But well, the overlapping of voxel data solved so much of these problems, including the ambiguity with material ids and rendering - I used 3D Volume texture and Texture volume mapping in the pixel shader. And STILL, I have a lot more ambiguities to solve. Texture interpolation on the GPU, for example, s..k at borders. Overlapping ot the volume data solves this - I just don't care about texture borders. And we have a lot of "unused" texel data in the GPU. Well, Marching cubes.... Why not something different that is by definition aligned to its voxel data? Because Life is complicated
More tips for you. Note: Mesh Decimator is only available with Polyvox 0.2.1 and older, David removed it for some reason even if it was perfect piece of code.
The original mesh decimator had nasty bug: Optimized chunks did not lined up perfectly and a lot of gaps were present. Neither you, nor me wanted this, so I had to look thru its code and just add
return false; in
Code:
bool MeshDecimator<VertexType>::canCollapseRegionEdge
. This made chunks lining up perfectly without requiring TransVoxel and lower-scaled volumes.
You can patch the Mesh Decimator from here:
https://sourceforge.net/p/kitten-platfo ... imator.inl - if you are with 0.2.1 (or similar old version that have this code)
In my particular case, David's approach (downscaling volumes) is not just unacceptable (to be honest, it's impossible), because of following downsides:
1. The game's voxel data is always there as is. Downsampling it is not efficient and slow procedure because you have to calculate a lot of interpolations while the process. I have to use the data as is.
2. Downsampling approach cannot make chunks line up perfectly when placed next to each other. We will need to overlap meshes, which is 1. overdraw (not so serious problem with today's GPU and hardware) and 2, the real bottleneck, some physics engines are not appy with such penetrationns. In Bullet physics, all my objects become CRAZY when they hit overlapping parts.
In your case, Mesh decimation is the fastest solution to the problem as it is there and only one "return false" is needed to fix it to work for us.
Hope David bring it back again, and even if OpenMesh is used, MeshDecimator must have built-in setting to never collapse border edges, so our chunks always line up correctly. The rest ambigousities like interpolation of material IDs is for ourselves to research.