Answers for "From Cubes to Marching Cubes | Beginner"
http://answers.unity.com/questions/1329421/from-cubes-to-marching-cubes-beginner.html
The latest answers for the question "From Cubes to Marching Cubes | Beginner"Answer by Bunny83
http://answers.unity.com/answers/1534602/view.html
Well, implementing marching cubes from scretch is quite difficult because it's quite hard to setup the 256 triangle combinations right. Though I'd like to add that if your voxel data is only composed of binary values (a bit like minecraft: occupied or not) then all you need are the 256 cases which are just rotated versions of the 15 base configurations as you can see them on the [marching cubes wiki article][1].All vertices are exactly half way between two corners of an edge. Though when you have a real iso surface things get a bit more complicated. Since each "voxel value" does no longer correspond to occupied or not but each value has a float indicating the "size" of each voxel. You still need the binary representation to pick the right triangle configuration though. This is done by a simple threshold comparison. Once you have picked the configurations the vertices are not just placed at the center of each edge, but are interpolated based on the actual voxel values.
<br>
The most tricky part may be to create shared vertices (if you want / need them). Since each edge in the voxel grid is shared by 4 triangle configurations the vertex on that edge belongs to those 4 configurations. It should be also noted that with the 15 case solution there are ambiguous situations (mainly for iso surfaces) which can be resolved by checking the interpolated center like described on [page 3 of this paper][2]
<br>
Note that it's probably easier to just use an existing solution. Google gave [me this one][3]. It has an MIT license. Though if you insist in implementing it yourself that's something you have to decide if you can pull this off or not ^^.
[1]: https://en.wikipedia.org/wiki/Marching_cubes
[2]: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.56.7139&rep=rep1&type=pdf
[3]: https://github.com/Scrawk/Marching-CubesThu, 26 Jul 2018 21:05:34 GMTBunny83Answer by WireShark77
http://answers.unity.com/answers/1534554/view.html
I am trying to figure this out myself, but I think your first step should be creating a single mesh for this 'chunk' of terrain. In order to do this you will need the vertices, uvs, and triangles of the mesh you want to make. I guess you might be able to calculate this from from your cubes however I would recommend checking out Nintendo Examiner's Let's make a voxel game series. One downside to this is that at a few points he makes fixes/changes to his scripts off camera, however you can find them by looking at the script in his video. Also do not use his github download link because it does not work, and his scripts are more complicated than in the tutorial.Thu, 26 Jul 2018 18:09:04 GMTWireShark77