Skip to content

Maraneshi/cuda-mandelbrot

Repository files navigation

CUDA Mandelbrot

An interactive CUDA Mandelbrot set explorer, runs on Windows and Linux.

Example output:

Section from a regular Mandelbrot set "Burning Ship" set

Dependencies

  • Windows: Visual Studio 2022
  • Linux: C++11 compatible compiler
  • CUDA 7 or higher, VS project requires CUDA 12.6 because of the hardcoded property sheet names but could easily be search & replaced
  • GPU with Compute Capability 5.0 (Maxwell) or higher

Help

IMPORTANT: Keep in mind that by default most OS will kill your process and reset the driver if a GPU job doesn't return after a few seconds. If you intend to generate large pictures, you should increase this timeout.
Even during normal GUI operation it is very easy to accidentally hit this limit since the application will switch from single-precision to double-precision calculations if required for the current zoom level. This causes a slowdown between 8x and 32x on most consumer GPUs (2x on some professional models which have more 64-bit ALUs).

Default mode is interactive GUI with help on screen.
GUI Screenshot

Get command line options with --help.
Tip: Use the GUI to find a nice section and dump the parameters out to generate a large image offline via the CLI (see next section).
CLI Screenshot

Saving Parameters and Images

In GUI mode you can press P to write the parameters of the current view to input.par. CTRL+P will load parameters from that file.
You can use -f xxx.par from the command line to load parameters at startup.

Pressing I will write the current image to output.bmp exactly as it is displayed on screen (without the text overlay). CTRL+I will write the supersampling buffer instead, i.e. if you are displaying at 16 samples per pixel, the image written will be 16x as large.

Fractal Types

Mandelbrot Set (-t 0, default):
-t 0
Exponent 3 (-t 1):
-t 1
Arbitrary Exponent (-t 2):
-t 2
Burning Ship (-t 3):
-t 3

Coloring Options

Distance function 0 (-c 0):
-c 0
Distance function 1 (-c 1):
-c 1
Distance function 2 (-c 2):
-c 2
Smooth iteration count (-c 3, default):
-c 3

Acknowledgements

Implementation of smooth iteration count from Íñigo Quílez, Smooth Iteration Count for Generalized Mandelbrot Sets.
Implementation of Hubbard-Douady distance function from Íñigo Quílez, Distance Rendering for Fractals.