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

Thanks cowcow. I've pushed some changes that may help you.

I should point out that the function you've chose is fractal. I'm afraid that it may not be "sufficiently smooth" enough for the gradient evaluation to work. This might be a time where you are better off sticking with marching cubes.

Well, thank you for providing enough code to be able to try it out on the fractal.

It's worth noting that when C_x, C_y, C_z, C_w are all zero, a unit sphere should be generated.

Advertisement

Is there no other way to calculate a normal numerically? :(

Fractals are not differentiable, so the normal is not defined. No wonder you are having a hard time computing it. :)

 

It is only differentiable when the number of iterations is 0 -- it produces a ball with a smooth surface. :(

Thanks everyone for providing help and information.

I love this, I've only read one page so far, but I already understand so much more than I did before. Thank you so very much for writing this!

I've made some tutorials myself, but this is at least a hundred times better. I love your style and how you explain things.

if (Try()) Do();
else DoNot();
Advertisement

I remember now: I found the "surface" of a quaternion Julia set in software that I coded some years ago. It's just a matter of copying the code from one project to another, if I can find it. I believe it looks at the 26 neighbouring cells to see which cells are "on", and calculates the surface normal from that by averaging the normal from all 26 cells.

I am bound to figure out how to get the surface normal for the awesome dual contouring algorithm!!!

fractals_flat.png

3 hours ago, cowcow said:

It is only differentiable when the number of iterations is 0 -- it produces a ball with a smooth surface. :(

Thanks everyone for providing help and information.

Actually, for any finite number of iterations, the set of points for which a divergence has not been found has a differentiable boundary.

Those pictures are pretty!

 

20 minutes ago, alvaro said:

Actually, for any finite number of iterations, the set of points for which a divergence has not been found has a differentiable boundary.

The trick to make central differencing based normals work is to exploit this fact, and vary the delta based on the iteration.

As long as your delta isn't less than about half the step width for a given iteration, it'll produce useful surface normals...

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

I tried the 26-neighbour sampling and it comes up with the same choppy surface. I'm thinking I need to generate a few hundred points along a 2-sphere of radius d, and use those as the sample points.

This topic is closed to new replies.

Advertisement