4

I want to create a random fractal terrain on the gpu (with a compute shader). I've started with implementing marching cubes: Generating Complex Procedural Terrains Using the GPU, and it works really good: marching cubes on the gpu. However, marching cubes can't extract sharp features or use an adaptive resolution.

So I looked for an advanced isosurface extraction algorithm and found Dual Contouring of Hermite Data. So I implemented dc in Java to test this algorithm and it looks great: dc on the cpu. (There are some holes in the mesh and no sharp features, but I was too lazy to implement/fix this because it's only a prototype.)

But I've noticed some negative aspects:

So I continued my search for a better algorithm and found Cubical Marching Squares: Adaptive Feature Preserving Surface Extraction from Volume Data. This seems to be the perfect algorithm for me: intercell-independent, adaptive, sharp features, primal structure and even manifold. Unfortunately, there are no resources on how to implement this algorithm except for this Cubical Marching Squares Implementation. I think I understand the two parts of the algorithm: create a grid, for each cell:

  1. Subdivide until the maximum depth is reached or there is no need to do so.

  2. Split each cell into 6 faces, extract their surface and stitch them together.

But I don't know how to connect those two parts (especially the part with transitional faces, page 38).

So does anybody know how to implement dc as a shader, how to implement cms or a better algorithm (maybe dual marching cubes, I think it has the same problem as dc, but I haven't tested it yet)?

fospathi
  • 537
  • 1
  • 6
  • 7
sidit77
  • 49
  • 5
  • awesome research, good question, did you find some more resources for it? i'll add a bounty on this if it helps you find the answer. cool topic i am interested to know more, if you know yourself and if others know as well. – bandybabboon Mar 29 '16 at 09:57

1 Answers1

2

As you have already mentioned for the GPU you would need no intercell-dependencies... I'm sure people have come up with workarounds for that on DC but CMS should be one of the best for all those things that you need, namely intercell-independent (by definition), preserves sharp features, creates manifold geometry, and supports adaptive resolution.

In terms of resources on CMS I agree they are quite limited.

The original paper: http://graphics.csie.ntu.edu.tw/CMS/

This project by Matt Keeter has a 'C' CMS implementation in it (https://www.mattkeeter.com/projects/kokopelli/) https://github.com/mkeeter/kokopelli <-- code

I used Matt Keeter's implementation as a reference for my partial 'C++' implementation (the thesis that you linked), here is the code for it in case you didn't find it: https://bitbucket.org/GRassovsky/cubical-marching-squares

However keep in mind that it is indeed partial, that is to say it has the main algorithm working (adaptive and manifold), but I haven't got around to implement the sharp-feature preservation, 2D and 3D disambiguation, etc. It is also currently a basic CPU implementation... I had the good intentions to implement all those things and make a GPU implementation but for now have had no time.

"But I don't know how to connect those two parts" - that only goes to say how badly I have written my thesis, because I try to explain how I do this :D (Mind you, I am not sure exactly how this was done in the original paper... should we say that some things are not very clear there and you would have to use your imagination :))

G.Rassovsky
  • 774
  • 1
  • 10
  • 23