3D Mandelbulb Ray Tracer
Published on 13 December 2009
There has been quite a stir in recent months with the discovery of the closest approach yet to generating a true 3D version of the Mandelbrot fractal, dubbed the Mandelbulb.
The search for a true 3D Mandelbrot has been sought unsuccessfully for a number of years. However, recently Daniel White, Paul Nylander and many others on FractalForums found that a slightly different approach yielded a true fractal structure in three dimensions; that is the images continue to reveal finer details the closer you look.
If you want to dive right in and give it a go then jump to the project page.
How it works
The fractal calculation follows a similar process as a normal Mandelbrot set using the same formula,
w' = wn + c, but instead of using standard complex numbers w and c are hyper-complex 'triplex' numbers with three components corresponding to the Cartesian x, y, and z co-ordinates.
The triplex number w is raised to a power n using the following terms:
w = {x, y, z}n = rn { sin(θn) cos(φn), sin(θn) sin(φn), cos(θn) }
where:
r = sqrt( x2 + y2 + z2 )
θ = atan2( sqrt( x2 + y2 ), z )
φ = atan2( y, x )
The fractal is ray traced using basically the same process as the 4D Quarternion Julia set fractal; for each pixel a ray is stepped into the scene by a small amount. The x, y and z co-ordinates of the ray at this point provide the input triplex number for the fractal equation, which is then iterated until the magnitude of the triplex number exceeds a bailout value (usually 4.0), or the maximum iteration count is reached.
At the end of the iteration loop a distance estimation function is used to calculate the closest point in any direction to the fractal surface. It is defined as:
distance estimation = 0.5 * |w| * log(|w|) / |δw|
where |w| is the magnitude of the triplex number w and δw is the derivative.
The distance estimation value is crucial to the ray tracing process. It tells us the maximum step distance the ray can move before we need to recalculate the fractal at the new location, which is far more efficient than a fixed step ray marching approach.
When the distance estimation value drops below a defined threshold, epsilon, we are within intersection distance of the approximate fractal surface. If this happens we calculate the vector normal based on the fractal surface gradient, which defines the shading of that point.
Download and usage details
Head over to the project page to download the scripts and learn what each of the parameters can do.
The Juliaberry, juicy and yet somehow quite grotesque!
Last updated: 15 December 2009
31 Comments
Older: 4D Quaternion Julia Set Ray Tracer Newer: The Formula
Links & further reading
- Mandelbulb ray tracer download
- The original forum discussion
- The unravelling of the Real 3D Mandelbulb
Related posts
- Introducing Frax
- The project I've been working on for the last two years...
- A Series of Snowflakes
- A selection of subverted seasonal snowflakes
- L'Eclaireur
- A series of looping animations from an installation at L'Eclaireur in Paris.
- Music Box
- A journey into a Fabergé inspired world.
- More blog posts
thanks for putting all this together!
the results are amazing.
simply wow Tom!
before I die, I need to meet you. Man you inspire me to learn maths :) great work mate
I followed the discussion over at fractalforums for quite a while and i am very impressed that you made a plugin out of it. really good work!
Nice !
I love the screenshots. This is amazing work. And the AO approximation effect works so well, too.
Great work!
a|x
great and amazing job! thanx for sharing! ;-))
Your script and the results achieved are amazing! Congrats on this fantastic work and I hope you continue developing it!
-Rich
Spectacular!
I'm sitting here with my jaw on the desk.. this is the holy grail, I've wanted to play with fractals in 3D since the days of Fractint for DOS.
I've just played with this a bit in pixel bender, and I must be missing something- is it possible to render these out at a larger scale? I just got a computer with a GPU a month ago, I just bought Adobe CS, and this is the first time I've even loaded up Pixel Blender, so I'm entirely clueless. But I am SO digging what I'm seeing so far,
Now, if you can figure out a way to export these things in a 3D mesh... then I can die a happy man.
Hi Tom - I LOVE your work, and really appreciate you sharing your GPU-driven rendering of the Mandelbulb. I'm totally hooked. (I'm glacially rendering animations in UltraFractal too, so I really love the speed of your implementation!) I'd like to see if Quartz Composer can help me animate, but before I download the ~1GB Xcode to play with it, I'm wondering if there's a way to have it export the frames of an animation instead of just a .mov file? Any idea? I render hires fractal videos for planetariums, but for that output I need a sequence of images, not a movie. Thanks!!!
Steve: you can specify the output size, be careful though as it is possible to lock up your GPU if you push it too high, especially with anti-aliasing! Unfortunately it isn't possible to generate a 3D mesh from this implementation of the Mandebulb fractal. A completely different approach to render the shape using something like voxels would be required instead.
Jonathan: The best way to render out QuartzComposer patches is to use this little 3rd party app: Quartz Crystal http://kineme.net/product/QuartzCrystal It has quite a few export options as well as supporting image sequences instead of movies.
"be careful though as it is possible to lock up your GPU if you push it too high, especially with anti-aliasing"
Having same issue when using too 'expensive' shaders. The only solution i've found for now is not to draw a quad on the entire screen but i divide the huge square in little ones and i compute 1 little square by draw loop. It's of course more slow, but the GPU won't lock anymore you use use enough subdivision. (dunno if u understand my bad explanation). (I do it under JOGL not quartz).
Simply the most impressive 3d fractals i've seen.
I don't know if you're into that type of designs,
but would be awesome melted with H.r giger's Aliens designs
Anyway its alrealdy beautiful on its own.
Congrats !
You should really send artworks for the Alien 0 movie they're preparing. Not kidding.
Keep it up, see you !
man, this is awesome! keep up the good work and continue creating miracles.
greets,
the whole amazed e-berlin team
Really amazing! congratulations
Hi, this is really inspiring and amazing the way you do it. I have been using the Simple Attractor Renderer to do some Stop Motion animations while changing the Formulas, But the 3d and 4d ones you have done are much better. How do you do that? Congratulations
hi there!
i did some mandelbulb animations which i like to share with you:
http://www.vimeo.com/11548449
http://www.vimeo.com/11103473
best regards
oppenheimer
That's fantastic! Never saw something like this in my life! I'm looking carefully to each detail and find it unique! More than well done :)
It's Amazing. Another great work of art. Thanks for sharing!
Awesome pics. That is amazing. I can't wait to see where we are with 3-D in a few years from now. I remember watching Jaws in 3-D way back in the day. I always wondered why this technology got abandoned. I was very impressed as a kid watching Jaws leaping out of the screen at me.
Really amazing. Congrats on this fantastic work and I hope you continue developing it!
Its incredible. A fine work of art. The 3d looks amazing. It has a fine details. I love it.
That's amazing. I didn't know you could do that with fractals. Turn it into an oil painting and you could hang it in a museum-it's that good.
Hi there!
The blog is absolutely fantastic. Lots of great information and inspiration, both of which we all need. Thanks.
Amazing pieces of art! Thanks for sharing
Wow, I stumbledupon this page. I'm not sure I really understand, but I must say that the fractals are some of the coolest pictures that i've seen! Thanks Tom.
I still remember when about 20-25 years ago, I programmed my first fractals, with Turbo Pascal 7. What a great programming language it was and the fractals were really something. It was also quite easy to modify formulas by being creative and getting whole new classes of great shapes. And there was great book, by James Gleick: Chaos, which by the way also wrote a great biography of Feynman. Anyhow, images look really great. And I wonder if one can find something similar in nature, on coral reefs.
I am just starting to really explore your site. You have combined mathematics and artist ability to a wonderful flower for the eye.
Hi there from germany. I don't get any of the fractual calculations, but the pictures and shapes are beautiful. Looks like nature fotography rather than the result of calculations. I love scuba diving and photography and the shape of this mandelbrot is very similar to some corals on the reef. Amazing! Also the other pictures are beautiful. Thanks for sharing them.
Hi Tom - I LOVE your work, and really appreciate you sharing your GPU-driven rendering of the Mandelbulb. I'm totally hooked. (I'm glacially 640-553 test rendering animations in UltraFractal too, so I really love the speed of your implementation!) I'd like to see 350-018 test if Quartz Composer can help me animate, but before I download the ~1GB Xcode to play with it, I'm wondering if there's a way to have it export the frames of an animation instead of just a .mov file? Any idea? I render CISSP test hires fractal videos for planetariums, but for that output I need a sequence of images, not a movie. Thanks!!!