POV-Ray : Newsgroups : povray.advanced-users : Fractal isosurface : Fractal isosurface Server Time
28 Jul 2024 18:14:25 EDT (-0400)
  Fractal isosurface  
From: Andrew C on Mozilla
Date: 20 Jun 2004 06:02:42
Message: <40d560c2$1@news.povray.org>
Hey folks...

I just made an isosurface in the shape of the quadratic Mandelbrot set. :-D

...but I did it the hard way! :-/

Due to the slightly bizzare way POV-Ray's macro feature works, you can 
actaully write this:

-----

#macro Cr() x #end
#macro Ci() y #end

#macro Zr(Iter)
   #if (Iter=0)
     Cr()
   #else
     ( Zr(Iter-1) * Zr(Iter-1) - Zi(Iter-1) * Zi(Iter-1) + Cr() )
   #end
#end

#macro Zi(Iter)
   #if (Iter=0)
     Ci()
   #else
     ( 2 * Zr(Iter-1) * Zi(Iter-1) + Ci() )
   #end
#end

#declare MaxIter = 1;

#declare Fn =
function {Zr(MaxIter) * Zr(MaxIter) + Zi(MaxIter) * Zr(MaxIter)}

-----

...which is actually equivilent to

#declare Fn =
function { ( x*x - y*y + x)*(x*x - y*y + x) + (2*x*y + y)*(2*x*y + y) }

Nothing exciting there. However, replace MaxIter=1 with MaxIter=2 and 
you get a more complicated expression... an expression too complicated 
for me to write out here. But it's the expression for 2 iterations of 
the complex quadratic map Z := Z^2 + C (in case that wasn't already 
obviouse.)

The above fails when MaxIter=10 (but works for 9). Actually, you can 
drastically speed up the parsing *and* rendering by using pow(..., 2) to 
do the squaring. (I don't know how high you can go then - but easily 
high enough for the resulting function to render indescribably slowly.)

You know how POV-Ray tells you the max gradient of an isosurface when it 
finishes? Well, I ran POV-Ray for (I think) MaxIter=5. The reported max 
gradient went into about 16 figures. (!!)

I seem to have fixed this by using min() and max() to limit Zr and Zi to 
+/-4. This has no effect on the part of the image that POV-Ray is 
actually trying to draw, but does prevent POV-Ray struggling to do 
computations with enoumouse numbers. It also results in a drastically 
smaller max gradient being reported.

(Actually, for MaxIter=5, POV-Ray says the max gradient should be 2,000. 
This is unspeakably slow to render. However, rendering with 50 seems to 
work just fine. Unless I'm very much mistaken, the max gradient near 
where the actual surfaces are is much less; the function only changes 
this rapidly round the edges, where the orbits have "escaped" to infinity.)

BTW, with the pow() speedup and the magnitude limiting, a 640x480 image 
with no AA is currently rendering at about 350 pixels/sec on my AMD 1.4 
GHz laptop. (...at least I *think* it's 1.4 GHz... might be lower... but 
definitely over 1 Ghz.)

..."and WHY are you doing this?" I hear you cry.

Well, firstly I want to make a Mandelbrot hight field isosurface-style. 
(*NO TRIANGLES*!) I can also do a similar thing with julibrot slices. 
(See FractInt if you don't know what I'm talking about...)

But secondly, and more importantly, I want to do the same trick to 
render 3D slices of the (4-dimensional) cubic Mandelbrot set(s). That 
is, the Mandelbrot set(s) of the mapping

   Z := Z^3 - 3(A^2)Z + B

I've always wanted to know what it would look like... (Well, actually 
I've *seen* it in a book, and it looks cool!)

Will post if I come up with any particularly interesting images.

Andrew @ home.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.