Welcome to Fractal Forums

Fractal Software => Fragmentarium => Topic started by: Crist-JRoger on October 30, 2015, 09:47:55 PM




Title: Mandelbulb-Gnarl
Post by: Crist-JRoger on October 30, 2015, 09:47:55 PM
I just played with mandelbulb.frag and decide to post frag file. It is very similar to the gnarl 3d but it is not really gnarl  ;D I added z.x=abs(z.y) in DE(vec3 pos). The idea is not mine, i found the same change on DA - originally it was z.x=cos(z.x). It can be changed to z=abs(z.y). Maybe somebody will be interested and will make "really" 3D gnarl.


(http://pre07.deviantart.net/b9be/th/pre/f/2014/242/2/e/another_mandelbulb_by_crist_jroger-d7x845a.jpg) (http://orig09.deviantart.net/dbd6/f/2014/242/2/e/another_mandelbulb_by_crist_jroger-d7x845a.jpg)


Title: Re: Mandelbulb-Gnarl
Post by: LMarkoya on October 30, 2015, 11:33:21 PM
Nice, I like it!...and nice render


Title: Re: Mandelbulb-Gnarl
Post by: DarkBeam on October 30, 2015, 11:43:37 PM
Totally different from gnarl but nice :)


Title: Re: Mandelbulb-Gnarl
Post by: Crist-JRoger on October 31, 2015, 09:01:36 AM
LMarkoya, thank you!

DarkBeam i know that gnarl is spiral, so it just looks similar to the gnarl. Maybe exist formula for real gnarl in fragmentarium  88)


Title: Re: Mandelbulb-Gnarl
Post by: DarkBeam on October 31, 2015, 10:57:03 AM
of course is possible as heightfield :)
You simply calculate the formula for x and y, you extract the magnitude then for the DE add to z that mag - edventually corrected with some log() ;)

Example
magold = x*x + y*y;
For (i=0; i<16; i++) {
Xn = x - 0.1 sin(y + 5 sin (2y-0.2*x)); yn = ...; // pick whatever you like with sin cos etc add more sines do it yourself ;)
X= xn; Y= yn;
}
Mag = Magold - x*x - y*y;
Mag = log( 1.5+ mag); // smooth
Return z-Mag;


Title: Re: Mandelbulb-Gnarl
Post by: Patryk Kizny on October 31, 2015, 01:14:43 PM
That's cool! What raytracer did you use for it?


Title: Re: Mandelbulb-Gnarl
Post by: Crist-JRoger on October 31, 2015, 05:15:51 PM
DarkBeam, i'm really not sure what to do with your formulas in fragmentarium  :headbatting: I do not know glsl or other programming language  :help:
So i write that

float Mag(vec3 pos) {
vec3 z=pos;
int i=0;
float magold = z.x*z.x + z.y*z.y;
for (i=0; i<16; i++) {
float xn = z.x - 0.1* sin(z.y + 5*sin(2*z.y-0.2*z.x));
float yn = z.y - 0.1* sin(z.x + 5*sin(2*z.x-0.2*z.y));
z.x= xn; z.y= yn;
}
float mag = magold - z.x*z.x - z.y*z.y;
mag = log(1.5+ mag); // smooth
return z-mag;
}

How add Mag to DE?


Patryk Kizny, it was long time ago, used first mod by knighty with "3DKn-1.0.0.frag"


Title: Re: Mandelbulb-Gnarl
Post by: DarkBeam on October 31, 2015, 10:57:12 PM
Mag should already be a DE. Try to see what comes ... ;)


Title: Re: Mandelbulb-Gnarl
Post by: Crist-JRoger on November 01, 2015, 12:31:09 AM
 :sad1: I tried to do as you say before asking you. So i got very very smooth mandelbulb like glued balls. Something wrong.
Maybe i wrote something incorrectly. How add mag to z? DE in mandelbulb already has a return. And as i understand, return z-mag must be replaced with something.


Title: Re: Mandelbulb-Gnarl
Post by: DarkBeam on November 01, 2015, 10:07:06 AM
Probably I did a mess try again this :embarrass:
You should get a plane ... but extruded

float Mag(vec3 pos) {
vec3 z=pos;
int i=0;
float Xold = z.x;
float Yold = z.y;
float xn = 0.0;
float yn = 0.0;
for (i=0; i<16; i++) {
xn = z.x - 0.1* sin(z.y + 5*sin(2*z.y-0.2*z.x));
yn = z.y - 0.1* sin(z.x + 5*sin(2*z.x-0.2*z.y));
z.x= xn; z.y= yn;
}
xn = Xold-z.x;
yn = Yold-z.y;
float mag = 1.5 + xn*xn+ yn*yn;
mag = log(mag); //smooth
return z.z-mag;
}


Title: Re: Mandelbulb-Gnarl
Post by: Crist-JRoger on November 01, 2015, 11:48:46 AM
I am sorry, i don`t know what to do with this code...
What means
You should get a plane ... but extruded
?


Title: Re: Mandelbulb-Gnarl
Post by: DarkBeam on November 01, 2015, 05:56:36 PM
The resulting DE (of Mag() ) should be an horizontal plane (like the water you use often)
Cannot help further... I wrote the script for you so you can use it. :)
You can also display it in a mandelbulb surface. Do few iters then do return Mag(z)...
If it does not work ask further
Luca


Title: Re: Mandelbulb-Gnarl
Post by: Crist-JRoger on November 01, 2015, 09:03:32 PM
Okay, i get result... if i may say... It looks terrible  :vomit:  FudgeFactor less than 0,01 for decrease noise

upd.: Okay. With pseudo-kleinian it looks much better! Thank you for gnarl in Frag!


Title: Re: Mandelbulb-Gnarl
Post by: DarkBeam on November 01, 2015, 11:21:44 PM
No problem. The formula is just an example not really the correct one!
 But use it as a base ... change the numbers ... the functions... everything. ;)
Because you will surely find a better one I just made it by memory...
The formula itself is like that...
xn = z.x +- (small number)* sin( put some function of y here... use nested sines... add a grain of x ... etc)
Interesting variants with cos instead of sin.
Fantasy has no limits in gnarly! ;)


Title: Re: Mandelbulb-Gnarl
Post by: Crist-JRoger on November 02, 2015, 08:26:26 PM
Spend some time played with gnarl on a simple surface. To understand how it works. And i find that geometry of spirals is perfect and may be changed by different variables.
So, all that related to 3D - is bad especially when increases height, when 3d small it looks not so bad.
- need very low fudge factor(0.2-0.01). It follows that we need a lot of maxraysteps (2000-4000), or reduce detail, or both.
- shadows are noisy with crazy banding ever when dithering=1. Normal view when detail=2-2.5, so it`s too much.
Maybe you can tell how optimize code...
Interesting result when return z.z-abs(mag);

A few renders. I attached frag with some presets and my version of renderer.

(http://pre11.deviantart.net/5ad6/th/pre/f/2015/306/f/e/3d_gnarl_by_crist_jroger-d9faa95.jpg) (http://orig10.deviantart.net/e224/f/2015/306/f/e/3d_gnarl_by_crist_jroger-d9faa95.jpg)


(http://orig11.deviantart.net/dc01/f/2015/306/3/0/frag_02_11_15_03_by_crist_jroger-d9faaib.jpg) (http://orig11.deviantart.net/dc01/f/2015/306/3/0/frag_02_11_15_03_by_crist_jroger-d9faaib.jpg)


Title: Re: Mandelbulb-Gnarl
Post by: Crist-JRoger on November 03, 2015, 12:41:24 AM
Added Kali`s color palette  :love:
I use ColorDensity value more than limit in original file ColorPalette.frag, so maybe incorrect showing of my preset in newest versions of Frag  :dink:

(http://orig03.deviantart.net/59ca/f/2015/306/6/b/frag_03_11_15_01_by_crist_jroger-d9fbc1z.jpg) (http://orig03.deviantart.net/59ca/f/2015/306/6/b/frag_03_11_15_01_by_crist_jroger-d9fbc1z.jpg)



Title: Re: Mandelbulb-Gnarl
Post by: 3dickulus on November 03, 2015, 02:15:23 AM
really nice, I like the colors  O0 it looks a lot like something I played with shortly after the turn of the century ;)

here's a ( no where near as good as yours ) pic from my 2001 code and the cpp file with 4 functions for cyclic escape time fractal sin cos atan and pow.

it's nice to see Fragmentarium producing such quality images :beer:


Title: Re: Mandelbulb-Gnarl
Post by: Crist-JRoger on November 10, 2015, 04:50:00 PM
I am absolutely delighted by this palette  88)  :love:

(http://pre09.deviantart.net/78cb/th/pre/f/2015/314/f/2/colors_by_crist_jroger-d9g731m.png) (http://orig03.deviantart.net/27c2/f/2015/314/f/2/colors_by_crist_jroger-d9g731m.png)