Logo by Maya - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. March 19, 2024, 05:30:01 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1] 2   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Implementation: 3D mandelbrot type fractal  (Read 64397 times)
0 Members and 1 Guest are viewing this topic.
steamraven
Guest
« on: November 18, 2009, 07:36:00 PM »

Hey I am a fractal newbie, but I found the http://www.skytopia.com/project/fractal/mandelbulb.html and I love it!

As an exercise in programming (and possible stupidity) I would like to write my own renderer (in OpenCL).  I took a look at David Makin's Distance Estimator and I understand most of it except the test " if binary search count>=max binary depth".

It seems "binary search count" is only set to 0 or 1.  Does this get incremented elsewhere? Can I get some clarification?

I also am using for smooth iteration value the equation on http://linas.org/art-gallery/escape/escape.html

mu =  n + 1 - log (log  |Z(n)|) / log 2

where n is iteration at escape from radius and |Z(n)| is the last value.  (obviously for the power 8 I would use log 8 instead of log 2)

Is this right?

Thanks in advance
« Last Edit: November 20, 2009, 06:18:48 PM by steamraven, Reason: Add link to david\'s DE » Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #1 on: November 18, 2009, 09:14:27 PM »

the binary search is for finding the exact point where the solid or inner part of the object begins
so to say, it is the exact border, the binary search used here is related to the newtonian root finding method:
you start with a point outside, and going to wards the inside until you hit an inside point, after that you know that
the border lies between the last and the current one, then you start your binary search for finding the exact position
for that border smiley
Logged

---

divide and conquer - iterate and rule - chaos is No random!
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #2 on: November 18, 2009, 10:45:29 PM »

Hey I am a fractal newbie, but I found the http://www.skytopia.com/project/fractal/mandelbulb.html and I love it!

As an exercise in programming (and possible stupidity) I would like to write my own renderer (in OpenCL).  I took a look at David Makin's Distance Estimator and I understand most of it except the test " if binary search count>=max binary depth".

It seems "binary search count" is only set to 0 or 1.  Does this get incremented elsewhere? Can I get some clarification?

I also am using for smooth iteration value the equation on http://linas.org/art-gallery/escape/escape.html

mu =  n + 1 - log (log  |Z(n)|) / log 2

where n is iteration at escape from radius and |Z(n)| is the last value.  (obviously for the power 8 I would use log 8 instead of log 2)

Is this right?

Thanks in advance

Apologies if I missed it, but yes the binary search count should be incremented at each binary step and the search should continue either for a preset maximum number of steps or until the new step distance is less than a given min search value or until the difference between the estimate and the threshold is less then a given min search value.

A better version of the smooth iteration calculation is:

mu = n + (log(0.5*log(@bailout)) - log(0.5*log(|final z|)))/log(divergence)

where |z| is actually the square of the magnitude and @bailout is the bailout value this is tested against - we avoid using sqrt by testing the square and avoid using the square root in the smooth iteration calculation by using 0.5*log().
Whether or not a +1 is required in the above for a positive mu depends on how the iteration count is implimented in the formula but for mu to always be positive then n should be at least 1  i.e. bailout on the first iteration should have a count of 1 - this is irrelevant for the delta DE however since the +1's from the two positions on the ray would simply cancel out i.e. for that as far as the n's are concerned it's only their relative value that matters.
For z^2+c in the above divergence would be 2 and in fact if using a fixed constant for divergence then the log(0.5*log(@bailout)) term is irrelevant for the delta DE calculation.

The above method however has small errors at iteration boundaries specifically due to the fact that we're bailing out before the magnitude reaches infinity. In 2D these errors only really show in formulas with non-integer divergence and more especially in formulas where the divergence actually varies across the fractal however the delta DE method is more sensitive to the errors.
Using the actual divergence at bailout corrects the errors i.e. instead of using a preset constant for the divergence we instead use:

divergence = log(|final z|)/log(|penultimate z|)

where penultimate z is the value from the iteration prior to the bailout iteration - usually called zold in complex formulas, note again that |value| here is used as the square of the magnitude to avoid the square root calculation. if using the variable divergence then the log(0.5*log(@bailout)) term must be included in the calculation of the values of mu.

« Last Edit: November 18, 2009, 11:41:05 PM by David Makin » Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
lycium
Fractal Supremo
*****
Posts: 1158



WWW
« Reply #3 on: November 20, 2009, 12:21:59 AM »

i have found the binary search to add more noise, since even with just 8 iterations the surface is extremely convoluted, perhaps to the limit of single precision floating point. for more than 8 iterations and/or using binary search, i'd say double precision is an absolute must.

the other thing is that instead of using constant steps + binary search, it is perhaps more prudent to use unbounding spheres to ray march - this is probably far more numerically stable.
Logged

David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #4 on: November 20, 2009, 12:38:30 AM »

i have found the binary search to add more noise, since even with just 8 iterations the surface is extremely convoluted, perhaps to the limit of single precision floating point. for more than 8 iterations and/or using binary search, i'd say double precision is an absolute must.

You are correct regarding the binary search if you are going as close to the "inside" as your resolution allows but if you want to render with less detail (i.e. a greater distance estimation threshold) then neglecting to use the binary search (or a weighted search) results in visible "stepping" on the image.

Edit: I just went to render an example with and without binary search and discovered to my surprise that the latest version of my own code has almost removed the issue. The problem occurs really noticeably when you use the actual adjacent solid coordinates for computing the normals but in the latest version of my own formula I instead use the DE values from the same distance from the viewpoint as the found pixel on the rays adjacent to the found pixel (i.e. without tracing to the true solid on the adjacent rays) and using this method only has minor stepping even wth a solid threshold as high as 0.1 (note that because I'm using UF I actually get the DE values for the points on the adjacent rays for the rays at the ideal 0.5 pixels offset from the central ray whereas in other implimentations it would probably be more efficient to use the rays at a whole pixel offset).
« Last Edit: November 20, 2009, 01:40:20 AM by David Makin » Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
steamraven
Guest
« Reply #5 on: November 20, 2009, 06:05:18 PM »

Thank you guys for you replies.  Things are starting to make more sense.

Also, what are people using to calculate normals? 

Thanks,
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #6 on: November 20, 2009, 06:10:58 PM »

Thank you guys for you replies.  Things are starting to make more sense.

Also, what are people using to calculate normals? 

Thanks,

See this thread:

http://www.fractalforums.com/mandelbulb-implementation/calculating-normals/msg8791/#msg8791
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
steamraven
Guest
« Reply #7 on: November 24, 2009, 06:22:11 AM »

I need another set of eyes.  I am trying to implement bugman's expansion of the power of 8, but its not working.  Here is my code:

Code:
   

float4 pos;  // the point being iterated
float4 value = (float4) 0.0f;

for (i = 0; i < max_i; i++)
    {
        #ifdef EXPANSION
            float x2 = value.x * value.x;
            float y2 = value.y * value.y;
            float z2 = value.z * value.z;
            float z4 = z2 * z2;
            
            float r2 = x2+y2;
            float r4 = r2*r2;
            

            float z = 8.0f*value.z*sqrt(r2) * (z2 - r2) * (z4 - 6.0f*z2*r2 + r4);                
            float a = 1.0f + (z4*z4 - 28.0f*z4*z2*r2 +70.0f*z4*r4 -28.0f*z2*r4*r2) / (r4*r4);
            
            // z2, z4, r2, and r4 are not used anymore
            
            float x4 = x2 * x2;
            float y4 = y2 * y2;
            float x6 = x2 * x4;
            float y6 = y2 * y4;
                        
            value = (float4)(
                a * (  x4*x4 - 28.0f*x6*y2 + 70.0f*x4*y4 -28.0f*x2*y6 + y4*y4),
                8.0f*a*value.x*value.y*( x6 - 7.0f*x4*y2 + 7.0f*x2*y4 - y6),
                z,
                0.0f);
                    
            
        #else
            float r = length(value);
            float theta = atan2(sqrt(value.x * value.x+ value.y * value.y), value.z);
            float phi = atan2(value.y,value.x);
        
            value = pown(r, 8) * (float4)(
                                        sin(theta * 8.0f) * cos(phi * 8.0f),
                                        sin(theta * 8.0f) * sin(phi * 8.0f),
                                        cos(theta * 8.0f), 0.0
                                 );
        #endif
        value += pos;

        prev_length2 = length2;        
        length2 = dot(value, value);
        if (length2 > escape2)
            break;
}

If I define "expansion" it uses the expanded polynomial, but incorrect results.  Without "expansion", it uses the trig and it works.  Any ideas?

Note: This is opencl, which is basically c with vectors.
« Last Edit: November 24, 2009, 05:30:35 PM by steamraven » Logged
ddrcoder
Forums Newbie
*
Posts: 1


« Reply #8 on: December 04, 2009, 09:11:25 AM »

So, a quick preview (I'll post more later this week). I've taken Jan Vlietinck's awesome work on the DX11 Quaternion Julia renderer and I've adapted it for the Mandelbulb. I've got some pretty damn cool results, if I do say so myself, and with pretty amazing performance. I can now render a 1280x720 Mandelbulb in 14 milliseconds. smiley

It's a little rough around the edges (literally), as I'm still tweaking the distance estimator, but I think it's a good start.

Logged
Snakehand
Guest
« Reply #9 on: December 09, 2009, 01:19:46 AM »

I have been fiddling with a Brook+ raytracer. It is late now, and I just got some decente renderings, and thought I would post one before I head to bed:



Done in "a fraction of second" on a ATI Radeon 5850 card.


Logged
KRAFTWERK
Global Moderator
Fractal Senior
******
Posts: 1439


Virtual Surreality


WWW
« Reply #10 on: March 10, 2010, 02:37:55 PM »

I have been fiddling with a Brook+ raytracer. It is late now, and I just got some decente renderings, and thought I would post one before I head to bed:

<Quoted Image Removed>

Done in "a fraction of second" on a ATI Radeon 5850 card.

Sorry to awake an old post, just curious wich formula you used on this render Snakehand.

It is seems to be the "assymmetric" bulb I am looking for...
(Different top/bottom)

Johan
Logged

fracmonk
Fractal Fertilizer
*****
Posts: 356


« Reply #11 on: May 30, 2010, 04:29:41 AM »

Hi and sorry if I'm interrupting a specific project here.  This is something different.  I've been having a dialogue principally with Jehovajah in "...search for the holy grail continues..." section, and am convinced there is an implementation problem for one approach to M in extended Dims.  I'd love to get more to look at the ideas I'm trying to communicate there. Taken together, the messages I left are enough to duplicate my 2-d results and judge whether a 3-d generator for it exists or can be written easily.  My comments begin on page 12 and continue to the present.  Would love to show some pix, make a paper available, and provide my formula files for this in FractInt.  Someone please advise.
Logged
KRAFTWERK
Global Moderator
Fractal Senior
******
Posts: 1439


Virtual Surreality


WWW
« Reply #12 on: May 31, 2010, 10:42:08 AM »

No worry fracmonc, I have found what I was looking for!
Logged

fracmonk
Fractal Fertilizer
*****
Posts: 356


« Reply #13 on: May 31, 2010, 03:43:56 PM »

K- Went to your deviantart site- very outstanding pix!  I take it most are higher exp M generalizations using mandelbulb or a variation on that.  Beautiful structures, and I see in some of them, say, suggestions of similar shapes, in the 2-d details of the 2-power I've been looking at.  I'm kinda crawling before I can walk here, with a back-to-basics approach.  I'm more interested in the basic math for an extension from the complex plane w.o. sacrificing ANY field properties in the process and believe I have found such!  While mandelbulb-type renderings are dazzling and impressive, the math does not seem very straightforward or understandable, at least to me, and while they are a sophisticated expression, they are more a product of what I call M-gymnastics than anything else.  I've done many 2-d formulae that would do things like double M bugs, lambdas, tip-to-tips, M-in a circle (what is normally found on Re axis, only mapped to unit circle), etc.  That's what I mean by M-gymnastics...anyway, mandelbulb strikes me as more of that, only in 3-d!  I'm interested in a straight and simple, meaningful extension of M into more than 2-d on a more basic and fundamental level.  Have you read the dialogue I spoke of?
Logged
KRAFTWERK
Global Moderator
Fractal Senior
******
Posts: 1439


Virtual Surreality


WWW
« Reply #14 on: May 31, 2010, 04:40:31 PM »

Thank you fracmonk!

I am a keen follower of your (and jehovajah:s) thread, sadly my math skills is some levels lower than yours.  afro
Has anyone implemented your new formulas to a good renderer? I would love to play around with them.

I like the beauty/fractality of these mandelbulbs, but if anyone finds the holy grail of the 3D M-set (you might be there you think?), I will be there rendering them wink
and yes my images are mostly of the power 8 White/Nylander type. (-sin, sin and cos variations).

J
Logged

Pages: [1] 2   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
True 3D mandelbrot type fractal 3D Fractal Generation « 1 2 ... 36 37 » twinbee 549 601560 Last post November 19, 2009, 11:56:16 PM
by cKleinhuis
Re: True 3D mandelbrot type fractal Other / General Discussion shanest 2 26247 Last post November 20, 2009, 03:24:26 AM
by fractalrebel
New fractal type... latest 3d type.. a z^2 for Benoit Images Showcase (Rate My Fractal) M Benesi 0 7430 Last post October 21, 2010, 07:14:00 AM
by M Benesi
Another (?) 3D mandelbrot type Theory Tater 0 2549 Last post January 28, 2013, 10:47:15 PM
by Tater
New type of 3D Mandelbrot never before seen?? 3D Fractal Generation realflow100 10 7060 Last post May 29, 2017, 01:52:09 AM
by SamTiba

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.233 seconds with 24 queries. (Pretty URLs adds 0.014s, 2q)