Welcome to Fractal Forums

Fractal Software => 3D Fractal Generation => Topic started by: Buddhi on April 19, 2011, 08:44:49 PM




Title: Mandelbox with "smooth" conditions
Post by: Buddhi on April 19, 2011, 08:44:49 PM
I'm not sure whether somebody tried this before, but I converted standard Mandelbox formula into formula without any conditions but with smooth transition functions.

I have replaced condition IF A>B by
\frac{1}{1 - \frac{1}{exp(k * (A-B))}}

where k is a smoothness factor

The code for Mandelbox is following (tested in Mandelbulber):
Code:
double sm = 3.0;

double zk1 = 1.0 / (1.0 + 1.0 / exp(sm * (z.x - par.mandelbox.doubles.foldingLimit)));
double zk2 = 1.0 / (1.0 + 1.0 / exp(sm * (z.x + par.mandelbox.doubles.foldingLimit)));
z.x = z.x * (1.0 - zk1) + (par.mandelbox.doubles.foldingValue - z.x) * zk1;
z.x = z.x * (zk2) + (-par.mandelbox.doubles.foldingValue - z.x) * (1.0 - zk2);

double zk3 = 1.0 / (1.0 + 1.0 / exp(sm * (z.y - par.mandelbox.doubles.foldingLimit)));
double zk4 = 1.0 / (1.0 + 1.0 / exp(sm * (z.y + par.mandelbox.doubles.foldingLimit)));
z.y = z.y * (1.0 - zk3) + (par.mandelbox.doubles.foldingValue - z.y) * zk3;
z.y = z.y * (zk4) + (-par.mandelbox.doubles.foldingValue - z.y) * (1.0 - zk4);

double zk5 = 1.0 / (1.0 + 1.0 / exp(sm * (z.z - par.mandelbox.doubles.foldingLimit)));
double zk6 = 1.0 / (1.0 + 1.0 / exp(sm * (z.z + par.mandelbox.doubles.foldingLimit)));
z.z = z.z * (1.0 - zk5) + (par.mandelbox.doubles.foldingValue - z.z) * zk5;
z.z = z.z * (zk6) + (-par.mandelbox.doubles.foldingValue - z.z) * (1.0 - zk6);

r = z.Length();
double r2 = r * r;

double m_factor1 = fR2 / mR2;
double m_factor2 = fR2 / r2;
double rk1 = 1.0 - 1.0 / (1.0 + 1.0 / exp(sm * (r2 - mR2)));
double rk2 = 1.0 - 1.0 / (1.0 + 1.0 / exp(sm * (r2 - fR2)));
double rk21 = (1.0 - rk1) * rk2;

z = z * (1.0 - rk1) + z * (m_factor1 * rk1);
z = z * (1.0 - rk21) + z * (m_factor2 * rk21);

z = z * scale + constant;
r = z.Length();

As you see there is no any "IF" command.

Bellow there is an example:
(http://nocache-nocookies.digitalgott.com/gallery/6/thumb_640_19_04_11_8_25_21.jpeg)
http://www.fractalforums.com/index.php?action=gallery;sa=view;id=6817

The shape is almost the same, but a little more rounded somewhere

This is other example:
(http://nocache-nocookies.digitalgott.com/gallery/6/thumb_640_18_04_11_6_17_11.jpeg)
http://www.fractalforums.com/index.php?action=gallery;sa=view;id=6792

Of course rendering is much slower but shapes are very interesting somewhere


Title: Re: Mandelbox with "smooth" conditions
Post by: marius on April 19, 2011, 09:08:47 PM
I'm not sure whether somebody tried this before, but I converted standard Mandelbox formula into formula without any conditions but with smooth transition functions.

I have replaced condition IF A>B by
<Quoted Image Removed>

where k is a smoothness factor

Interesting. More organic, H.R. Giger-style appearance.
Nice glow rendering!


Title: Re: Mandelbox with "smooth" conditions
Post by: msltoe on April 20, 2011, 04:03:57 AM
Buddhi,

 I've experimented with smooth transitions for my favorite YZ symmetrized Mandelbulbs, but found in those cases I had to use sharp functions to prevent artifacts.
 I've looked at and others have mentioned the use of sin(x) for reflections  but found that the sine function is too smooth.
 BTW, the formula in your post has a typo : it should read: 1/1+exp... but I see you coded it up correctly.

 If you want you can post the smooth and non-smooth side by side so we can see the difference. I've been concerned though, that any smooth transition actually causes conformality violations. In other words, the if-test formula, even though it's discontinous in first derivative, preserves angles as you zoom in.

-mike


Title: Re: Mandelbox with "smooth" conditions
Post by: Buddhi on April 20, 2011, 07:15:46 AM
Buddhi,

 I've experimented with smooth transitions for my favorite YZ symmetrized Mandelbulbs, but found in those cases I had to use sharp functions to prevent artifacts.
 I've looked at and others have mentioned the use of sin(x) for reflections  but found that the sine function is too smooth.
 BTW, the formula in your post has a typo : it should read: 1/1+exp... but I see you coded it up correctly.

 If you want you can post the smooth and non-smooth side by side so we can see the difference. I've been concerned though, that any smooth transition actually causes conformality violations. In other words, the if-test formula, even though it's discontinous in first derivative, preserves angles as you zoom in.

-mike

You are right, There was a mistake and I have also overcomplicated a little this formula. I forgot that exp(x) = 1/exp(-x)  :embarrass: It could be:
\frac{1}{1 + \frac{1}{exp(k * (A-B))}} = \frac{1}{1 + {exp(k * (B-A))}


Title: Re: Mandelbox with "smooth" conditions
Post by: DarkBeam on April 21, 2011, 06:41:47 PM
If you want you can post the smooth and non-smooth side by side so we can see the difference. I've been concerned though, that any smooth transition actually causes conformality violations.

Too bad it's true - I tried many times to write a smoothed Barnsley using sigmoids like these and they all give weird Julias due to the non conformality. :sad1:


Title: Re: Mandelbox with "smooth" conditions
Post by: knighty on May 22, 2011, 03:02:08 PM
I'm not sure whether somebody tried this before, but I converted standard Mandelbox formula into formula without any conditions but with smooth transition functions.

I did (http://www.fractalforums.com/3d-fractal-generation/%27smooth%27-folding/)  ;D. But your results are much better.
There is also this one (http://www.lactamme.polytechnique.fr/Mosaic/images/MANB.31.2.D/display.html).