Questions tagged [marching-cubes]

An algorithm for creating a triangular mesh from a three-dimensional scalar field, or graphing an implicit function of the form f(x,y,z) = c.

Marching cubes is a computer graphics algorithm for creating a triangular mesh from a three-dimensional scalar field, or equivalently, graphing an implicit function of the form f(x,y,z) = c.

For more information, see:

144 questions
52
votes
0 answers

Marching Cubes generating holes in mesh

I'm working on a Marching Cubes implementation in Unity. My code is based on Paul Bourke's code actually with a lot of modifications, but anyway I'm checking if a block at a position is null if it is than a debug texture will be placed on it. This…
Statey
  • 631
  • 5
  • 10
52
votes
3 answers

What can cause glDrawArrays to generate a GL_INVALID_OPERATION error?

I've been attempting to write a two-pass GPU implementation of the Marching Cubes algorithm, similar to the one detailed in the first chapter of GPU Gems 3, using OpenGL and GLSL. However, the call to glDrawArrays in my first pass consistently fails…
Michael Powell
  • 853
  • 2
  • 9
  • 12
16
votes
3 answers

Marching Cube Ambiguities Versus Marching Tetrahedron

I have successfully implemented the marching cubes algorithm. I used the standard materials as a reference, but I rewrote it entirely from scratch. It works, but I am observing the ambiguities that lead to holes in the mesh. I was considering the…
geometrian
  • 14,775
  • 10
  • 56
  • 132
14
votes
1 answer

Create a .obj file from 3d array in python

My goal is to get a .obj file from a nifty (.nii) format using python, with the purpose of open it on Unity. I know that the "scikit-image" package has a module called "measure" which has the Marching cube algorithm implemented. I apply the marching…
Diego Orellana
  • 994
  • 1
  • 9
  • 20
10
votes
1 answer

Most Efficient Way to Calculate an SDF to a Triangle Mesh

Hi. I've been gathering info from various sources consistently over the past month, yet without any luck of finding an idea that would suit my particular issue. So here's the formulation of the problem: Given a mesh in a form of buffer geometry…
Martin
  • 141
  • 1
  • 11
8
votes
1 answer

Marching Cubes, voxels, need a bit of suggestions

I'm trying to construct a proper destructible terrain, just for research purposes. Well, everything went fine, but resolution is not satisfying me enough. I have seen a lot of examples how people implement MC algorithm, but most of them, as far as I…
Jeffers
  • 183
  • 2
  • 7
8
votes
2 answers

How could I polygonise a bool[,,]

If anyone cares, I'm using WPF.... Beginning of story: I got a series of gray-scale images(slices of a model). The user inputs a "range" of gray-scale values to build a 3D model upon. Thus I created a 3D bool array to make it easier to build the 3D…
None
  • 609
  • 7
  • 22
8
votes
1 answer

CSG operations on implicit surfaces with marching cubes

I render isosurfaces with marching cubes, (or perhaps marching squares as this is 2D) and I want to do set operations like set difference, intersection and union. I thought this was easy to implement, by simply choosing between two vertex scalars…
Mads Elvheim
7
votes
4 answers

How to speed up marching cubes?

I'm using this marching cube algorithm to draw 3D isosurfaces (ported into C#, outputting MeshGeomtry3Ds, but otherwise the same). The resulting surfaces look great, but are taking a long time to calculate. Are there any ways to speed up marching…
Dan Vinton
  • 26,401
  • 9
  • 37
  • 79
7
votes
1 answer

Undesirable shadows with Haskell OpenGL

I have drawn the Barth sextic with Haskell OpenGL and there's a problem. I have also drawn it in R (with packages rgl and misc3d) and there's no problem. The two algorithms (in Haskell and R) are very similar. The Barth sextic is an implicit…
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
7
votes
2 answers

Dual Contouring and Quadratic Error Function

I've implemented marching cubes, dual marching cubes and adaptive marching cubes in C#, only to find out that I need dual contouring for my purposes. I've read all works about dual contouring and I get all but the core of the dual contouring itself:…
6
votes
1 answer

Point Cloud triangulation using marching-cubes in Python 3

I'm working on a 3D reconstruction system and want to generate a triangular mesh from the registered point cloud data using Python 3. My objects are not convex, so the marching cubes algorithm seems to be the solution. I prefer to use an existing…
Marco Carletti
  • 318
  • 2
  • 5
  • 16
5
votes
1 answer

Marching Cubes Implementation - Missing Triangles in Mesh

I am currently working on understanding and implementing the Marching Cubes algorithm using C++ by rendering a sample data set in OpenGL. I have been encountering an issue where the mesh that I render is missing triangles. I am seeing almost half…
Vahe
  • 1,699
  • 3
  • 25
  • 76
5
votes
4 answers

Compute gradient for voxel data efficiently

What is the most efficient way of computing the gradient for fixed sized voxel data, such as the source code below. Note that I need the gradient at any point in space. The gradients will be used for estimating normals in a marching cubes…
Mortennobel
  • 3,383
  • 4
  • 29
  • 46
5
votes
4 answers

How to simplify a marching squares mesh?

I'm running a marching squares (relative of the marching cubes) algorithm over an iso plane, then translating the data into a triangular mesh. This works, but creates very complex mesh data. I would like to simplify this to the minimum triangles…
miketucker
  • 1,074
  • 1
  • 15
  • 27
1
2 3
9 10