Welcome to Fractal Forums

Fractal Software => 3D Fractal Generation => Topic started by: folded on March 12, 2013, 03:21:17 PM




Title: OpenCL marching cubes source code release
Post by: folded on March 12, 2013, 03:21:17 PM
Hi,

I just thought I'd share the initial release of my OpenCL marching cubes code.

It's available at https://github.com/folded/clemency (https://github.com/folded/clemency).

In its current form it's probably not for the faint-of-heart, but it works, and I think it's actually pretty decently functional. It compiles fine on OSX 10.8 (OpenCL is required, so 10.6 is a definite minimum) but it may well compile in other places too. Building is done with cmake.

The image below is a meshlab "render" of the mesh generated by the command:

clmc -g 512 -C "-D ITERATIONS=5"  -a -1.2,-1.2,-1.2:1.2,1.2,1.2 opencl/mandelbulb.cl


Which, in short, does marching cubes on of a power 8 mandelbulb (5 iterations), in the cube bounded by <-1.2,-1.2,-1.2> - <1.2,1.2,1.2>, on a grid size of 512.

The full set of command line arguments is in the README.

The output is a triangle mesh with 8,619,704 faces.

The nice thing about this (IMO) is that it will produce a mesh for anything you can write an OpenCL kernel for. All that's needed is to implement a function
bool inside(float3 pos);


Also, after the initial evaluation on a regular grid, the intersections are refined, so the result is a lot less "stair-steppy" than doing MC on a z-stack of image slices.

(https://raw.github.com/folded/clemency/master/images/mandelbulb.png)


Title: Re: OpenCL marching cubes source code release
Post by: makc on March 12, 2013, 05:37:15 PM
there is menger sponge hit test somewhere around here, would be nice to see how it handles sharp angles ;) edit: found it http://www.fractalforums.com/ifs-iterated-function-systems/revenge-of-the-half-eaten-menger-sponge/#msg8382


Title: Re: OpenCL marching cubes source code release
Post by: Patryk Kizny on May 24, 2015, 06:00:50 PM
Would you be able to generate poincloud instead of mesh?


Title: Re: OpenCL marching cubes source code release
Post by: flexiverse on May 25, 2015, 05:35:39 AM
Would you be able to generate poincloud instead of mesh?

Surely that defeats the point of marching cubes ?