HOME | DD

lyc β€” fast, accurate mandelbrot

Published: 2008-01-08 05:43:55 +0000 UTC; Views: 2294; Favourites: 6; Downloads: 0
Redirect to original
Description rendered with 12*12 supersampling, double precision iteration to a maximum depth of 1024, floating point palette with 1024 entries (1:1 mapping with iteration count), sampled from (-2.25,-1) to (0.75,1) over the complex plane, 1800x1200 pixels.

rendering this takes 265 seconds on my 3ghz quadcore. i think that's reasonably fast, if you factor out how fast my quadcore is
Related content
Comments: 43

maschen [2016-08-10 19:54:49 +0000 UTC]

Who doesn't like the Mandelbrot set?! Must be in favourites!

πŸ‘: 0 ⏩: 0

Sinspunkt [2015-08-05 08:57:40 +0000 UTC]

Lovely to see this classic fractal, just like what I used to play with on the computer when I was small! Nostalgic!

πŸ‘: 0 ⏩: 0

zigurdu [2008-03-20 21:04:54 +0000 UTC]

Nice render there. I'm trying to do the same and similar things, but I'm more proficient at maths than C++ libraries. Did you use the pngwriter header? Or just libpng? Do you know about some site which explains how to install and use these things "for dummies"?

πŸ‘: 0 ⏩: 1

lyc In reply to zigurdu [2008-03-20 23:03:15 +0000 UTC]

nope, i just save simple bmp files and then convert them to max-compressed (which libpng curiously does not support!) pngs via the excellent and free program irfanview.

πŸ‘: 0 ⏩: 1

zigurdu In reply to lyc [2008-03-21 14:21:38 +0000 UTC]

Okay, thanks. I think I'll stick to Matlab a bit longer, though.

πŸ‘: 0 ⏩: 0

CHRiTTeR [2008-01-08 18:09:36 +0000 UTC]

remember how long it took on an amiga?

πŸ‘: 0 ⏩: 1

lyc In reply to CHRiTTeR [2008-01-09 01:47:26 +0000 UTC]

ah i never had an amiga :/ actually i started coding on a pentium 100mhz

πŸ‘: 0 ⏩: 1

CHRiTTeR In reply to lyc [2008-01-09 01:53:14 +0000 UTC]

Well, I bet that would've taken a while to render this on that too

πŸ‘: 0 ⏩: 1

lyc In reply to CHRiTTeR [2008-01-09 02:48:45 +0000 UTC]

most definitely

after i've done my exams for this month i'm going to add some nice antialiasing to it, right now it's just a straight average :/

πŸ‘: 0 ⏩: 1

CHRiTTeR In reply to lyc [2008-01-09 02:55:27 +0000 UTC]

Yeah, i noticed its a bit blurry compared to your other works but thought it was maybe a jpeg thing

πŸ‘: 0 ⏩: 0

kram1032 [2008-01-08 17:23:07 +0000 UTC]

Wow, that's an amazingly fast Mandelbrot!
But didn't you write somewhere in the past, Mandelbrot is overdone? xD
Anyway, nice palette and incredible specs
I should have about the double time (if core counts linearly affect render time, as I've a 3Ghz Dcore)

πŸ‘: 0 ⏩: 1

lyc In reply to kram1032 [2008-01-09 01:49:03 +0000 UTC]

it's actually pretty slow compared to applications that use tricks like checking for periodicity, guessing solid regions, things like that. however, as a brute force iteration, i think it's decent, as i've a very tight sse2 rendering loop that's really very minimal.

πŸ‘: 0 ⏩: 1

kram1032 In reply to lyc [2008-01-09 14:14:32 +0000 UTC]

I see...
I guess, such a guessing application is pretty hard to code?

πŸ‘: 0 ⏩: 1

lyc In reply to kram1032 [2008-01-09 15:54:21 +0000 UTC]

dunno, never tried, nor do i intend to. i just want a reasonably fast inner loop for making some simple pix; and it will be handy to have a nice tile-based antialiasing system for linear rendering.

i can only code again after january though

πŸ‘: 0 ⏩: 1

kram1032 In reply to lyc [2008-01-09 17:00:04 +0000 UTC]

I see.

Why that? O.o what's now, in january?
Exams again?

πŸ‘: 0 ⏩: 1

lyc In reply to kram1032 [2008-01-10 00:36:32 +0000 UTC]

yeah i deferred one exam and have two re-writes

πŸ‘: 0 ⏩: 1

kram1032 In reply to lyc [2008-01-10 17:54:28 +0000 UTC]

:S
Good luck

πŸ‘: 0 ⏩: 0

awesty [2008-01-08 12:03:07 +0000 UTC]

What language are you using to do this?

πŸ‘: 0 ⏩: 2

lyc In reply to awesty [2008-01-08 12:23:17 +0000 UTC]

here's an executable: [link]

πŸ‘: 0 ⏩: 0

lyc In reply to awesty [2008-01-08 12:22:46 +0000 UTC]

c++, using the sse2 extensions to iterate two points at once in double precision. it's nice and fast in 64bit mode on a 3ghz quadcore using all 4 threads, i plan to make some high quality animations with it, along the lines of what i have at [link] . btw, if you can tolerate the slowness you should check out my recent ray tracer demo: [link] (i recently sped the program up by like 2-3x because of a major oversight, but that specific scene's settings weren't saved so i left the linked application as is).

πŸ‘: 0 ⏩: 1

awesty In reply to lyc [2008-01-09 00:41:02 +0000 UTC]

I doubt my laptop will be able to take it

πŸ‘: 0 ⏩: 1

lyc In reply to awesty [2008-01-09 01:51:33 +0000 UTC]

the thing ran decently on a 2.4ghz p4, which is really slow. anyway it's not all that exciting, just interesting to see it render for a while.

πŸ‘: 0 ⏩: 0

chaos5 [2008-01-08 05:56:25 +0000 UTC]



LOL, nice color palette

πŸ‘: 0 ⏩: 2

lyc In reply to chaos5 [2008-01-08 06:52:51 +0000 UTC]

btw, i was hoping you'd provide some data on how long it takes you to render with the same settings, and whether or not you use double precision iteration for deeper zooms.

πŸ‘: 0 ⏩: 3

chaos5 In reply to lyc [2008-01-08 07:50:59 +0000 UTC]

BTW
My rendering gets distorted at a zoom of 50x10^12 and fails at 10x10^13

πŸ‘: 0 ⏩: 1

lyc In reply to chaos5 [2008-01-08 08:12:38 +0000 UTC]

double precision is as accurate as i'm willing to go, anything more is way too slow and too much hassle. my double precision loop is really nice and optimised, so i'll see how far it gets me... i've never actually gone zooming in the mandelbrot set before, even though i knew it's possible in principle, so it'll be nice to do so with my own program first

πŸ‘: 0 ⏩: 1

chaos5 In reply to lyc [2008-01-08 08:15:58 +0000 UTC]

Oh, it's lots of fun!!

πŸ‘: 0 ⏩: 0

chaos5 In reply to lyc [2008-01-08 07:45:54 +0000 UTC]

I could run it much faster without all the GUI junk that slows it down a lot.

BTW, what was the line of code you used to take advantage of multi processors?

πŸ‘: 0 ⏩: 1

lyc In reply to chaos5 [2008-01-08 08:10:44 +0000 UTC]

you'll probably get errors if you just use it without separating out your shared data, but for basic (coarse-grained!) loop parallelisation you just put "#pragma omp parallel for" in front of your loop.

πŸ‘: 0 ⏩: 1

chaos5 In reply to lyc [2008-01-08 08:15:21 +0000 UTC]

Cool, I'll search MSDN for more info too. I just needed a starting point

πŸ‘: 0 ⏩: 1

lyc In reply to chaos5 [2008-01-08 08:23:55 +0000 UTC]

the spec is quite usable: [link]

πŸ‘: 0 ⏩: 1

chaos5 In reply to lyc [2008-01-08 08:26:14 +0000 UTC]

I may have some issues getting that to work with C# in a .net enviroment...

πŸ‘: 0 ⏩: 1

lyc In reply to chaos5 [2008-01-08 08:28:37 +0000 UTC]

dunno, depends on what compiler you're using. i get the most feature complete versions of visual studio (currently 2008 team suite) via the ms academic alliance, a microsoft/university thing that gets me hooked on their software so i wind up using it in my professional career...

πŸ‘: 0 ⏩: 1

chaos5 In reply to lyc [2008-01-08 08:38:31 +0000 UTC]

I've got C# 2008 express edition, its free.
I also have the C++ one, to compile the code you linked too, but my C++ skills are weak these days. Managed code is so much easier.

BTW word web rocks!!

πŸ‘: 0 ⏩: 1

lyc In reply to chaos5 [2008-01-08 08:49:09 +0000 UTC]

my program is coming along nicely, just need to fix the zooming aa and i can post the first version

πŸ‘: 0 ⏩: 0

chaos5 In reply to lyc [2008-01-08 07:43:37 +0000 UTC]

I was about 75% done at 300s and quit.
I have not scrubbed the new code for speed, and I am only using one thread on a duel core.

As for double precision iterations, that’s not going to affect how deep you can zoom.

This is the hart and sole of my Mandelbrot class.
It is very fast, and as you can see the iterations only limit how many times you want to test a point before giving up. Even at the deepest zooms I seldom have an iteration value of more than a few thousand.

public int testPoint(double x, double y, int iterations)//a+bi
{
double az, bz;
double swapA, swapB;

int i;

az = x;
bz = y;

for (i = 0; i < (iterations); i++)
{
//test modulus
if (((az * az) + (bz * bz)) > 4.0)
{
return i;
}

// z^2 + originalZ
swapA = ((az * az) - (bz * bz)) + x;
swapB = (2 * az * bz) + y;

//swap
az = swapA;
bz = swapB;
}

return i;
}

πŸ‘: 0 ⏩: 2

lyc In reply to chaos5 [2008-01-08 08:26:09 +0000 UTC]

btw, a "hart" is a male deer, and a "sole" is a type of fish!!

wordweb ftw! just control+click on a word and you get the spelling + definition.

πŸ‘: 0 ⏩: 2

chaos5 In reply to lyc [2008-01-08 08:34:01 +0000 UTC]

Heart and Soul!!!

πŸ‘: 0 ⏩: 0

chaos5 In reply to lyc [2008-01-08 08:28:06 +0000 UTC]

ROFL!
I quit life!!!!!!!!!!

πŸ‘: 0 ⏩: 0

lyc In reply to chaos5 [2008-01-08 08:09:09 +0000 UTC]

double precision most definitely affects how far you can zoom, try replacing your scalars with "float" instead of "double" and see how far that gets you!

πŸ‘: 0 ⏩: 2

chaos5 In reply to lyc [2008-01-08 08:21:17 +0000 UTC]

I think we just had a mix up in nomenclature.

πŸ‘: 0 ⏩: 0

chaos5 In reply to lyc [2008-01-08 08:19:42 +0000 UTC]

I agree you won’t get nearly as far with a float as a double. I don’t even bother with floats.

πŸ‘: 0 ⏩: 0

lyc In reply to chaos5 [2008-01-08 06:19:09 +0000 UTC]

thanks it works very nicely indeed with the mandelbrot set.

πŸ‘: 0 ⏩: 0