I'm doing some voxel based game, where I want to have voxel planets. I decided to use the marching cubes algorithm, and I successfully created a planet (even with noise) with the following density function:
"xx+yy+z*z -r - someNoiseFunction()" no problem there...
But as it comes to implementing chunks to my voxel planet, I run into some problems. I tried various things to "cut" my planet into parts but I wasn't successful. I tried copying the density values from the level array to some other chunk arrays, but somehow if I do that, the result is not what I was expecting. being more preceisly, the result was no mesh to a complete other mesh.
Now another idea came to my mind. With 3 FOR loops I could iterate through every voxel in the level array and check if it IS IN THE CHUNK, and check if it IS IN THE SPHERE. IF IT IS the density value it positive, if it IS NOT the density value is negative. so I could iterate through every chunk and in the end I have some chunks, which form my planet if I put them together... but before I spend another day coding some code which is maybe nonsense I might ask you guys what do you think about this idea, or are there better solutions for getting a sphere chunked with marching cubes?