Here's an example implementation of the marching cubes algorithm in Unity using rotation maps based on Greg Nielson's method:
main.cs3339 chars82 lines
Note that this implementation assumes that you have already defined the necessary tables (vertTable
, triTable
, rotMapX
, rotMapY
, rotMapZ
) for the marching cubes algorithm based on Greg Nielson's method. You will also need to specify a threshold
value to determine which voxels are considered solid. Finally, you will need to provide voxelSize
and offset
values to calculate the actual positions of the mesh vertices.
gistlibby LogSnag