Framework 4 (Last updated: October 25, 2019)Framework 3 (Last updated: February 6, 2017)Framework 2 (Last updated: October 8, 2006)Framework (Last updated: October 8, 2006)Libraries (Last updated: September 16, 2004)Really old framework (Last updated: September 16, 2004)
Monday, November 11, 2002 | Permalink
Mandelbrot.zip (88 KB)
Aah, I remember the old days. I was 17, sat there at school by the 486 machines with some friends coding on our mandelbrot set viewer in Pascal for DOS. It generally took a minute or two to get our picture, but it was very fun and interesting. You never really got bored by zooming in on interesting parts, waiting for the computer to finish and the zoom again ... ah, those were the days.
Time went by and today we have much more powerful computers. Still it's a quite slow process generally to render mandelbrot sets. So what I'm demonstrating today is the maybe quite original idea of accelerating the process with todays fragment shading hardware.
What we see here is a mandelbrot renderer that generates mandelbrot sets at framerates of around 60fps on a Radeon 9700 in 1024x768. In the old days you'd use a custom palette for getting a nice colored setup. I however have let the distance to origin of the end point determine the final color. This way we don't get any banding like you'd get in the old days.
As anyone who have done a mandelbrot renderer should know, for mandelbrots to look really good you need a lot of precision. On the CPU you could use normal 32bit float, but as you start to zoom you'll get pixelation. Even a 64bit float runs out of precision after a while. So in the old days I used full 80bit floats. On a Radeon 9700 you have 24bit precision in the fragment shader pipeline. This means that you can't really zoom a whole lot before the lack of precision gets apparent. Zooming and panning is done with your normal back/forward/up/down/left/right keys.
Will run on Radeon 9500/9700 only at this time.
Updated with an improved shader, it now performs one iteration in 3 instructions, previously it took 5 instructions. Thanks to Basic for hints and inspiration.
Instead of going with higher performance I went with adding more iterations instead, which resulted in better detail. I also made it more colorful with a dependent texture read into a texture to look up the final color.
Updated with a zoom console command to let you define an exact zoom for comparion purposes.
Type "zoom" to get the current (left, top, right, bottom) coordinates.
Type "zoom left, top, right, bottom" to set the zoom. You can cut'n'paste from a previous "zoom" command.