How to make a beautiful mesh of the Mandelbulb?

248 Views Asked by At

I know how to render a beautiful Mandelbulb with ray-tracing, as this one.

But how to get a beautiful Mandelbulb as a 3D mesh? The Mandelbulb can be constructed as an isosurface, and I tried to do this mesh with the marching cubes algorithm but the result is not very nice:

enter image description here

However it's possible to get a beautiful mesh of the Mandelbulb: here is one.

I also tried the isosurface extraction method provided by the CGAL library, but didn't get a pretty result as well.

1

There are 1 best solutions below

0
On BEST ANSWER

I didn't take the correct isosurface equation. Now I get a pretty mesh with the marching cubes algorithm:

enter image description here

double mandelbulb(double x0, double y0, double z0) {
  double x = x0;
  double y = y0;
  double z = z0;
  double r2, theta, phi, r6, r8;
  double dr = 1.0;
  for(int i = 0; i < 24; i++) {
    r2 = x * x + y * y + z * z;
    if(r2 > 4) {
      return 0.25 * sqrt(r2) * log(r2) / dr;
    }
    r6 = r2 * r2 * r2;
    dr = 8.0 * r6 * sqrt(r2) * dr + 1.0;
    theta = 8.0 * atan2(sqrt(x * x + y * y), z);
    phi = 8.0 * atan2(y, x);
    r8 = r6 * r2;
    x = r8 * cos(phi) * sin(theta) + x0;
    y = r8 * sin(phi) * sin(theta) + y0;
    z = r8 * cos(theta) + z0;
  }
  return 0.0;
}

Then generate the voxel on a grid of the cube [-1.2, 1.2] x [-1.2, 1.2] x [-1.2, 1.2] and take 0.005 as the isolevel.