Logo by Mahmut - 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: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. March 29, 2024, 12:29:50 PM


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 3   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: A Mandelbox distance estimate formula  (Read 79515 times)
0 Members and 4 Guests are viewing this topic.
JosLeys
Strange Attractor
***
Posts: 258


WWW
« on: March 23, 2010, 12:45:39 AM »

I found that the following very simple formula works quite well;
DE=1/(1+exp(s-4)) ,
where s is the smooth iteration value s=iters+1- log(log(R)/log(@bailout))/log(@pow).
The picture below was made using that formula (in UF)


* Mandelbox001.jpg (178.23 KB, 640x640 - viewed 3353 times.)
Logged
reesej2
Guest
« Reply #1 on: March 23, 2010, 12:56:10 AM »

Very nice. This is for scale = 2, yes? Does it work equally well for other scales?
Logged
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #2 on: March 23, 2010, 01:14:43 AM »

Yes it was scale 2. Here is scale 2.5.
(Scales lower than 2 appear to be more difficult.)


* Mandelbox006.jpg (151.86 KB, 640x640 - viewed 3697 times.)
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #3 on: March 28, 2010, 04:17:17 AM »

Hi all, Jos sent me a copy of his method (as posted here) and I immediately asked him if it would work on Mandelbulbs etc. as well and I decided to play around to see if I could get something similar that would do so -  though I've still yet to try Jos's method on the Mandelbox properly.

The difference between implimenting these methods and the DE methods (analytical and delta) is that only a single normal iteration loop is required i.e. we don't have to iterate twice nor do we need to calculate the derivative.
The difference in the results is that these methods produce a solid where the solid isosurface is the isosurface of a given potential rather than a given distance from "inside" which means that these methods tend to have a greater variance in detail levels in the resulting renders - specifically the "busier" areas are more detailed and the less busy areas less detailed than is the case using the DE methods.
This is good because it gives us an alternative view that matches what you get if you just do "solid on given iteration".

Anyway I played around and found an adapted version of Jos' method that works for Mandelbulbs, quaternions etc., here it is:

Iterate the formula normally
Calculate the smooth iteration value
If Mandelbrot subtract 2 from the smooth iteration value, if Julia subtract 1 from it.
calculate distance value = 1.0/(adjust + divergence^smooth iteration)
test the distance value against your minimum threshold value (could be calculated directly for solid on a given iteration value)
if not hit solid then step forwrd by distance value*0.1/accuracy

Where: adjust is a user parameter (usual values 0 or 1, larger values for fractals of very high divergence), divergence is either a user parameter giving the estimated divergence of the fractal (e.g. 8 for z^8+c) or a calculated value based on the last two values of z from iteration and accuracy is a user parameter (normally 1, larger values for increased accuracy, smaller for faster less accurate renders).

Note that the 0.1 in "distance value*0.1/accuracy" is required because the behaviour of the raw smooth iteration contours is such that the calculation above for the distance value is often overestimated by up to 10 times (sometimes more but that's allowed for by allowing the accuracy parameter).

Unfortunately the method as I've outlined above doesn't work on the Mandelbox or my escape-time IFS formula, nor have I been able to get Jos' method to work for the Mandelbox - I can't seem to work out the correct parameters in a/(b+c*exp(sm-d)) !

As to timings, for the degree 8 Mandelbulb (and other similar style fractals) the method renders in times comparable to using the analytical distance estimator but is slower on simpler formulas such as quaternions, bicomplex and the various formulas based on the unit vector multiplication tables.
This is because the iteration part is faster because it's only done once or doesn't have the extra derivative calculation but the stepping is slower because the step sizes are not as accurate as the other methods.
Ignoring the visual differences in the results it's best to use the DE methods for simpler fractal formulas and this method for the more complex ones.

I hope to find a way to satisfactarily apply the method to the Mandelbox and escape-time IFS formulas tomorrow.....
Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #4 on: March 28, 2010, 06:12:20 PM »

Hi

I found some interesting method for calculating Mandelbox distance estimate. It is very simple method based on calculation resultant multiplication of input values. Below is my algorithm (there are marked additional lines in code):

inside iteration loop:

DEfactor = scale;

fixedRadius = 1.0;
fR2 = fixedRadius * fixedRadius;
minRadius = 0.5;
mR2 = minRadius * minRadius;

if (x > 1.0)
x = 2.0 - x;
else if (x < -1.0) x = -2.0 - x;
if (y > 1.0)
y = 2.0 - y;
else if (y < -1.0) y = -2.0 - y;
if (z > 1.0)
z = 2.0 - z;
else if (z < -1.0) z = -2.0 - z;

r2 = x*x + y*y + z*z;

if (r2 < mR2)
{
   x = x * fR2 / mR2;
   y = y * fR2 / mR2;
   z = z * fR2 / mR2;
   DEfactor = DEfactor * fR2 / mR2;
}
else if (r2 < fR2)
{
   x = x * fR2 / r2;
   y = y * fR2 / r2;
   z = z * fR2 / r2;
   DEfactor *= fR2 / r2;
}

x = x * scale + cx;
y = y * scale + cy;
z = z * scale + cz;
DEfactor *= scale;

resultant estimated distance (after iteration loop):

distance = sqrt(x*x+y*y+z*z)/abs(DEfactor);

Results are very good. Distance is very accurate for all scale values and it doesn't need to much additional calculations.


* image00043.jpg (199.2 KB, 800x800 - viewed 3135 times.)
Logged

fractalrebel
Fractal Lover
**
Posts: 211



WWW
« Reply #5 on: March 29, 2010, 12:57:20 AM »

Here is scale = 3 in UF using my Delta DE method:



* AmazingFractal_Mandelbrot.jpg (148.75 KB, 800x800 - viewed 3140 times.)
Logged

fractalrebel
Fractal Lover
**
Posts: 211



WWW
« Reply #6 on: March 29, 2010, 01:23:27 AM »

Here is scale = 1.5. Its a little weird looking.



* MandelboxScale_1.5.jpg (152.75 KB, 800x800 - viewed 3009 times.)
Logged

Timeroot
Fractal Fertilizer
*****
Posts: 362


The pwnge.


WWW
« Reply #7 on: March 29, 2010, 02:41:57 AM »

Here is scale = 1.5. Its a little weird looking.
Looks like something is wrong. No matter what the scale value, it should always keep it's cubic symmetry...
Logged

Someday, man will understand primary theory; how every aspect of our universe has come about. Then we will describe all of physics, build a complete understanding of genetic engineering, catalog all planets, and find intelligent life. And then we'll just puzzle over fractals for eternity.
Tglad
Fractal Molossus
**
Posts: 703


WWW
« Reply #8 on: March 29, 2010, 02:49:57 AM »

It's just clipping the near plane. Something to watch out for.
Logged
Timeroot
Fractal Fertilizer
*****
Posts: 362


The pwnge.


WWW
« Reply #9 on: March 29, 2010, 06:47:57 AM »

ooh, is it a spherical clip? It looked so... round, I guess, I wasn't expecting that. Now I feel dumb.  embarrass  secret; zipped mouth
Logged

Someday, man will understand primary theory; how every aspect of our universe has come about. Then we will describe all of physics, build a complete understanding of genetic engineering, catalog all planets, and find intelligent life. And then we'll just puzzle over fractals for eternity.
fractalrebel
Fractal Lover
**
Posts: 211



WWW
« Reply #10 on: March 29, 2010, 05:33:56 PM »

Here is a Juliabox with a seed of (2,-2,-2) and scale = 2.5, using my Delta DE method.



* Juliabox.jpg (253.39 KB, 800x800 - viewed 3147 times.)
Logged

JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #11 on: March 29, 2010, 08:52:22 PM »

Buddhi, your distance formula works like a dream! Much better than the one I suggested.


* Mandelbox010s.jpg (231.56 KB, 640x640 - viewed 3282 times.)
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #12 on: March 29, 2010, 11:46:56 PM »

awesome, this really is going to speed things up wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #13 on: March 30, 2010, 10:08:41 PM »

Thank you Buddhi, seems to be very fast  smiley

Dont know if i made something different (the "DEfactor = scale" term is outside the loop, i guess), so far i have additional DE-scaling factors of about (MandBox) scale*1.2 + 1 for positive scales and scale*0.65 for negative scales to adjust the estimates.

But when MandBox scalings comes closer to 1 or -1, things are getting more difficult. But that hasnt changed, seems to be a global problem...

Just wondering if this method can be extended for alternated hybrids with common powerX bulbs?
Logged
subblue
Conqueror
*******
Posts: 116



WWW
« Reply #14 on: April 01, 2010, 11:08:20 AM »

Thanks for the DE tip Buddhi. I'm working on a Mandelbox version of my PixelBender script. So far it is actually noticeably slower than the Mandelbulb so I've still a way to go optimising it, but the results are pretty interesting so far!





Logged

www.subblue.com - a blog exploring mathematical and generative graphics
Pages: [1] 2 3   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Mandelbox distance estimation problem 3D Fractal Generation « 1 2 » barkeg 23 19164 Last post August 27, 2011, 12:28:36 PM
by barkeg
Convert a Distance Estimate to a Mesh General Discussion eiffie 9 7873 Last post October 11, 2011, 05:22:34 PM
by eiffie
Need help with distance estimation formula for the Phoenix fractal Programming top-quark 6 1181 Last post April 26, 2014, 12:00:41 AM
by top-quark
Using the Jacobian to estimate distance Programming TruthSerum 7 6986 Last post July 06, 2014, 02:39:12 AM
by David Makin
spotty interior distance estimate for Julia sets Mandelbrot & Julia Set claude 5 4064 Last post February 21, 2015, 05:50:58 PM
by Adam Majewski

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.154 seconds with 27 queries. (Pretty URLs adds 0.012s, 2q)