Page 1 of 1

More fun with fractals...

Posted: Wed Feb 20, 2013 10:20 pm
by just brew it!
As you may already be aware if you follow the DYMT:R thread, I've been playing around with fractals again.

The latest geeky diversion is figuring out how to create animated fractal zoom videos. You can check out the first attempt here: http://youtu.be/ceeW4nIw0D4

It's a 90-second "deep zoom" (12 orders of magnitude) into the Mandelbrot set at (-7.540838721493303e-01 + 4.981851110224700e-02i). To give some sense of scale, this is roughly equivalent (plus or minus an order of magnitude) to magnifying an individual atom to the size of your screen.

The video is rather low-res (only 480p), and has some aliasing/noise effects and video compression artifacts (grumble, grumble), but I think it shows promise.

Everything was done using home grown fractal rendering software (written in Python and C), and Open Source video encoding tools, running on Ubuntu Linux.

I may need to re-purpose some spare PC hardware into a fractal rendering farm so I can do this stuff in high-def. I've got a couple of Phenom II 1090Ts and an X4 980 that I could press into service; with my main desktop's FX-8320 in the mix that's 24 reasonably capable cores I should be able to throw at this. I think that should get the render times down to something tolerable. :wink:

So... any other math/fractal/graphics geeks out there who are into this stuff?

Re: More fun with fractals...

Posted: Wed Feb 20, 2013 11:26 pm
by anotherengineer
I think you should draw an isometric drawing of a fractal in 2D autocad ;)

Re: More fun with fractals...

Posted: Thu Feb 21, 2013 12:18 am
by yogibbear
Needs more wub wub.

Re: More fun with fractals...

Posted: Thu Feb 21, 2013 12:31 am
by JohnC
yogibbear wrote:
Needs more wub wub.

http://www.youtube.com/watch?v=GvqKnCdB_D4&sns=em ?

Re: More fun with fractals...

Posted: Thu Feb 21, 2013 12:42 am
by sschaem
check this site. lots of fractal experiments.

http://glsl.heroku.com/e#6480.7

http://glsl.heroku.com/e#6550.0

Re: More fun with fractals...

Posted: Thu Feb 21, 2013 6:03 am
by AMM
Any chance of github-ing your code?

Re: More fun with fractals...

Posted: Thu Feb 21, 2013 6:46 am
by Chrispy_
Ah, fractals....

I must have wasted hours in the early days of WinFRACT, when I first upraded to a video card that could handle 24-bit colour.

Re: More fun with fractals...

Posted: Thu Feb 21, 2013 9:56 am
by just brew it!
AMM wrote:
Any chance of github-ing your code?

The plan is to release the code publicly in the near future. It's currently rather hack-ish; as I'm playing around with it I'm cleaning it up, documenting it, and fixing a few mis-features.

Re: More fun with fractals...

Posted: Fri Feb 22, 2013 1:41 am
by just brew it!

Re: More fun with fractals...

Posted: Fri Feb 22, 2013 7:10 pm
by just brew it!
Here's one rendered at higher resolution (full 720p): http://youtu.be/4G1n2YmAVJY

Last night I figured out how to re-use data from one frame to drastically speed up rendering of the next. This makes rendering the fractal videos at higher resolutions practical, even on a run-of-the-mill desktop system. It still isn't exactly fast, but it "only" takes hours or days (instead of days or weeks). :lol:

The dirty details: Black areas of the image (points in the interior of the Mandelbrot set) are expensive to compute, especially at high zooms; this is because you need to iterate all the way up to the limit to determine whether a point is a member of the set, and the limit must be increased to insanely high values (half a million or so) as the zoom level rises to maintain image quality and avoid spurious "black holes". The trick is that when rendering a series of frames for a smooth zoom, successive images are very similar to each other. So you can use pixel data from the previous frame to decide which pixels of the new frame can't possibly lie outside the set, and skip the calculation for those points (just color them black without bothering to iterate).

I also want to come up with methods for scripting more complicated zoom/pan movements, to create virtual tours around the set instead of simple deep zooms into a single point.

Re: More fun with fractals...

Posted: Sun Feb 24, 2013 6:58 pm
by ludi
just brew it! wrote:
Here's one rendered at higher resolution (full 720p): http://youtu.be/4G1n2YmAVJY

Whoa. Not only was that impressive, but after the video ended, I got a reverse-motion illusion (all the elements of the YouTube page layout were continuously receding) for several seconds afterward.

Re: More fun with fractals...

Posted: Sun Feb 24, 2013 8:32 pm
by just brew it!
ludi wrote:
Whoa. Not only was that impressive, but after the video ended, I got a reverse-motion illusion (all the elements of the YouTube page layout were continuously receding) for several seconds afterward.

The zoom rate is a bit higher on that one (same total zoom, but over a 60 second period instead of 90). I think this may accentuate the motion illusion effect.

Here's one more at 720p: http://youtu.be/t5jXTjQ4Nrg

Re: More fun with fractals...

Posted: Sun Feb 24, 2013 11:16 pm
by FireGryphon
just brew it! wrote:
ludi wrote:
Whoa. Not only was that impressive, but after the video ended, I got a reverse-motion illusion (all the elements of the YouTube page layout were continuously receding) for several seconds afterward.

The zoom rate is a bit higher on that one (same total zoom, but over a 60 second period instead of 90). I think this may accentuate the motion illusion effect.


Same thing just happened to me. Cool.

JBI, looking forward to your final documented code. Nice work on the videos so far.

Re: More fun with fractals...

Posted: Wed Feb 27, 2013 11:25 pm
by just brew it!
http://youtu.be/8An2NoEw-2M (Make sure your player is set to 720p HD for best clarity, assuming your connection has sufficient bandwidth!)

Another "straight zoom" vid. I'd really like to work on the more elaborately scripted "fractal tour" stuff (and maybe even create some original music to accompany them), but don't see myself having time until mid-March. For now, this sort of thing will have to do, since the code's already written, and I can just set up a destination point and let it render overnight.

This one is a zoom into the "double spiral" (left) side of the valley between the main cardioid and the largest circular feature of the Mandelbrot set, at coordinates 7.534266571159055e-01, 5.181353020385396e-02i.

A nice illustration of "feature doubling" as we zoom in to a "mini-brot" at a magnification of 2e+12. Watch as the number of arms coming out of the vortex we're zooming into starts at 2 around the 0:57 mark, and repeatedly doubles at 1:12, 1:20, 1:26, and 1:28 (additional doublings, to 64 and 128 arms are also visible at the final magnification).

Re: More fun with fractals...

Posted: Thu Feb 28, 2013 8:58 am
by liquidsquid
Seems like an excellent opportunity to see if you can take advantage of CUDA or some other type of GPU accelerator. Use it for benchmarks...

Re: More fun with fractals...

Posted: Thu Feb 28, 2013 10:11 am
by just brew it!
liquidsquid wrote:
Seems like an excellent opportunity to see if you can take advantage of CUDA or some other type of GPU accelerator. Use it for benchmarks...

Indeed. I've been thinking of taking the code and porting it to CUDA or OpenCL. Been wanting to learn how to do GPU computing.

Re: More fun with fractals...

Posted: Sat Mar 02, 2013 11:10 am
by AMM
It should be highly parallelizable right? Is your current implementation threaded?

Re: More fun with fractals...

Posted: Sat Mar 02, 2013 12:23 pm
by chuckula
just brew it! wrote:
http://youtu.be/8An2NoEw-2M (Make sure your player is set to 720p HD for best clarity, assuming your connection has sufficient bandwidth!)

Another "straight zoom" vid. I'd really like to work on the more elaborately scripted "fractal tour" stuff (and maybe even create some original music to accompany them), but don't see myself having time until mid-March. For now, this sort of thing will have to do, since the code's already written, and I can just set up a destination point and let it render overnight.

This one is a zoom into the "double spiral" (left) side of the valley between the main cardioid and the largest circular feature of the Mandelbrot set, at coordinates 7.534266571159055e-01, 5.181353020385396e-02i.

A nice illustration of "feature doubling" as we zoom in to a "mini-brot" at a magnification of 2e+12. Watch as the number of arms coming out of the vortex we're zooming into starts at 2 around the 0:57 mark, and repeatedly doubles at 1:12, 1:20, 1:26, and 1:28 (additional doublings, to 64 and 128 arms are also visible at the final magnification).


Beautiful! I'm always a sucker for fractals. Is your code generic enough to handle different sets like the Julia & Fatou sets without too much trouble?

Re: More fun with fractals...

Posted: Sat Mar 02, 2013 12:47 pm
by just brew it!
AMM wrote:
It should be highly parallelizable right? Is your current implementation threaded?

Yes! Automatically uses as many cores as you've got (up to 32, IIRC). Chunks up the image being rendered into 50x50 pixel blocks, and hands those off to worker threads running on each core. Tested it on a 12-core server at work and it scales very well.

chuckula wrote:
Beautiful! I'm always a sucker for fractals. Is your code generic enough to handle different sets like the Julia & Fatou sets without too much trouble?

Yup. The interactive version of it allows you to click on a point in the Mandelbrot set and displays the corresponding Julia set in a second window. After next weekend I will have more time to work on the code again; want to do some Julia set morphing videos (animation of how the Julia set changes as the associated point in Mandelbrot-space moves).

Also need to do some regression testing to make sure the Windows version still works before releasing the code "into the wild", since all of my recent futzing around has been done under Linux.

Re: More fun with fractals...

Posted: Sat Mar 02, 2013 1:37 pm
by Dposcorp
just brew it! wrote:

That was very cool. Thanks

Re: More fun with fractals...

Posted: Sat Mar 02, 2013 1:58 pm
by sschaem
If you want to experiment with the GPU check the link I posted, dozen of ready to go samples. Including exotic 3d fractal experiments
http://glsl.heroku.com/e#7074.0

You can also use www.shadertoy.com to do real time GPS programming

Just don't try any of this on an intel apu.... :)

Re: More fun with fractals...

Posted: Sat Mar 02, 2013 2:22 pm
by just brew it!
sschaem wrote:
Just don't try any of this on an intel apu.... :)

Well, it's not like I tend to run bleeding edge GPUs (since I don't game). So although I've got a couple of reasonably recent discrete GPUs (one each ATI and nVidia) at my disposal, they are quite low-end.

Re: More fun with fractals...

Posted: Mon Mar 04, 2013 9:25 am
by Arvald
Wow... oldschool :-)
I have not done Fractal work since a coop I did 20 years ago (the PC they gave me was not up to handling them rendering at a decent rate).
I worked with Mandelbrot and Julia sets at the time.