|
||
Title: fractal exploration screen saver Post by seanick on Jun 21st, 2006, 11:02am Hi, One of the projects I have written probably the most C++ code on is a mandelbrot set fractal rendering screen saver, and it has been something I spent a lot of time figuring all of the various challenges out. one of the more recent developments was the ability to generate random fractals that are actually interesting. The way I did this, was to generate coordinates using rand() between +2.0 and -2.0 in both the real and imaginary axes. Then in order to determine if those coordinates are worth actually displaying, I do an initial 9-pixel (3x3 square) render, basing the 9 points off the coordinates that would make up the corners of the actual monitor should I pick that location. Once I render those 9 pixels, I have values from 0-255 for each one, indicating the palette entry to display. 255 is the fill color (usually black) and 0-254 are the actual colors. A problem I had seen in an earlier attempt is that most numbers in that range were actually within the large black area in the middle that is all fill. so one parameter for my evaluation is the maximum number of Fill-color pixels (up to 9) that my sample square can have. the next is the number of unique palette entries used in those nine, and the third is the range from the lowest palette index to the highest. the parameters I use currently are: #define MAX_EXPLORER_DATAPTS 9 #define NUM_EXPLORER_CYCLES 10000 #define MIN_EXPLORER_EXTENTS 45 #define MIN_EXPLORER_DISTINCT 6 #define MAX_EXPLORER_FILL_POINTS 3 I loop the code NUM_EXPLORER_CYCLES times, and give up if by then I haven't found an interesting spot to display. So far I haven't really seen it fail to find a very interesting and unique image within less than 2000 tries. 10000 cycles of 9 pixels is still only 1/15th of the number of pixels on one of my two screens so there is not very much lag to do this search. (oh yeah and one criteria for this screen saver was full multimon support! so many screen savers don't have it...) That was actually the main point of this post, the evaluation method I used in that. (which at one point I thought a possible option for a bot eval technique as well- though in hindsight theres no way it could directly apply). While i am already here though, I might as well mention another couple of optimizations I have made- 1. pre-calculate all coordinates for the x axis in an array of values, and then for the y axis, before starting the render loop 2. pre-render the boundaries of 32x32 rectangles comprising the full size of the display. if one of the rectangles has all fill color for every pixel along the border then there is no reason to render the entire rectangle- each fill color takes the maximum number of loop cycles to calculate so just doing the borders makes it more efficient. (though now that I think about it I re-render each border twice - another opportunity for improvement). once the entire image is pre-scanned for blocks which are not interesting to render, I render the actual image and just fill the uninteresting blocks with all fill color. there are quite a few more optimizations but my screen saver still isn't as fast as some other versions of the fractal code I have written and also not as fast as fractal extreme. (quite a bit faster than ultra fractal though nowhere near as cool of effects/features.) if anyone wants to see the screen saver itself let me know, I made an installer for windows XP and the like. I don't have any idea what would be needed to make it work on linux but there are very few calls other than to the windows screensaver and GDI+ libraries that could be all that different, if anyone wants to try and port it let me know and I will provide the source. |
||
Title: Re: fractal exploration screen saver Post by omar on Jul 20th, 2006, 10:26pm I would love to see it. I also wrote a Mandelbrot fractal program and also an IFS fractal program back in 1988 on an Apollo/Domain workstation. |
||
Title: Re: fractal exploration screen saver Post by seanick on Jul 21st, 2006, 11:46am ok, it's available at www.themotocam.com/ftp/screensaver.zip contains the source, installer, and raw binary, plus the registry file and palette files in case your MSI is busted (like my roommate's work computer, which is why I included it). |
||
Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1! YaBB © 2000-2003. All Rights Reserved. |