pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Mandelbrot Set Viewer

Mandelbrot Set Viewer - 2.0.0

Ian Mallett (geometrian)

Tags:

Description

First of all, this is not another release of my other Mandelbrot Set program (http://www.pygame.org/project/675/). This program is not all about rendering huge images (although it does do that too), it is about zooming in indefinitely.

Starting with an image of the Mandelbrot Set, draw a rectangle with the mouse, and the program will zoom to fill that rectangle. This can go on indefinitely. If you choose a small enough screensize, (such as 300x200), the wait to see the zoomed image is only a few seconds. You can then zoom in on that image, and so on. Unfortunately, at a certain point, Python's float handling gets too imprecise, and you can actually see rounding errors as pixelated blocks. Though this is somewhat amusing, I may fix it later so that you can zoom in truly forever.

Once you have a nice view, you can take a picture of it, and have the computer render the current window at any resolution. (For example, the screenshot here is a 1200x800 render of a section of the Mandelbrot Set viewed on a 300x200 screen).

Changes

-Because there are so many people who wanted it, this version now is no longer monochromatic! I have to admit, the effect is impressive. There are three monochromatic color modes (Red, Green, and Blue), as well as the multi-coloured method you see here. There is such a thing as smoothing, which smooths out the bands of colour, but I had trouble implementing it.
-Gave the text a background so that you can see it.
-Added optional antialiasing (don't worry, it's fast)
-Probably some bug fixes...

Links

Home Page: http://www.geometrian.com/programming/projects/index.php?project=Mandelbrot%20Set
Windows: http://www.geometrian.com/data/programming/projects/Mandelbrot%20Set/Viewer%202.0.0/MandelbrotSetViewer2EXE.zip

Screenshot


click to view original size

Releases

Mandelbrot Set Viewer - 5.01 - Sep 5, 2014
Mandelbrot Set Viewer - 5.00 - Jun 30, 2013
Mandelbrot Set Viewer - 3.0.0 - Apr 26, 2008
Mandelbrot Set Viewer - 2.0.0 - Apr 19, 2008
Mandelbrot Set Viewer - 1.0.0 - Apr 13, 2008

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

September 5, 2014 4:16pm - Ian Mallett - nickname: (geometrian)
Version 5.01 released!
June 30, 2013 1:47am - Ian Mallett - nickname: (geometrian)
Version 5.00 released! Countless improvements. Is now PyOpenGL based for greater speed. If the shader implementation requires too new a GPU, the previous version is still available.
February 1, 2010 7:17am - Daniel Sigurdsson - nickname: (danni)
It's a bit slow. I think the "abs" function in the calculation uses a square root (since z is complex). You can replace the test with the equivalent "if z*z > 4: break". Square roots are expensive, especially when done up to 255 for hundreds of thousands of points.

also: "Well now, let's try that again, shall we?"

Don't be condescending to the user, man!
August 30, 2009 2:09pm - Ian Mallett - nickname: (geometrian)
Peter, that's because you have a netbook with a horrible processor ;-)
py_beginner, as the mailing list, if you haven't already.
July 17, 2009 5:59am - py_beginner - nickname: (beginner)
Hi, I try to make the example for python 3.0.1 with pygame2, but I have problems with passing from pygame to pygame2. So if someone know how to do it or already did it please help me
July 8, 2009 11:18pm - Peter Mallett - nickname: (pycookies)
It runs really slow on my computer. even the smallest setting takes a long time, then it crashes
April 27, 2008 9:29pm - Ian Mallett - nickname: (geometrian)
As far as I know, PyGlet and PyGame are similar, but they use different backends for rendering. Also, the coding style required by PyGlet is very different than PyGame--this is one of the problems I'm having.

The rectangles are a nightmare. Hopefully, the next release will use shaders--programs on the GPU--giving realtime zooming and doing away the the rectangles altogether. I've been having issues with the tech. though--big ones. I've tried using PyGlet, PyOpenGL, and both together, but nothing seems to work.

The shading example I'm going from is written in PyGlet, so I'm trying to both implement algorithms, port code to PyGame/PyOpenGL, learn shading language, carry over previous features, and actually make it work.

I have a semi-working example in PyGlet, but it is nowhere near good enough--no zooming, rendering, etc, (though it is very fast).
April 27, 2008 11:06am - pymike - nickname: (pymike) - 4/5
Nice new release, but it doesn't appear to be any faster. Also if I try to zoom in from bottom to top it messes up. Might want to fix that ;-)

@effeemme:
I really don't think Pyglet and PyGame are similar. I've made a game with Pyglet and I had to do almost everything quite a bit differently.
April 27, 2008 9:07am - Francesco Mastellone - nickname: (effeemme)
Well, isn't pyglet almost the same library as pygame but with OpenGL rather than SDL? To keep this a pygame program I'd say using PyOpenGL would be better. Program's awesome by the way!
April 26, 2008 3:12pm - Ian Mallett - nickname: (geometrian)
Version 3.0.0 released!
Shaders hopefully in next version.
April 26, 2008 1:47pm - Ian Mallett - nickname: (geometrian)
To use shaders, I would need to either use PyGlet or PyOpenGL. That's an extra dependency which I would rather not deal with. Oh well. It must be done. Any preference to which?
April 23, 2008 11:48pm - Ian Mallett - nickname: (geometrian)
I've made a lot of improvements here--minor stuff like polished text output, and some larger stuff--and have now come across a practical way to do this real-time. I'll work on implementing that A.S.A.P. The 2400x1600 screenshot there could be rendered in a few seconds at most...
April 21, 2008 8:47pm - pymike - nickname: (pymike) - 4/5
Woot! This is cool. Might want to smooth out the coloring though...
April 19, 2008 5:07am - Luca Fabbri - nickname: (keul) - 4/5
Now is impressive! Good work!
April 19, 2008 12:57am - Ian Mallett - nickname: (geometrian)
Version 2.0.0 released!
April 19, 2008 12:57am - Ian Mallett - nickname: (geometrian)
Thanks! You can fix that error by using PyGame 1.8.
April 18, 2008 3:58pm - Martin Ahnelöv - nickname: (gasten) - 4/5
The rendered filed doesn't work with Eye of Gnome (eog) either. I examined the file, and it seems to be a tga (Targa) file. Nice app though!

Also, psyco doesn't seem to do much difference on my machine (but I haven't done any extensive tests).
April 16, 2008 10:04am - Ian Mallett - nickname: (geometrian)
Yes, but it can't zoom in forever. I assume it is in C or some related language. As you say, having a Python program that does it is good. For colours, I'll see about making other colors an option, but I like this monochromatic version too--except on CRT monitors.
April 16, 2008 6:17am - Paul Davey - nickname: (technomancer) - 5/5
have you looked at that fractal viewer yet?
it does realtime zooming with higher precision and has more than the mandelbrot set.
its still good to have a python program that does them though.
April 16, 2008 12:28am - Ian Mallett - nickname: (geometrian)
Luke, backwards compatibility for me means supporting people who do not have all of the same modules I do. Besides backwards compatibility, there are very few good reasons not to get another module. Short answer, a try/except is probably a good idea, but the real speed solution is to just download psyco in the first place.

Marcel, I think this is an interesting idea, but in the case of the window, it should only take a few seconds to load. If it take more than about 5 seconds, your window is too big. The external render is for when you really want to see something in good detail. It takes me about 10 zooms to get to Python's float limits, I think this screenshot was 5 or 6. That is 5 or 6 renders, so 5 or 6 outputs. If you zoom in to several separate images, reseting the view each time, that is a good deal of render status lines cluttering the console. The other thing is that this would slow the render down. When a high-res. screenshot is rendered, it actually takes more time because of the status reports. This minute delay would become noticeable with the relatively short rendering time for the normal view. Note that while rendering, the program does not update the screen or check for input--this, too, makes it faster.
April 16, 2008 12:11am - Marcel Rodrigues - nickname: (marcel)
Indeed, there are messages in the console when the program is saving a image to a file. I wanted to see these messages when the program is drawing the image on the window. This is what I called "render". Just a terminology confusion.
April 15, 2008 10:51pm - Luke Paireepinart - nickname: (rabidpoobear)
You should modify it to test for psyco, but I don't really see how that's backward compatibility. I don't know of any python distros where psyco is included by default. I know a lot of people who don't use it, actually.
As far as 1.8, you're right, I didn't install the update yet. I should have provided this information as well but I was in a hurry.
To Marcel, there are messages in the console. It even has a percentage of completion of the render.
April 15, 2008 6:31am - Paul Davey - nickname: (technomancer) - 5/5
this is nice
BUT:
it would look better with colours
and realtime zooming is nice and actually possible
look for a program called XaoS it displays fractals like this with infinite zoom (only limitation is that the thing will lose the pattern after a while unless you turn the iterations up which makes it render slower(ie only likited by number of iterations))
its a cool program and does colour YAY
April 15, 2008 12:44am - Marcel Rodrigues - nickname: (marcel) - 4/5
Nice idea!
The images have some kind of pretty shading.
I just wished to view messages like "rendering..." and "render completed" in the console.
April 14, 2008 8:13pm - Ian Mallett - nickname: (geometrian)
As far as backwards compatibility is concerned, I will modify it to test for Psyco.

However, the .png saving issue is probably caused by PyGame 1.7. The solution is to update to 1.8, but, (if you really don't want to do that for some reason), you can change the program to save as .tga
April 14, 2008 5:45pm - Ian Mallett - nickname: (geometrian)
True, I should make backwards compatibility. I shall remember.
As for your error, I am confused myself. For me, it works fine. I also showed it to someone, and it didn't work, then to PyMike, which worked. Curious, that. I'll look into it further.
April 14, 2008 2:57am - Luke Paireepinart - nickname: (rabidpoobear)
Also, on Windows, Photoshop, Paint and Image Preview were unable to open the generated PNG from a 300x200 screen to a 1200x800 destination.
April 14, 2008 2:48am - Luke Paireepinart - nickname: (rabidpoobear) - 4/5
I would suggest you modify your code as such:
try:
import psyco
psyco.full()
except ImportError: pass

The draw time is a bit long, perhaps because I don't have psyco. Pretty neat though.
April 13, 2008 4:46pm - Ian Mallett - nickname: (geometrian)
Version 1.0.0 released!
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Oct 1, 2014

Sep 19, 2014

Sep 17, 2014

Sep 9, 2014

Sep 8, 2014

Sep 7, 2014


Sep 5, 2014

Aug 26, 2014

Aug 21, 2014


Aug 18, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)