Skip to content

Scrawk/Marching-Cubes

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Added the option to create smooth normals.
4afa148

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
August 23, 2019 13:50
May 8, 2022 01:33
May 8, 2022 01:33
May 7, 2022 21:05
September 25, 2020 14:06
May 7, 2022 21:05
July 22, 2017 11:57
May 8, 2022 01:34

Marching-Cubes

Using objects represented by a 3d array of data has become quite popular in games in the last few years. Voxel terrain is probable the most common application. Of course GPUs only understand triangles so the voxels have to be converted to a mesh some how.

The most common algorithm for doing this is called the marching cubes algorithm. Examples of code are very common on the internet. One of the best ones around in my opinion is this one here and it is what I have based my code on. The thing I like about this code is that it also implements the marching tetrahedron algorithm that is a little more difficult to find good examples of. The marching tetrahedron algorithm produces a mesh that matches the voxel data much better than the cubes algorithm but produces far more vertices.

Marching Cubes

Update - Added the option to create smooth normals.

Marching Cubes