I am trying to build proper destructible terrain, for research purposes only. Well, everything went well, but the resolution does not satisfy me. I have seen many examples of how people implement the MC algorithm, but most of them, as I understand it, use functions to triangulate a finite mesh, which is not suitable for me.
I will try to briefly explain how I build my terrain, and perhaps one of you will give me advice on how to improve or increase the resolution of the final terrain.
1) Preliminary calculation of the triangular nicks MC.
I start a simple cycle through the MC search tables for each case (0-255) and compute the triangular angry rage: [0,0,0] - [1,1,1]. There are no problems.
2) Landscape
I have a terrain class that stores my voxels. In general, it looks like this:
int size = 32;//Size of each axis. unsigned char *voxels = new unsigned char[(size * size * size)/8];
So, each axis has a length of 32 units, but I store voxel information per bit. This means that if the bit is on (1), there is something, and something needs to be drawn.
I have a couple of functions:
TurnOn(x,y,z); TurnOff(x,y,z);
to enable or disable voxel location. (Helps to work with bits).
After highlighting the terrain, I start the perlin noise and turn the bits on or off.
My terrain class has another function - to extract the Marching Dice case number (0-255) from location x, y, z:
unsigned char GetCaseNumber(x,y,z);
by determining whether the neighbors of this voxel are on or off. There are no problems.
3) Part rendering
I loop for each axis, extract the case number, then get the pre-calculated triangular nicks, translate into x, y, z coordinates and draw these triangular nicks. There are no problems.
So, the result looks like this:
But, as you can see, in any place the resolution is not comparable, for example, with this:
(source: angelfire.com )
I saw in MC examples that people use what is called “out of meaning”, which I don’t understand. Any suggestions on how to improve my work, or what are the ISO values, and how to implement it in a single grid, would be really good.