https://github.com/lightandlight/wgpu-mandelbrot
Rendering the Mandelbrot set using wgpu
https://github.com/lightandlight/wgpu-mandelbrot
fractals graphics wgpu
Last synced: 8 days ago
JSON representation
Rendering the Mandelbrot set using wgpu
- Host: GitHub
- URL: https://github.com/lightandlight/wgpu-mandelbrot
- Owner: LightAndLight
- Created: 2022-10-22T08:54:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-10T00:30:35.000Z (almost 2 years ago)
- Last Synced: 2025-10-07T04:56:22.402Z (9 months ago)
- Topics: fractals, graphics, wgpu
- Language: Rust
- Homepage:
- Size: 5.79 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `wgpu-mandelbrot`
A realtime mandelbrot renderer using [wgpu](https://github.com/gfx-rs/wgpu).
I used this as a practise project to learn some modern graphics fundamentals via `wgpu`.
## Contents
* [Screenshots](#screenshots)
* [Usage](#usage)
* [Running](#running)
* [Controls](#controls)
* [Architecture](#architecture)
## Screenshots


## Usage
### Running
`nix develop -c cargo run --release`
### Controls
| Input | Action |
| ----------------- | ----------------------------- |
| Left click | Center image on clicked point |
| Scroll wheel up | Zoom in |
| Scroll wheel down | Zoom out |
## Architecture
Pixel [iterations](https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set#Unoptimized_na%C3%AFve_escape_time_algorithm)
and colours are stored in host memory (RAM).
Rough per-frame breakdown:
1. The remaining unescaped pixels are sent to the GPU
1. A compute shader iterates each pixel
1. The results are copied to host-available memory
1. The CPU partitions the results into newly-escaped and unescaped pixels
1. The newly-escaped pixels are used to re-compute the pixel colours
1. The new pixel colours are sent to the GPU
1. A fragment shader colours each pixel