Skip to main content
2 votes

Marching cube terrain generated by compute shader gives strange error

By default Unity handles only 65535 vertices in the mesh. You need to set Mesh.indexFormat = IndexFormat.UInt32 to handle more vertices.
Arugin's user avatar
  • 121
1 vote

Gaps between terrain chunks generated with marching cubes

I fixed this problem. There were 16x16 vertices per mesh and new chunk coordinates were calculated as: ...
aress's user avatar
  • 21
1 vote

Combining cubes Issue in Marching Cubes

Here is how to convert the raw triangles into welded vertices, face normals and vertex normals. It is a small code, and it works well: ...
shawn_halayka's user avatar
1 vote

How would I go about coloring marching cubes terrain?

Once I have generated all of the triangles, I weld the vertices, and get face and vertex normals. Once that's done, I stuff the vertex data (including position, colour) into a buffer and call ...
shawn_halayka's user avatar
1 vote
Accepted

How to construct a octree density from SDF for MC

You use the octree to skip swaths of work. Anytime you find an octree node that's fully outside or fully inside the volume, you can skip iterating any cells inside it because you know the surface won'...
DMGregory's user avatar
  • 136k
1 vote

How to get normals from volume density grid?

To find the surface normal for any given marched cube, just average the face normals for all of the 1-5 triangles that are generated. A face normal is calculated here: ...
shawn_halayka's user avatar
1 vote

Setting vertex colors for a marching cubes mesh

I gave this issue another shot, and I found a solution! I figure that this will probably be helpful to someone in the future, so I will describe exactly how I did it, I will provide minimal code ...
WolfHybrid23's user avatar
1 vote

My vertex cache for reusing vertices in marching cubes algorithm in unity fails for one case, but I cant figure out what case

I figured it out! The problem was when there was a cache hit for vertex 8 in the behindLayer array, it didn't update currentLayer so then when vertex 11 checked if there was a cached index for vertex ...
Carter Schmidt's user avatar
1 vote

Unity Marching Cubes triangulation bug

I came across the same problem when developing my own system - the bug came from the order of the triangles index. I know it can sounds odd, but try tweaking them and you will see that the rendering ...
Sasugasm's user avatar
  • 136
1 vote
Accepted

Marching cubes with destructible environment

You could add a user-defined function to the underlying perlin function. For example, if the user adds a meta-ball function at a point x0, y0 z0 and with density d, then you add that function to your ...
MrBrushy's user avatar
  • 421
1 vote

Using 2D Heightmap Data to generate terrain with the Marching Cubes Algorithm

You need to set a positions density to Mathf.clamp(perlin - pos.y, 0, 1); Instead of setting the values to either 1 or 0, this makes the top a bit more smooth. ...
Bálint's user avatar
  • 15k
1 vote

Marching Cubes Vertex Normals

Calculate normals at the grid vertices as following: ...
Victor's user avatar
  • 11
1 vote

How to construct the marching cubes tables algorithmically?

Disclaimer: Not tested yet. Edit: Tested and works, code on demand. The configuration, or rather the mesh, can be calculated in a slightly simpler, in my opinion, way, although this is less efficient,...
Max Izrin's user avatar
  • 111

Only top scored, non community-wiki answers of a minimum length are eligible