A simple Mandelbrot renderer built with CUDA. It splits the screen up into a load of tiles 32 pixels by 16 pixels and hands each tile off to a CUDA thread block. The algorithm generates 256 different colour values which are rendered in SDL. It uses single-precision IEEE floats, so artifacts appear at extreme zoom levels. It runs at about 50fps on my CUDA card, which is an old GeForce 9600 GT. It's about a factor of ten faster than the equivalent CPU implementation.

This video was actually rendered from 5000 individual frames saved by SDL, using this:

avconv -f image2 -r 60 -i f%04d.bmp -c:v libx264 -preset veryslow -crf 30 out.avi

...so technically it's not realtime, but this is more or less what it actually looks like when running realtime. Actually in reality it looks much nicer because there are no encoder artefacts and it hasn't been clamped to 30fps by Vimeo.

The zoom ratio in the video is roughly akin to zooming a view of the Earth from space down to the scale of a house.

The relevant bit of CUDA code is here:



Feel free to use the code but please respect its GPL license.

Loading more stuff…

Hmm…it looks like things are taking a while to load. Try again?

Loading videos…