Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dpetrosy/fractal

This project is a Fractal Visualizer developed in C++ with SFML and CUDA.
https://github.com/dpetrosy/fractal

burning-ship cmake cmakelists cpp cpp-programming cpp-project cuda cuda-opengl cuda-programming fractal fractal-generation fractal-visualization julia mandelbox mandelbrot opengl opengl-project sfml sfml-library tricorn

Last synced: about 1 month ago
JSON representation

This project is a Fractal Visualizer developed in C++ with SFML and CUDA.

Awesome Lists containing this project

README

        





Logo


Fractal Project








๐Ÿ“œ About Project
ยท
๐Ÿ“‘ Fractals List
ยท
๐ŸŽฎ Controls
ยท
๐Ÿ‘จโ€๐Ÿ’ป Usage
ยท
๐ŸŒ„ Screenshots


---

## ๐Ÿ“œ About Project

A fractal is a fragmented geometrical figure that infinitely repeats at smaller scales. \
So this project generates beautiful fractals from the complex numbers of an iterative mathematical construct. \
For graphics, I used [SFML](https://www.sfml-dev.org/index.php) library and [NVIDIA CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit) for parallel computing. \
Project builds by [CMake](https://cmake.org/) build system, so if you do not have CUDA Toolkit or your platform doesn't have
CUDA support, CMake will build this project without CUDA support and computing will be done through CPU threads. \
By default, there will be **40 parallel threads**, the color is rgb(21, 0, 0) and the window size is 800px.

> [!NOTE]
> If you want to change color, threads count, window size, or other defaults, change them in **helpers.hpp** file.

## ๐Ÿ“‘ Fractals List

The program supports these fractal sets:

| Name | Formula |
|:------------------:|:--------------------------------------------------------------------------------------------------------:|
| Mandelbrot | $z_{n+1} = z_n^2 + c, z_0 = 0$ |
| Julia | $z_{n+1} = z_n^2 + c, z_0 = c$ |
| Burning Ship | $z_{n+1} = abs(z_n^2) + c, z_0 = 0$ |
| Tricorn | $z_{n+1} = \overline{z_n}^2 + c, z_0 = 0$ |
| Mandelbox | It's more complex, see [this article](https://sites.google.com/site/mandelbox/what-is-a-mandelbox) |
| Multibrot | $z_{n+1} = z_n^d + c, z_0 = 0, d = 5$ |
| Mandelbar | Take a look at **Mandelbar 5th (horizontal)** in [this image](README_files/Reference/Fractals_5th.png) |
| Per. Burning Ship | Take a look at **Perpendicular Burning Ship** in [this image](README_files/Reference/Mandelbrot_set.png) |
| Celtic Mandelbrot | Take a look at **Celtic Mandelbrot** in [this image](README_files/Reference/Mandelbrot_set.png) |

#### Useful Links:
https://www.deviantart.com/kosmic-stardust/art/Mandelbrot-ABS-Variations-Complete-Set-of-Formulas-487039852
https://www.deviantart.com/kosmic-stardust/art/4th-Order-ABS-Mandelbrot-Variations-Complete-Set-601300868
https://www.deviantart.com/kosmic-stardust/art/5th-Order-ABS-Mandelbrot-Variations-601484985

## ๐ŸŽฎ Controls

The program supports the following controls:

| Key | Description |
|:-------------:|:---------------------------------------:|
| ESC | Close the program window |
| Keys [1-9] | Move to another fractal |
| Key R | Change the red component of fractal |
| Key G | Change the green component of fractal |
| Key B | Change the blue component of fractal |
| Mouse Scroll | Zoom in and out of the fractal |
| โฌ†๏ธ โฌ‡๏ธ โฌ…๏ธ โžก๏ธ | Change the viewpoint |
| Key L | Lock Julia's fractal |
| Zero | Reset the fractal to its initial state |

## ๐Ÿ‘จโ€๐Ÿ’ป Usage
### Requirements

The program is written in C++ and thus needs the **g++ compiler** and some standard **C++ libraries** to run. \
Also needs to install **SFML** library and **CMake**. If you want to use your NVIDIA GPU power, you need to install **NVIDIA CUDA Toolkit**.

### Instructions

**1. Compiling the program**

To build the release version, run these commands:

```shell
$ cd path/to/fractal
$ mkdir Release
$ cd Release
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make
```

To build the debug version, run these commands:

```shell
$ cd path/to/fractal
$ mkdir Debug
$ cd Debug
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make
```

**2. How to run the program**

Run the executable too see the help message:
```shell
./fractal
```

Or run with some supported fractal:
```shell
./fractal mandelbrot
```

> [!NOTE]
> For CUDA support, you need to install CMake version >= **3.24** \
> If you want to disable CUDA support, just uncommnet line 19 in **CMakeLists.txt file**.

# ๐ŸŒ„ Screenshots

## Mandelbrot
![Fractal Mandelbrot](README_files/Screenshots/Mandelbrot_1.png)
![Fractal Mandelbrot](README_files/Screenshots/Mandelbrot_2.png)

## Julia
![Fractal Julia](README_files/Screenshots/Julia.png)

## Burning Ship
![Fractal Burning Ship](README_files/Screenshots/Burning_Ship.png)

## Tricorn
![Fractal Tricorn](README_files/Screenshots/Tricorn.png)

## Mandelbox
![Fractal Mandelbox](README_files/Screenshots/Mandelbox.png)

## Multibrot
![Fractal Multibrot](README_files/Screenshots/Multibrot.png)

## Mandelbar
![Fractal Mandelbar](README_files/Screenshots/Mandelbar.png)

## Perpendicular Burning Ship
![Fractal Perpendicular Burning Ship](README_files/Screenshots/Perpendicular_Burning_Ship.png)

## Celtic Mandelbrot
![Fractal Celtic Mandelbrot](README_files/Screenshots/Celtic_Mandelbrot.png)