So marching cubes is the same thing as marching squares but in the third dimension. So the process is still the same, you have a grid of points which you can define as True/False or On/Off. Then you process the 3d grid 8 points at a time that defines a cube or a voxel. The points are still defined with bit wise values, but now there is 8 of them instead of 4.
8 Bits gives you a total of 256 combinations that can be generated. But worry not, there around 20 possible ways to draw triangles in the voxel, the rest are just copies in various rotations. Luckily for us, its fairly easy to find all the combinations online that we can just copy and use in our projects. For my example, I used the data from boristhebrave.com.
So in this demo, i defined a 3D grid of points. Then process through all points using 3D perlin noise to set the point as ON or Off. Then loops through one voxel at a time and it draw one or a few triangles in that area based on which of the 8 points are set to on. As a result you get an idea of what Perlin Noise Looks like in a three dimensional way.
Hopefully this sample would help people learn the algorithm since its a big part of procedural generation. Oskar if you know him, uses this a lot in building his games and demos.
[ RELATED LINKS ]