https://github.com/a-k-o-r-a/mandelbrot_gpu
Just trying out GPU rendering with rust
https://github.com/a-k-o-r-a/mandelbrot_gpu
gpu mandelbrot mandelbrot-viewer rust wgpu
Last synced: 10 days ago
JSON representation
Just trying out GPU rendering with rust
- Host: GitHub
- URL: https://github.com/a-k-o-r-a/mandelbrot_gpu
- Owner: A-K-O-R-A
- Created: 2023-02-20T15:53:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-06T18:37:51.000Z (over 3 years ago)
- Last Synced: 2025-03-11T10:50:16.731Z (over 1 year ago)
- Topics: gpu, mandelbrot, mandelbrot-viewer, rust, wgpu
- Language: Rust
- Homepage:
- Size: 1.86 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GPU Mandelbrot renderer
This is a simple Mandelbrot renderer implemented in rust using the [`wgpu`](https://crates.io/crates/wgpu) crate.

## How to run
To run this project simply clone it and do `cargo run`, using the `--release` flag is not necessary as the heavy computations are done on the GPU and therefore not affected by the rust compiler optimizations.
```bash
git clone https://github.com/A-K-O-R-A/gpu_test
cargo run
```
You can move with W/A/S/D, the arrow keys or by dragging with the mouse and sse the mouse wheel to zoom in or out.
### The following Keybindings are available
| Key | Description |
| --- | ----------------------------- |
| R | Reset everything |
| , | decrease Iterations (-100) |
| . | increase Iterations (+100) |
| K | decrease Radius (-0.1) |
| L | increase Radius (+0.1) |
| O | decrease coloring Factor (-1) |
| P | increase coloring Factor (+1) |
## How it works
The rendering pipeline consist of a vertex shader that creates a quad covering the entire screen and a fragment shader that then calculates the correct color for every pixel on the screen.
You can read more about the computation of the mandelbrot set on the [Wikipedia page](https://en.wikipedia.org/wiki/Mandelbrot_set#Computer_drawings) about the mandelbrot set, this project uses a optimized escape time algorithm as described in the wikipedia article "[Plotting algorithms for the Mandelbrot set](https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set#Optimized_escape_time_algorithms)".