Advertisement

Marching Cubes and Dual Contouring Tutorial

Started by April 15, 2018 03:35 PM
35 comments, last by Boris The Brave 6 years, 8 months ago

I even performed Taubin smoothing on the mini-meshes. It didn't work out. I have code for it.

@Boris The Brave When using Marching Cubes, one can create arbitrary meshs by altering the density data randomly. However, since we need the normal to perform dual contouring how would one go about doing that ?
Right now, you're using a signed distance function & calculate the normal from that function. What if you're not using a signed distance function ? How do you go about calculating the normal at the point of a sign change ?

Advertisement

If you don't have gradient data, you want surface nets, not dual contouring (briefly mentioned in the article): find the locations of the sign changes around the cell, and pick the average point of those to be the vertex of the cell. Effectively this is the same as assuming the normals are always perpendicular. 

I don't think that's accurate. Take this Example:

If he generates the terrain using an SDF, the SDF is not going to be accurate anymore once you alter the mesh, is it ? So, somehow he is still able to calculate the normal without the original SDF.

7 hours ago, LifeIsGood said:

If he generates the terrain using an SDF, the SDF is not going to be accurate anymore once you alter the mesh, is it ? 

They aren't altering the mesh, they are adding/subtracting from the signed distance field, and then re-running dual contouring.

One of the nice benefits of signed distance fields is that CSG operations can be implemented very simply.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Also, that author makes it very clear he has a signed distance and is evaluating it more than once per cell in order to get gradients. If you follow this link and search for DensityFunc, you'll see him getting gradients from multiple evaluations of the function.

This topic is closed to new replies.

Advertisement