Tuesday, 17 November 2009

Mandelbulb - First Thoughts

In light of Harry's comment I thought I'd take a look at trying to code a Mandelbulb set.

The first obstacle was how to render:

The examples I've seen mainly use ray tracing - there is no way as3 is capable of raytracing this kind of complexity within my lifetime. I decided to write a simple voxel (3D pixel) engine to display the set. The theory behind this is fairly simple. Work in isometry (no perspective), render from left to right, bottom to top and front to back and all should work out.

Just so I knew the kinds of things I was looking for here are a few of Daniel Whites original renders of the Mandelbulb.

So quite something to aim for with flash!

Anyway, I thought I'd start BIG, and by BIG I probably mean I regret doing it now because of the insane render time. Poor flash player.

As I write this the whole render (1000x1000x1000 - 1 million voxels - 1 mega voxel!) is about 2 percent complete. I don't know whether what I am rendering is the right thing or not but hopefully as more shapes begin to unveil themselves it will become clear and I'll know whether to start again or not!

Here are a few renders using the Voxel Engine:

The first few cross-sections - some potential? We'll see..

About 10 cross-sections down - only 990 to go! There are some interesting shapes going on though - note this is a zoom. You can see the individual voxels and how I build them up quite nicely. There does seem to be an awfully regular plane forming which shouldn't be there.

Yet more complete - starting to get some nice inwards curving - hopefully it will make a shape thats kind of spherical...

Just a bit more - about an hour down and the stage I go to bed at! I'll take another look in the morning - until then good night!

Below is what I found the next morning: Not exactly what I was looking for - fractal? possibly - but not nearly as complex as the Mandelbrot I should have been getting.

Unfortunately this means I'll have to change the settings and start over: at least I know the Voxel Engine works, and that I shouldn't do quite as ambitious renders! I'll keep you updated on the results!

1 comment:

  1. I must say I did not think you would react that quickly. That is impressive!