Calculating Colorful PicturesPosted: March 29, 2012
Here is a Mandelbrot set coded up using the BanateCore (SetPixel). Co particular color palette, so just raw value from 0 – 255, turned into grayscale.
In the earliest days of my programming on a Commodore PET, I had fun doing stuff with graphics. At that time, one of the biggest challenges I had was doing a floor fill routine in 6502 assembly. We’re a far cry, and quite a few gigahertz beyond the speed of that early machine, but I find myself once again staring at images that were fun to create about 30 years ago.
Nowadays, with the BanateCore, it’s fairly straight forward to simply think of my graphics environment as not much more sophisticated than a VGA frame buffer circa 1980 or so. You know, select a mode, then setpixel, and you’re done. So, here’s another machination using those very basics. A rendering of the mandelbrot set.
Way back in another day, I had the benefit of working with Benoit Schillings while at Be Inc. Benoit is quite an extraordinary programmer. Way back then, on a lowly BeBox, I saw him code up a mandelbrot viewer that allowed you so navigate and zoom around in realtime. Mind you, this was about 15 years ago, with a lot less horse power than we have today. What I’ve produced here is nothing as slick as what we had then, but it is the basics. My goals is to be able to tweak the speed until it is satisfactory for realtime navigation.
From what I’ve seen over the years, one of the key challenges in Mandelbrot presentation is selecting the proper color scheme. In this case, I simply used a frequency converter. That is, 0 == lowest frequency, 255 == highest frequency. Turn that into an RGB value, and that’s that.
Same coloring scheme, except in this case it just so happens to look much more interesting because of this particular region of the fractal.
What has been fun about this little experiment is that it’s just one more case where I’m able to wring some more performance out of the system, and simplify the API design that much more. Little applets like this can be created in roughly 200 lines of code. My goal is to remove about 50 lines of code from that equation, so that rendering such simple things is so brain dead simple that anyone could do it.