Skip to content

A-K-O-R-A/mandelbrot_gpu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPU Mandelbrot renderer

This is a simple Mandelbrot renderer implemented in rust using the wgpu crate.

Screenshot

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.

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 about the mandelbrot set, this project uses a optimized escape time algorithm as described in the wikipedia article "Plotting algorithms for the Mandelbrot set".