SFML community forums

General => SFML projects => Topic started by: Ceylo on September 08, 2012, 08:34:56 pm

Title: Mandelbrot Fractal Explorer
Post by: Ceylo on September 08, 2012, 08:34:56 pm
I would like to show a small project I've been working on for a fews days now.

It's a Mandelbrot fractal (http://en.wikipedia.org/wiki/Mandelbrot_set) explorer. You can zoom in up to 10.000.000.000.000 times and get precise rendering even at such scales (but at the cost of more rendering time). Move wherever you want, take screenshots and enjoy!

The explorer uses SFML to display the result, Thor to handle user commands and Intel TBB to parallelize work and accelerate rendering by using all of the available CPU cores (you may soon have a cooker integrated in your computer!).

(http://f.cl.ly/items/142r1M3c1P0a1k170138/screenshot-1347107057.png)

http://www.youtube.com/watch?v=pYSXlWgMZsE


Downloads

If you want to give it a try on Windows:
- in case you don't already have Visual C++ 2010 installed, download the Visual C++ 2010 Redistributable Package (http://www.microsoft.com/en-us/download/details.aspx?id=5555) and install it
- download the Fractal Explorer (https://github.com/downloads/Yalir/FractalExplorer/Fractal%20Explorer.zip)

And on OS X 10.7+:
- download the Fractal Explorer (https://github.com/downloads/Yalir/FractalExplorer/Fractal%20Explorer%20for%20OS%20X.zip)

You can have a look at the sources (https://github.com/Yalir/FractalExplorer) if you're interested but there's no easy way to build the program for now and there's been small modifications in the meantime. So it's mostly for curiosity purpose :) .


I hope you'll enjoy the exploration as much as I did!
Any feedback or comment is of course welcome :)
Title: Re: Mandelbrot Fractal Explorer
Post by: eXpl0it3r on September 08, 2012, 08:46:12 pm
Nicely done, I like it! :)

Can you tell us a bit more how you went about rendering it? I mean what do you exactly do? Draw all the pixels on your own?
Title: Re: Mandelbrot Fractal Explorer
Post by: Ceylo on September 08, 2012, 09:11:46 pm
Yes sure!

A texture of the size of your screen and a buffer are created. The buffer is large enough to store all of the pixels that'll be sent to the texture.

The pixels are stored as RGBA data in that buffer. All of these pixels are set according to Mandelbrot formula (which can tell you wether a point belongs to the fractal), and as pixels don't depend on each other, I can parallelize that work. Once everything is rendered, pixels are sent to the texture and displayed. So actually, the only part of the fractal that is rendered is the one you see on the screen. That's also why rendering must be redone each time you want to move in the fractal.

I can't render the whole fractal except when it's not scaled, because it would take way to much time and memory to compute and store millions of billions of pixels.
Title: Re: Mandelbrot Fractal Explorer
Post by: Nexus on September 09, 2012, 12:50:46 pm
Very nice! :)

It looks good, and the blue colors are well chosen (not that pink-green-blue mess you see at some other (http://mathworld.wolfram.com/images/eps-gif/MandelbrotSet_1000.gif) Mandelbrot figures).

When I zoom far in (x 1e13), the fractal becomes pixelized. Does this happen because the floating point numbers lose precision?
Title: Re: Mandelbrot Fractal Explorer
Post by: Ceylo on September 09, 2012, 01:05:44 pm
Thanks!

Yes indeed it becomes pixellated, that's why I said you can zoom in up to this scale. But honestly for now I don't know where the error happens. The floating point precision error makes sense as errors are of 1e15 with double type, so indeed the accumulation of computation errors may make it pixellated at 1e13.
Title: Re: Mandelbrot Fractal Explorer
Post by: Ceylo on September 10, 2012, 01:16:18 pm
I've added a little video of the explorer in the first post :)
Title: Re: Mandelbrot Fractal Explorer
Post by: TheSilverWebsurfer on September 12, 2012, 05:07:48 pm
Wow, I'm really impressed!

I used Mandelbulb, which makes it in 3D, but can take a lot of time to render scene.

But your soft is really beautiful, so are the fractals it produces, and the zoom feature is astonishing!
Title: Re: Mandelbrot Fractal Explorer
Post by: Ceylo on September 13, 2012, 07:58:39 pm
Thanks TheSilverWebsurfer!

I'm currently trying to see if I can get even faster rendering and responsive UI even while rendering. And in the meantime I found out some interesting areas in the fractal. For those that are interested, see http://cl.ly/image/2g2m0j361J1s