Welcome to Fractal Forums

Fractal Math, Chaos Theory & Research => Amazing Box, Amazing Surf and variations => Topic started by: DarkBeam on March 08, 2015, 11:44:06 AM




Title: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: DarkBeam on March 08, 2015, 11:44:06 AM
This is my attempt to realize a Mandalex without adding any discontinuity! :D
The idea seems simple but it's not. :)

--------------------

The Mandalex has nice "towers", it kind of extrudes Mandelbox adding nice towers at the edges.
This is also possible with folding.
If you do it carefully, you can even keep axis orthogonal, this is fundamental to keep fractal details. I think I managed ti in 2D, not 100% sure of 3D ..........
.......
...because I made it just following my intuition
 :embarrass:
Master Knighty please take a look!!! O0

This is my Evaldraw 2D script.
To visualize the fold change last line to; -xf to see negative x folded, yf or -yf to see y fold. They should be perfectly orthogonal and continuous. ^-^

Code:
(x,y)
   //press F1 for help
   //press ALT/ESC for menu
double nx = abs(x);
double ny = abs(y);
double fo = .5; // change!!!!
double g = .9; // change!!!!
double fx = -2*fo+nx;
double fy = -2*fo+ny;
double xf = (fo-abs(-fo+nx));
double yf = (fo-abs(-fo+ny));
double gx = g+nx;
double gy = g+ny;

  if (fx > 0 && fx>ny) { // && fx>nz presumably
    if (fx>gy) {
     // square edge:
     xf += g;
     // orthogonal axis must stay ortho:
     yf = (fo-abs(g-fo+ny));
     // do similarly zf here...
    } else {
     // top:
     xf = -ny;
     // orthogonal axis must stay ortho:
     yf = (fo-abs(-3*fo+nx));
     // do similarly zf...
    }
  }
  if (fy > 0 && fy>nx) { // && fy>nz presumably
    if (fy>gx) {
     // square edge:
     yf += g;
     xf = (fo-abs(g-fo+nx));
     // do similarly zf...
    } else {
     // top:
     yf = -nx;
     // orthogonal axis must stay ortho:
     xf = (fo-abs(-3*fo+ny));
     // do similarly zf...
    }
  }
-xf

This is a Fragmentarium horrible script, it gives nice strange cubes ... ;)
Don't know if axis are really ortho. If not ... it's incorrect but don't know how to fix it  :dink: :dink: :embarrass:

Code:
#info Mandelbox Distance Estimator (Rrrola's version).
#define providesInit
#include "DE-Raytracer.frag"
#include "MathUtils.frag"
#group Mandelbox

/*
The distance estimator below was originalled devised by Buddhi.
This optimized version was created by Rrrola (Jan Kadlec), http://rrrola.wz.cz/

See this thread for more info: http://www.fractalforums.com/3d-fractal-generation/a-mandelbox-distance-estimate-formula/15/
*/

// Number of fractal iterations.
uniform int Iterations;  slider[0,17,300]
uniform int ColorIterations;  slider[0,3,300]

uniform float MinRad2;  slider[0,0.25,2.0]

// Scale parameter. A perfect Menger is 3.0
uniform float Scale;  slider[-3.0,3.0,5.0]
vec4 scale = vec4(Scale, Scale, Scale, abs(Scale)) / MinRad2;

// precomputed constants

uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]

// Scale parameter. A perfect Menger is 3.0
uniform float RotAngle; slider[0.00,0,180]

mat3 rot;

void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
}

float absScalem1 = abs(Scale - 1.0);
float AbsScaleRaisedTo1mIters = pow(abs(Scale), float(1-Iterations));


// Compute the distance from `pos` to the Mandelbox.
float DE(vec3 pos) {
vec4 p = vec4(pos,1), p0 = p;  // p.w is the distance estimate
         p0 =vec4 (1.,-1.,1.,1.); // Julia mode for dummies ^_________^

for (int i=0; i<Iterations; i++) {
p.xyz*=rot;
float nx = abs(p.x);
float ny = abs(p.y);
float nz = abs(p.z);
float fo = .5;
float g = .9;
float fx = -2.*fo+nx;
float fy = -2.*fo+ny;
float fz = -2.*fo+nz;
float xf = (fo-abs(-fo+nx));
float yf = (fo-abs(-fo+ny));
float zf = (fo-abs(-fo+nz));
float gx = g+nx;
float gy = g+ny;
float gz = g+nz;

  if (fx > 0 && fx>ny&& fx>nz) {
    if (fx>gy&& fx>gz) {
     // square edge:
     xf += g;
     // orthogonal axis must stay ortho:
     yf = (fo-abs(g-fo+ny));
     zf = (fo-abs(g-fo+nz));
    } else {
     // top:
     xf = -max(ny,nz);
     // orthogonal axis must stay ortho:
     yf = (fo-abs(-3.*fo+max(nx,nz)));
     zf = (fo-abs(-3.*fo+max(ny,nx)));
    }
  }
  if (fy > 0 && fy>nx&& fy>nz) {
    if (fy>gx&& fy>gz) {
     // square edge:
     yf += g;
    // orthogonal axis must stay ortho:
     xf = (fo-abs(g-fo+nx));
     zf = (fo-abs(g-fo+nz));
    } else {
     // top:
     yf = -max(nx,nz);
     // orthogonal axis must stay ortho:
     xf = (fo-abs(-3.*fo+max(ny,nz)));
     zf = (fo-abs(-3.*fo+max(ny,nx)));
    }
  }
  if (fz > 0 && fz>nx&& fz>ny) {
    if (fz>gx&& fz>gy) {
     // square edge:
     zf += g;
     // orthogonal axis must stay ortho:
     xf = (fo-abs(g-fo+nx));
     zf = (fo-abs(g-fo+nz));
    } else {
     // top:
     zf = -max(ny,nx);
     // orthogonal axis must stay ortho:
     xf = (fo-abs(-3.*fo+max(ny,nz)));
     yf = (fo-abs(-3.*fo+max(nx,nz)));
    }
  }
             p.x = xf; p.y =yf; p.z = zf;
float r2 = dot(p.xyz, p.xyz);
if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(p.xyz,r2)));
p *= clamp(max(MinRad2/r2, MinRad2), 0.0, 1.0);  // dp3,div,max.sat,mul
p = p*scale + p0;
             if ( r2>1000.0) break;

}
return ((length(p.xyz) - absScalem1) / p.w - AbsScaleRaisedTo1mIters);
}

#preset Inside 1
FOV = 0.62536
Eye = -1.16945,-1.12305,-2.79412
Target = 6.16354,-1.00522,-2.00173
Up = -0.619851,-0.17831,0.764193
Detail = -3.09736
DetailAO = -0.28574
FudgeFactor = 0.81928
MaxRaySteps = 220
Dither = 0.5
AO = 0,0,0,0.7
Specular = 2.4348
SpecularExp = 16
SpotLight = 1,1,1,0.73563
SpotLightDir = -0.52,0.1
CamLight = 1,1,1,1.15384
CamLightMin = 0.15151
Glow = 0.0941176,0.341176,0.87451,0.31507
Fog = 0.5
HardShadow = 0
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 0.5625
X = 0.411765,0.6,0.560784,-0.21312
Y = 0.666667,0.666667,0.498039,0.86886
Z = 0.666667,0.333333,1,-0.18032
R = 0.4,0.7,1,0.31372
BackgroundColor = 0.6,0.6,0.45
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 10
ColorIterations = 2
MinRad2 = 0.25
Scale = 2.39128
RotVector = 1,1,1
RotAngle = 0
#endpreset

#preset Other
FOV = 0.4
Eye = 0.136312,-0.357184,2.20031
Target = -2.1701,4.89792,-1.82586
Up = -0.314748,0.483089,0.817043
AntiAlias = 1
Detail = -2.97353
DetailAO = -0.21074
FudgeFactor = 1
MaxRaySteps = 110
BoundingSphere = 7.5904
Dither = 0.5
AO = 0,0,0,0.7
Specular = 4
SpecularExp = 16
SpotLight = 1,1,1,0.4
SpotLightDir = 0.1,0.1
CamLight = 1,1,1,1
CamLightMin = 0.15151
Glow = 1,1,1,0
Fog = 0.02684
HardShadow = 0.58462
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 0.8
X = 0.5,0.6,0.6,0.7
Y = 1,0.6,0,0.4
Z = 0.8,0.78,1,0.5
R = 0.4,0.7,1,0.12
BackgroundColor = 0.6,0.6,0.45
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 18
ColorIterations = 3
MinRad2 = 0.0172
Scale = -1.49272
RotVector = 1,1,1
RotAngle = 0
#endpreset

#preset Default
FOV = 0.56284
Eye = -1.80087,13.736,2.87241
Target = -1.52812,3.93906,2.87915
Up = -0.296524,-0.00759792,0.954991
Detail = -2.35396
DetailAO = -0.28574
FudgeFactor = 1
MaxRaySteps = 105
Dither = 0.5
AO = 0,0,0,0.7
Specular = 4
SpecularExp = 16
SpotLight = 1,1,1,0.4
SpotLightDir = -0.33334,0.1
CamLight = 1,1,1,1
CamLightMin = 0.4697
Glow = 1,1,1,0.17808
Fog = 0
HardShadow = 0
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 0.8
X = 0.5,0.6,0.6,0.7
Y = 1,0.6,0,0.4
Z = 0.8,0.78,1,0.5
R = 0.4,0.7,1,0.12
BackgroundColor = 0.596078,0.6,0.513725
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 12
ColorIterations = 3
MinRad2 = 0.25
Scale = 2.04344
RotVector = 1,1,1
RotAngle = 0
#endpreset

#preset M1
FOV = 0.4
Eye = 3.4315,-5.57625,-2.47321
Target = -1.74219,2.244,1.00192
Up = -0.820324,-0.551717,-0.15059
AntiAlias = 1
Detail = -2.78761
DetailAO = -0.28574
FudgeFactor = 0.916
MaxRaySteps = 112
BoundingSphere = 7.1083
Dither = 0.5
AO = 0,0,0,0.96721
Specular = 1.4167
SpecularExp = 18.8
SpotLight = 1,1,1,0.17391
SpotLightDir = 0.31428,0.1
CamLight = 1,1,1,1.41936
CamLightMin = 0.4697
Glow = 0.835294,0.0784314,0.0784314,0
Fog = 0.45638
HardShadow = 0
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 0.515
X = 0.6,0.0117647,0.0117647,0.59056
Y = 1,0.6,0,0.44882
Z = 1,1,1,0.49606
R = 0.666667,0.666667,0.498039,0.07936
BackgroundColor = 0.666667,0.666667,0.498039
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 17
ColorIterations = 3
MinRad2 = 0.25
Scale = 3
RotVector = 1,1,1
RotAngle = 0
#endpreset


#preset Noname
FOV = 0.2439
Eye = -19.9282,-27.7195,21.9276
Target = -14.6946,-21.4244,16.5391
Up = 0.312177,0.454534,0.83422
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 2.4074
ToneMapping = 5
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3.22126
DetailAO = -0.28574
FudgeFactor = 1
MaxRaySteps = 198
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.7
Specular = 0.30392
SpecularExp = 45.833
SpecularMax = 10
SpotLight = 1,1,1,0.4
SpotLightDir = -0.20988,0.1
CamLight = 1,1,1,1.82608
CamLightMin = 0.4697
Glow = 1,1,1,0
GlowMax = 20
Fog = 0.064
HardShadow = 0.45122 NotLocked
ShadowSoft = 6.3292
Reflection = 0
DebugSun = false
BaseColor = 1,1,1
OrbitStrength = 0.37662
X = 0.5,0.6,0.6,-0.8835
Y = 1,0.6,0,0.4
Z = 0.8,0.78,1,0.5
R = 0.4,0.7,1,0.12
BackgroundColor = 0.596078,0.6,0.513725
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
EnableFloor = true NotLocked
FloorNormal = 0,0,0.17074
FloorHeight = -6.4
FloorColor = 1,1,1
Iterations = 12
ColorIterations = 3
MinRad2 = 0.25
Scale = 2.04344
RotVector = 1,1,1
RotAngle = 0
#endpreset


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 08, 2015, 11:58:34 AM
Image (awful) :embarrass:


Title: Re: "New" fractal type; Mandalay
Post by: cKleinhuis on March 08, 2015, 12:11:40 PM
it looks different but has the temple aspects of the box/mandelx ;) please continue ;)


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 08, 2015, 12:21:09 PM
it looks different but has the temple aspects of the box/mandelx ;) please continue ;)

Can you render it with the other software? I can't because it does not work here, and I must go out for lunch :)


Title: Re: "New" fractal type; Mandalay
Post by: knighty on March 08, 2015, 01:11:50 PM
I must go out for lunch :)
Me too.  ;D :headbatting:


Title: Re: "New" fractal type; Mandalay
Post by: cKleinhuis on March 08, 2015, 02:42:04 PM
lunch? splendid idea :D


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 08, 2015, 04:25:39 PM
Me too.  ;D :headbatting:
Ack... you don't need to eat! Aren't you a cyborg?!  :alien: :evil1:
Lazy people ;D


Title: Re: "New" fractal type; Mandalay
Post by: Crist-JRoger on March 08, 2015, 05:15:56 PM
This is a Fragmentarium horrible script...
May I render it?  :embarrass: )


Title: Re: "New" fractal type; Mandalay
Post by: knighty on March 08, 2015, 05:19:18 PM
After  :headbatting: :headbatting: :headbatting: then  :headbatting: again I got this for 2D:
Code:
(x,y){
   fo = mousx*0.01; // change!!!!
   g = mousy*0.01; // change!!!!
#if 0
   dbFold(x,y,fo,g);
#else
   dbknFold(x,y,fo,g);
#endif
   //(sin(x)+sin(y))*0.25+0.5//
   sin(sqrt(x*x+y*y)*2)*0.5+0.5
}
DBKNFold(&x,&y,fo,g){
   x=abs(x); y=abs(y);//axis folds
   t=max(0,y-x); x+=t; y-=t;//diagonal fold
   x-=fo; x=abs(x);
   x-=fo;
   t=min(g,max(0,x-y)); x-=t; y+=t;//Odd fold (like the mandelbox fold). abs() like folds are even.
   y-=fo; y=-abs(y); y+=fo;
}
I'll try to see how it works in 3D this evening or tomorrow. I think it should be something like this:


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 08, 2015, 05:21:17 PM
May I render it?  :embarrass: )
Of course! Everybody can :D
I am curious to see Knighty's result ;)


Title: Re: "New" fractal type; Mandalay
Post by: Sabine on March 08, 2015, 06:42:38 PM
Me too Me too Me too! What I got until now is really quite horrible. But I am rendering anyway, with 1000 subframes. Why 1000 subframes? Because I never did that  :whistle2: Meanwhile, gpu is almost cremated...


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 08, 2015, 07:15:20 PM
Me too Me too Me too! What I got until now is really quite horrible. But I am rendering anyway, with 1000 subframes. Why 1000 subframes? Because I never did that  :whistle2: Meanwhile, gpu is almost cremated...

Set scale = 2... Scale 3 is not good :D


Title: Re: "New" fractal type; Mandalay
Post by: Sabine on March 08, 2015, 07:47:23 PM
Aborted the render at 38%... Checked, Scale was set to 1.94... :fiery:
 ;D


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 08, 2015, 08:22:56 PM
(http://nocache-nocookies.digitalgott.com/gallery/17/4162_08_03_15_8_22_00.png)
Btw The 3D formula has cuts, so it's surely wrong :fiery: :fiery: :fiery:


Title: Re: "New" fractal type; Mandalay
Post by: Crist-JRoger on March 08, 2015, 08:27:46 PM
Rotated  :) I called this "Transformation"

(https://farm9.staticflickr.com/8645/16570223029_f4b62592a0_o.jpg) (https://farm9.staticflickr.com/8645/16570223029_f4b62592a0_o.jpg)


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 08, 2015, 08:41:16 PM
Rotated  :) I called this "Transformation"

(https://farm9.staticflickr.com/8645/16570223029_f4b62592a0_o.jpg) (https://farm9.staticflickr.com/8645/16570223029_f4b62592a0_o.jpg)

 :beer: :beer: :beer: ty!!!!!


Title: Re: "New" fractal type; Mandalay
Post by: Crist-JRoger on March 08, 2015, 08:46:54 PM
 :D it's a coffee i think?


Title: Re: "New" fractal type; Mandalay
Post by: knighty on March 08, 2015, 09:53:47 PM
:D it's a coffee i think?
Yes! it is.  :dink:
Very nice render BTW.

@DarkBeam:
Yes there are cuts! but I like it this way.
This is the original shader. I just added controls for fg, g and juliaC:
Code:
#info Mandalay Distance Estimator.
#define providesInit
#include "DE-Raytracer.frag"
#include "MathUtils.frag"
#group Mandalay

// Number of fractal iterations.
uniform int Iterations;  slider[0,17,30]
uniform int ColorIterations;  slider[0,3,30]

uniform float MinRad2;  slider[0,0.25,2.0]

// Scale parameter. A perfect Menger is 3.0
uniform float Scale;  slider[-3.0,3.0,5.0]
vec4 scale = vec4(Scale, Scale, Scale, abs(Scale)) / MinRad2;

uniform float fo; slider[0.,0.5,2.]
uniform float g; slider[0.,0.9,2.]
// precomputed constants

uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]

// Scale parameter. A perfect Menger is 3.0
uniform float RotAngle; slider[0.00,0,180]

uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]

mat3 rot;

void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
}

float absScalem1 = abs(Scale - 1.0);
float AbsScaleRaisedTo1mIters = pow(abs(Scale), float(1-Iterations));


// Compute the distance from `pos` to the Mandelbox.
float DE(vec3 pos) {
vec4 p = vec4(pos,1), p0 = p;  // p.w is the distance estimate
       if(Julia) p0.xyz = JuliaC;

for (int i=0; i<Iterations; i++) {
p.xyz*=rot;
float nx = abs(p.x);
float ny = abs(p.y);
float nz = abs(p.z);

float fx = -2.*fo+nx;
float fy = -2.*fo+ny;
float fz = -2.*fo+nz;
float xf = (fo-abs(-fo+nx));
float yf = (fo-abs(-fo+ny));
float zf = (fo-abs(-fo+nz));
float gx = g+nx;
float gy = g+ny;
float gz = g+nz;

  if (fx > 0 && fx>ny&& fx>nz) {
    if (fx>gy&& fx>gz) {
     // square edge:
     xf += g;
     // orthogonal axis must stay ortho:
     yf = (fo-abs(g-fo+ny));
     zf = (fo-abs(g-fo+nz));
    } else {
     // top:
     xf = -max(ny,nz);
     // orthogonal axis must stay ortho:
     yf = (fo-abs(-3.*fo+max(nx,nz)));
     zf = (fo-abs(-3.*fo+max(ny,nx)));
    }
  }
  else if (fy > 0 && fy>nx&& fy>nz) {
    if (fy>gx&& fy>gz) {
     // square edge:
     yf += g;
    // orthogonal axis must stay ortho:
     xf = (fo-abs(g-fo+nx));
     zf = (fo-abs(g-fo+nz));
    } else {
     // top:
     yf = -max(nx,nz);
     // orthogonal axis must stay ortho:
     xf = (fo-abs(-3.*fo+max(ny,nz)));
     zf = (fo-abs(-3.*fo+max(ny,nx)));
    }
  }
  else if (fz > 0 && fz>nx&& fz>ny) {
    if (fz>gx&& fz>gy) {
     // square edge:
     zf += g;
     // orthogonal axis must stay ortho:
     xf = (fo-abs(g-fo+nx));
     zf = (fo-abs(g-fo+nz));
    } else {
     // top:
     zf = -max(ny,nx);
     // orthogonal axis must stay ortho:
     xf = (fo-abs(-3.*fo+max(ny,nz)));
     yf = (fo-abs(-3.*fo+max(nx,nz)));
    }
  }
             p.x = xf; p.y =yf; p.z = zf;
float r2 = dot(p.xyz, p.xyz);
if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(p.xyz,r2)));
p *= clamp(max(MinRad2/r2, MinRad2), 0.0, 1.0);  // dp3,div,max.sat,mul
p = p*scale + p0;
             if ( r2>1000.0) break;

}
return ((length(p.xyz) - absScalem1) / p.w - AbsScaleRaisedTo1mIters);
}

This is a slight modification to make it more symmetric. There still are discontinuities:
Code:
#info Mandalay Distance Estimator.
#define providesInit
#include "DE-Raytracer.frag"
#include "MathUtils.frag"
#group Mandalay

// Number of fractal iterations.
uniform int Iterations;  slider[0,17,30]
uniform int ColorIterations;  slider[0,3,30]

uniform float MinRad2;  slider[0,0.25,2.0]

// Scale parameter. A perfect Menger is 3.0
uniform float Scale;  slider[-3.0,3.0,5.0]
vec4 scale = vec4(Scale, Scale, Scale, abs(Scale)) / MinRad2;

uniform float fo; slider[0.,0.5,2.]
uniform float g; slider[0.,0.9,2.]
// precomputed constants

uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]

// Scale parameter. A perfect Menger is 3.0
uniform float RotAngle; slider[0.00,0,180]

uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]

mat3 rot;

void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
}

float absScalem1 = abs(Scale - 1.0);
float AbsScaleRaisedTo1mIters = pow(abs(Scale), float(1-Iterations));


// Compute the distance from `pos` to the Mandelbox.
float DE(vec3 pos) {
vec4 p = vec4(pos,1), p0 = p;  // p.w is the distance estimate
       if(Julia) p0.xyz = JuliaC;

for (int i=0; i<Iterations; i++) {
p.xyz*=rot;
vec3 n = abs(p);
if(n.y>n.x) n.xy=n.yx;
      if(n.z>n.y) n.yz=n.zy;
      if(n.y>n.x) n.xy=n.yx;
float fx = -2.*fo+n.x;
float fy = -2.*fo+n.y;
float fz = -2.*fo+n.z;
float xf = (fo-abs(-fo+n.x));
float yf = (fo-abs(-fo+n.y));
float zf = (fo-abs(-fo+n.z));
float gx = g+n.x;
float gy = g+n.y;
float gz = g+n.z;

  if (fx > 0 && fx>n.y && fx>n.z) {
    if (fx>gy&& fx>gz) {
     // square edge:
     xf += g;
     // orthogonal axis must stay ortho:
     yf = (fo-abs(g-fo+n.y));
     zf = (fo-abs(g-fo+n.z));
    } else {
     // top:
     xf = -max(n.y,n.z);
     // orthogonal axis must stay ortho:
     yf = (fo-abs(-3.*fo+max(n.x,n.z)));
     zf = (fo-abs(-3.*fo+max(n.y,n.x)));
    }
  }
             p.x = xf; p.y =yf; p.z = zf;
float r2 = dot(p.xyz, p.xyz);
if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(p.xyz,r2)));
p *= clamp(max(MinRad2/r2, MinRad2), 0.0, 1.0);  // dp3,div,max.sat,mul
p = p*scale + p0;
             if ( r2>1000.0) break;

}
return ((length(p.xyz) - absScalem1) / p.w - AbsScaleRaisedTo1mIters);
}

I couldn't get anything interesting with "my" folding version.


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 08, 2015, 10:35:44 PM
Oh no...
There must be a method to fix the cuts :(
Will check tomorrow.
The 2d version looked great but did not saved! :(


Title: Re: "New" fractal type; Mandalay
Post by: Sabine on March 08, 2015, 11:01:50 PM
(http://pre02.deviantart.net/037f/th/pre/i/2015/067/a/9/luca1_11_by_sabine62-d8kycx4.jpg)
Some rotating too... Not as smart though ;)


Title: Re: "New" fractal type; Mandalay
Post by: Sabine on March 08, 2015, 11:17:46 PM
(http://orig00.deviantart.net/07be/f/2015/067/8/1/luca1_14_by_sabine62-d8kygaw.jpg)

@DarkBeam
Not much, but hey ;) Done with Knighty's modification


Title: Re: "New" fractal type; Mandalay
Post by: Crist-JRoger on March 08, 2015, 11:27:39 PM
This is the original shader. I just added controls for fg, g and juliaC:
...
I couldn't get anything interesting with "my" folding version.
When rotate this, it looks like garbage dump  :D So there is and correct geometry too.
And this is a new script for Fragmentarium in a long time... thank you and DarkBeam )

upd.:
This is from first script:

(https://farm8.staticflickr.com/7601/16141563483_d830d41998_o.jpg) (https://farm8.staticflickr.com/7601/16141563483_d830d41998_o.jpg)


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 09, 2015, 01:26:28 PM
This solution is 90% perfect! Still cuts but almost never noticeable. :D Ty Knighty!

Code:
float DE(vec3 pos) {
vec4 p = vec4(pos,1), p0 = p;  // p.w is the distance estimate
       if(Julia) p0.xyz = JuliaC;

for (int i=0; i<Iterations; i++) {
p.xyz*=rot;
vec3 n = abs(p);
if(n.y>n.x) n.xy=n.yx;
      if(n.z>n.y) n.yz=n.zy;
      if(n.y>n.x) n.xy=n.yx;
float fx = -2.*fo+n.x;
float fy = -2.*fo+n.y;
float fz = -2.*fo+n.z;
float xf = (fo-abs(-fo+n.x));
float yf = (fo-abs(-fo+n.y));
float zf = (fo-abs(-fo+n.z));
float gx = g+n.x;
float gy = g+n.y;
float gz = g+n.z;

  if (fx > 0 && fx>n.y && fx>n.z) {
    if (fx>gy&& fx>gz) {
     // square edge:
     xf += g;
     // orthogonal axis must stay ortho:
     yf = (fo-abs(-g-fo+n.y));
     zf = (fo-abs(-g-fo+n.z));
    } else {
     // top:
     xf = -n.y;
     // orthogonal axis must stay ortho:
     yf = (fo-abs(-3.*fo+n.x));
     zf = fo-(abs(-fo+n.z));
    }
  }


Title: Re: "New" fractal type; Mandalay
Post by: knighty on March 09, 2015, 03:16:47 PM
That transformation is fantastic!
Finally got someting that is hopefully without discontinuities thought one have to lower fudge factor.
Enjoy:
Code:
#info Non-Mandalay Distance Estimator.
#define providesInit
#include "DE-Raytracer.frag"
#include "MathUtils.frag"
#group Non_Mandalay

// Number of iterations.
uniform int Iterations;  slider[0,10,20]

// Scale parameter. A perfect Menger is 3.0
uniform float Scale; slider[-4.0,-2,4.00]

uniform vec3 RotVector; slider[(0,0,0),(1,0,0),(1,1,1)]

// Scale parameter. A perfect Menger is 3.0
uniform float RotAngle; slider[0.00,00,360]

uniform vec3 fo; slider[(0.,0,0),(0.5,0.5,0.5),(2.,2.,2.)]
uniform vec3 g; slider[(0.,0,0),(0.1,0.1,0.1),(2.,2.,2.)]
uniform bool Serial; checkbox[false]
//Mandelbox's radial fold
uniform float MinRad2;  slider[0,0.25,2.0]
// Julia
uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(1,1,1),(2,2,2)]

mat3 rot;
float sr;
void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
sr = 30.;
}
//DarkBeam's "fold"... reinterpreted... it's more than a fold, much more! Just awesome!
float DBFold(vec3 p, float fo, float g){
if(p.z>p.y) p.yz=p.zy;
float vx=p.x-2.*fo;
float vy=p.y-4.*fo;
  float v=abs(max(vx,vy)+fo)-fo;
float v1=max(vx-g,p.y);
v=min(v,v1);
v1=max(vx+g,2.*fo-p.y);
return min(v,v1);
}
//the coordinates are pushed/pulled in parallel
vec3 DBFoldParallel(vec3 p, vec3 fo, vec3 g){
vec3 p1=p;
p.x=DBFold(p1,fo.x,g.x);
p.y=DBFold(p1.yzx,fo.y,g.y);
p.z=DBFold(p1.zxy,fo.z,g.z);
return p;
}
//serial version
vec3 DBFoldSerial(vec3 p, vec3 fo, vec3 g){
p.x=DBFold(p,fo.x,g.x);
p.y=DBFold(p.yzx,fo.y,g.y);
p.z=DBFold(p.zxy,fo.z,g.z);
return p;
}
float DE(vec3 p)
{
vec4 JC=Julia? vec4(JuliaC,0.) : vec4(p,1.);
float r2=dot(p,p);
float dd = 1.;
for(int i = 0; i<Iterations && r2<10000.; i++){
p=abs(p);

if(Serial) p=DBFoldSerial(p,fo,g);
else p=DBFoldParallel(p,fo,g);

r2=dot(p,p);
//orbitTrap = min(orbitTrap, abs(vec4(p.x,p.y,p.z,r2)));
float  t = clamp(1./r2, 1., 1./MinRad2);
p*=t; dd*=t;

p=p*Scale+JC.xyz; dd=dd*abs(Scale)+JC.w;
p=rot*p;
r2=dot(p,p);
orbitTrap = min(orbitTrap, abs(vec4(p.x,p.y,p.z,r2)));
}
#if 1
return (sqrt(r2)-sr)/dd;//bounding volume is a sphere
#else
p=abs(p); return (max(p.x,max(p.y,p.z))-sr)/dd;//bounding volume is a cube
#endif
}


#preset Default
FOV = 0.56284
Eye = -1.25806,4.3182,1.28612
Target = 0.63661,-4.73449,-1.95634
Up = -0.967592,-0.236269,0.0891205
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -1.10789
FudgeFactor = 0.51331
MaxRaySteps = 244
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.89655
Specular = 0.08679
SpecularExp = 16
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.36066,-0.60656
CamLight = 1,1,1,0.69828
CamLightMin = 0.81301
Glow = 1,1,1,0.17808
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.623529,0.623529,0.623529
OrbitStrength = 0.37743
X = 0.5,0.6,0.6,-0.22968
Y = 1,0.6,0,0.44876
Z = 0.8,0.78,1,0.15902
R = 0.4,0.7,1,-0.14184
BackgroundColor = 0.596078,0.6,0.513725
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 12
Scale = -1.79592
RotVector = 1,1,1
RotAngle = 0
MinRad2 = 0.2695
Julia = true
JuliaC = 1.43644,0.04812,-0.9416
fo = 0.3131,0.23642,0.44728
g = 0.14512,0.10726,0.42272
Serial = false
#endpreset


#preset squares
FOV = 0.56284
Eye = -1.96287,4.04877,3.77569
Target = 0.9938,-2.37872,-3.00664
Up = -0.926068,-0.374525,-0.0461524
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -1.10789
FudgeFactor = 0.51331
MaxRaySteps = 244
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.89655
Specular = 0.08679
SpecularExp = 16
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.36066,-0.60656
CamLight = 1,1,1,0.69828
CamLightMin = 0.81301
Glow = 1,1,1,0.17808
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.623529,0.623529,0.623529
OrbitStrength = 0.37743
X = 0.5,0.6,0.6,-0.22968
Y = 1,0.6,0,0.44876
Z = 0.8,0.78,1,0.15902
R = 0.4,0.7,1,-0.14184
BackgroundColor = 0.596078,0.6,0.513725
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 12
Scale = -2
RotVector = 1,1,1
RotAngle = 0
MinRad2 = 0.2695
Julia = true
JuliaC = 0.84536,0.29552,-0.84536
fo = 0.08946,0.40894,0.42172
g = 0,0.35332,0.37854
Serial = false
#endpreset

#preset Serial
FOV = 0.56284
Eye = -0.740185,1.57305,2.96597
Target = 1.52048,-2.3518,-5.72538
Up = -0.947187,-0.292735,-0.130931
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -1.10789
FudgeFactor = 0.51331
MaxRaySteps = 244
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.89655
Specular = 0.08679
SpecularExp = 16
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.36066,-0.60656
CamLight = 1,1,1,0.69828
CamLightMin = 0.81301
Glow = 1,1,1,0.17808
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.847059,0.847059,0.847059
OrbitStrength = 0.31907
X = 0.5,0.6,0.6,0.32156
Y = 1,0.6,0,0.65372
Z = 0.8,0.78,1,0.68904
R = 0.4,0.7,1,-0.39008
BackgroundColor = 0.596078,0.6,0.513725
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 12
Scale = -2
RotVector = 1,1,1
RotAngle = 0
MinRad2 = 0.2695
Julia = true
JuliaC = 0.50172,0.85912,-1.189
fo = 0.45368,0.40894,0.42172
g = 0,0.35332,0.37854
Serial = true
#endpreset


#preset anotherOne
FOV = 0.56284
Eye = 1.56502,-1.86838,6.47704
Target = -0.57575,0.414304,-2.81064
Up = -0.820632,0.489478,0.294914
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -1.10789
FudgeFactor = 0.61977
MaxRaySteps = 244
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.89655
Specular = 0.08679
SpecularExp = 16
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.36066,-0.60656
CamLight = 1,1,1,0.69828
CamLightMin = 0.81301
Glow = 1,1,1,0.17808
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.847059,0.847059,0.847059
OrbitStrength = 0.31907
X = 0.5,0.6,0.6,0.32156
Y = 1,0.6,0,0.65372
Z = 0.8,0.78,1,0.68904
R = 0.4,0.7,1,-0.39008
BackgroundColor = 0.596078,0.6,0.513725
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 12
Scale = -2
RotVector = 1,1,1
RotAngle = 0
MinRad2 = 0.2695
Julia = true
JuliaC = -2,1.4914,-0.87284
fo = 0.65814,0.19808,0.34504
g = 0.39116,0.57414,0.32808
Serial = false
#endpreset

#preset anotherOneOne
FOV = 0.56284
Eye = 2.16929,5.4393,0.457666
Target = -1.47387,-3.61201,-0.467417
Up = 0.14205,-0.160743,0.976721
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -1.10789
FudgeFactor = 0.51331
MaxRaySteps = 244
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.89655
Specular = 0.08679
SpecularExp = 16
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.36066,-0.60656
CamLight = 1,1,1,0.69828
CamLightMin = 0.81301
Glow = 1,1,1,0.17808
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.623529,0.623529,0.623529
OrbitStrength = 0.37743
X = 0.5,0.6,0.6,-0.22968
Y = 1,0.6,0,0.44876
Z = 0.8,0.78,1,0.15902
R = 0.4,0.7,1,-0.14184
BackgroundColor = 0.596078,0.6,0.513725
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 12
Scale = -2
RotVector = 1,1,1
RotAngle = 0
MinRad2 = 0.25
Julia = true
JuliaC = 1,-1,1
fo = 0.754,0.28116,0
g = 0.80758,0.0694,0.4164
Serial = true
#endpreset


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 09, 2015, 04:45:01 PM
Hehe Knighty :D In reality, leave me alone,  :embarrass: The problem was that we must simply ignore z in the rectangle twiddling, like this;

Code:
float DE(vec3 pos) {
vec4 p = vec4(pos,1), p0 = p;  // p.w is the distance estimate
       if(Julia) p0.xyz = JuliaC;

for (int i=0; i<Iterations; i++) {
p.xyz*=rot;
vec3 n = abs(p);
if(n.y>n.x) n.xy=n.yx;
       if(n.z>n.y) n.yz=n.zy;
       if(n.y>n.x) n.xy=n.yx;
float fx = -2.*fo+n.x;
float fy = -2.*fo+n.y;
float fz = -2.*fo+n.z;
float xf = (fo-abs(-fo+n.x));
float yf = (fo-abs(-fo+n.y));
// float zf = (fo-abs(-fo+n.z)); // NOT necessary!
float zf = n.z; // leave z alone! ;) Or not? It's ok!
float gx = g+n.x;
float gy = g+n.y;
float gz = g+n.z;

  if (fx > 0 && fx>n.y && fx>n.z) {
    if (fx>gy&& fx>gz) {
     // square edge:
     xf += g;
     // orthogonal axis must stay ortho:
     yf = (fo-abs(g-fo+n.y)); // aaaaaaahhh!!! g-fo not -g-fo!!!
     // zf = (fo-abs(-g-fo+n.z)); //NOT touch tsk tsk
    } else {
     // top:
     xf = -n.y;
     // orthogonal axis must stay ortho:
     yf = (fo-abs(-3.*fo+n.x));
     // zf = fo-(abs(-fo+n.z)); //NOT touch tsk tsk
    }
  }

The rest was due to some... errors :fiery: ... around! ;) Now it's perfectly working :dink:

(http://nocache-nocookies.digitalgott.com/gallery/17/4162_09_03_15_5_09_16.jpeg)


Title: Re: "New" fractal type; Mandalay
Post by: cKleinhuis on March 09, 2015, 04:55:36 PM
When rotate this, it looks like garbage dump  :D So there is and correct geometry too.
And this is a new script for Fragmentarium in a long time... thank you and DarkBeam )

upd.:
This is from first script:

(https://farm8.staticflickr.com/7601/16141563483_d830d41998_o.jpg) (https://farm8.staticflickr.com/7601/16141563483_d830d41998_o.jpg)

hey cris, this looks just fantastic, i am not aware of you alls latest changes to the rendering scripts, how can i reproduce this ?
...for making an animated version of it :D


Title: Re: "New" fractal type; Mandalay
Post by: DarkBeam on March 09, 2015, 05:14:01 PM
Omg!!! Knighty your version is even better! :o :alien:


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: DarkBeam on March 09, 2015, 08:57:42 PM
Image of the "old" Kifs...

(http://nocache-nocookies.digitalgott.com/gallery/17/4162_09_03_15_8_56_31.jpeg)


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: youhn on March 09, 2015, 10:49:14 PM
 :thumbsup1:


Title: Re: "New" fractal type; Mandalay
Post by: Crist-JRoger on March 10, 2015, 04:36:48 AM
hey cris, this looks just fantastic, i am not aware of you alls latest changes to the rendering scripts, how can i reproduce this ?
...for making an animated version of it :D
script from first post, raytracer last modified, need to enable clouds
#define USE_IQ_CLOUDS
This is environment and geometry preset
Code:
#preset Default
FOV = 0.7
Eye = 1.97922,1.4423,-1.09709
Target = -3.09327,-5.43927,-5.88962
FocalPlane = 0.70006
Aperture = 0.01
InFocusAWidth = 1
ApertureNbrSides = 7 NotLocked
ApertureRot = 0
ApStarShaped = false
Gamma = 0.625
ToneMapping = 5
Exposure = 0.98937
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Bloom = true
BloomIntensity = 1.20588
BloomPow = 4.7059
BloomTaps = 20
Detail = -3.9
DetailAO = -0.37233
FudgeFactor = 1
MaxRaySteps = 736
MaxDistance = 100
Dither = 0.83636
NormalBackStep = 1
AO = 0,0,0,1.11
AoCorrect = 1
Specular = 1.20408
SpecularExp = 286.765
CamLight = 0.701961,0.921569,1,1.6
CamLightMin = 1
Glow = 1,1,1,0
GlowMax = 20
Reflection = 0.27451,0.270588,0.384314
ReflectionsNumber = 0
SpotGlow = true
SpotLight = 1,0.768627,0.501961,1.5517
LightPos = -0.5618,2.3596,3.2584
LightSize = 0.29897
LightFallOff = 0
LightGlowRad = 1.0135
LightGlowExp = 0.73335
HardShadow = 0.98718
ShadowSoft = 0
BaseColor = 1,1,1
OrbitStrength = 0.80822
X = 0.5,0.6,0.6,0.7
Y = 1,0.6,0,0.4
Z = 0.8,0.78,1,0.5
R = 0.4,0.7,1,0.12
BackgroundColor = 0.341176,0.329412,0.423529
GradientBackground = 0
CycleColors = true
Cycles = 2.1
EnableFloor = true
FloorNormal = 0,0,1
FloorHeight = -2.15
FloorColor = 0.223529,0.27451,0.2
HF_Fallof = 2.26342
HF_Const = 0
HF_Intensity = 0.14286
HF_Dir = 0.04854,-0.04854,1
HF_Offset = -0.926
HF_Color = 0.662745,0.8,1,0.64614
HF_Scatter = 5.443
HF_Anisotropy = 0.494118,0.635294,0.662745
HF_FogIter = 16
HF_CastShadow = false
CloudScale = 0.38878
CloudFlatness = 0
CloudTops = 0.03
CloudBase = -8.0542
CloudDensity = 1
CloudRoughness = 0.97516
CloudContrast = 0.625
CloudColor = 0.556863,0.603922,0.690196
SunLightColor = 0.698039,0.556863,0.384314
Iterations = 10
ColorIterations = 6
MinRad2 = 0.12244
Scale = 2.38184
RotVector = 0,0,0.5
RotAngle = 180
Up = -0.210789,-0.44171,0.857353
#endpreset


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: knighty on March 10, 2015, 12:37:11 PM
Image of the "old" Kifs...
Very cool. Which script/parametrs plz.  :spgloomy:

Another script which is more in the spirit of the mandalex:
Code:
#info Pseudo-MandalayBox Distance Estimator.
#define providesInit
#include "DE-Raytracer.frag"
#include "MathUtils.frag"
#group Pseudo_MandalayBox

// Number of iterations.
uniform int Iterations;  slider[0,10,20]

// Scale parameter. A perfect Menger is 3.0
uniform float Scale; slider[-6.0,2,6.00]
uniform bool DoBoxFold; checkbox[false]
uniform vec3 RotVector; slider[(0,0,0),(1,0,0),(1,1,1)]

// Scale parameter. A perfect Menger is 3.0
uniform float RotAngle; slider[0.00,00,360]

uniform vec3 fo; slider[(0.,0,0),(0.5,0.5,0.5),(2.,2.,2.)]
uniform vec3 gh; slider[(0.,0,0),(0.1,0.1,0.1),(2.,2.,2.)]
uniform vec3 gw; slider[(0.,0,0),(0.,0.,0.),(2.,2.,2.)]
uniform bool Serial; checkbox[false]
//Mandelbox's radial fold
uniform float MinRad2;  slider[0,0.25,1.0]
// Julia
uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-4,-4,-4),(1,1,1),(4,4,4)]

mat3 rot;
float sr;
void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
sr = 30.;
}
//DarkBeam's "fold"... reinterpreted... it's more than a fold, much more! Just awesome!
float DBFold(vec3 p, float fo, float g, float w){
if(p.z>p.y) p.yz=p.zy;//Diagonal fold
//Tis is slightly different from the original fold in order to make it continuous in this context
float vx=p.x-2.*fo;
float vy=p.y-4.*fo;
  float v=max(abs(vx+fo)-fo,vy);
float v1=max(vx-g,p.y-w);
v1=max(v1,-abs(p.x));
v=min(v,v1);
return min(v,p.x);
}
//the coordinates are pushed/pulled in parallel
vec3 DBFoldParallel(vec3 p, vec3 fo, vec3 g, vec3 w){
vec3 p1=p;
p.x=DBFold(p1,fo.x,g.x,w.x);
p.y=DBFold(p1.yzx,fo.y,g.y,w.y);
p.z=DBFold(p1.zxy,fo.z,g.z,w.z);
return p;
}
//serial version
vec3 DBFoldSerial(vec3 p, vec3 fo, vec3 g,vec3 w){
p.x=DBFold(p,fo.x,g.x,w.x);
p.y=DBFold(p.yzx,fo.y,g.y,w.y);
p.z=DBFold(p.zxy,fo.z,g.z,w.z);
return p;
}
float DE(vec3 p)
{
vec4 JC=Julia? vec4(JuliaC,0.) : vec4(p,1.);
float r2=dot(p,p);
float dd = 1.;
for(int i = 0; i<Iterations && r2<10000.; i++){

if(DoBoxFold) p = p - clamp(p.xyz, -1.0, 1.0) * 2.0;  // mandelbox's box fold

//Apply pull transformation
vec3 signs=sign(p);//Save the original signs
p=abs(p);
if(Serial) p=DBFoldSerial(p,fo,gh,gw);
else p=DBFoldParallel(p,fo,gh,gw);
p*=signs;//resore signs: this way the mandelbrot set won't extend in negative directions

//Sphere fold
r2=dot(p,p);
float  t = clamp(1./r2, 1., 1./MinRad2);
p*=t; dd*=t;

//Scale and shift
p=p*Scale+JC.xyz; dd=dd*Scale+JC.w;
p=rot*p;

//For coloring and bailout
r2=dot(p,p);
orbitTrap = min(orbitTrap, abs(vec4(p.x,p.y,p.z,r2)));
}
dd=abs(dd);
#if 1
return (sqrt(r2)-sr)/dd;//bounding volume is a sphere
#else
p=abs(p); return (max(p.x,max(p.y,p.z))-sr)/dd;//bounding volume is a cube
#endif
}


#preset Default
FOV = 0.4
Eye = -3.93747,6.81834,-9.853
Target = -0.488534,1.38543,-2.19871
Up = 0.177166,0.852394,0.491972
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -1.77779
FudgeFactor = 1
MaxRaySteps = 56
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,1
Specular = 0.01987
SpecularExp = 69.118
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.7936,-0.77936
CamLight = 1,1,1,0.6171
CamLightMin = 1
Glow = 1,1,1,0
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.65098,0.65098,0.65098
OrbitStrength = 0.34014
X = 0.5,0.6,0.6,0.4625
Y = 1,0.6,0,0.4875
Z = 0.8,0.78,1,0.63126
R = 0.4,0.7,1,-0.2978
BackgroundColor = 0,0,0
GradientBackground = 0.3
CycleColors = false
Cycles = 0.1
EnableFloor = false
FloorNormal = 0,0,1
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 10
Scale = 2
RotVector = 1,0,0
RotAngle = 0
fo = 1.17118,0.2943,1.6096
gh = 1.12994,0.69436,0
gw = 0.,0.,0.
Serial = false
MinRad2 = 0.07524
Julia = false
JuliaC = 1,1,1
DoBoxFold = false
#endpreset


#preset The_town
FOV = 0.56284
Eye = -3.45179,6.37631,2.98642
Target = -0.652397,-2.09871,-1.06227
Up = -0.999959,-0.00821777,-0.0039258
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -1.10789
FudgeFactor = 1
MaxRaySteps = 244
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.89655
Specular = 0.08679
SpecularExp = 16
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.36066,-0.60656
CamLight = 1,1,1,0.69828
CamLightMin = 0.81301
Glow = 1,1,1,0.17808
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.623529,0.623529,0.623529
OrbitStrength = 0.37743
X = 0.5,0.6,0.6,-0.22968
Y = 1,0.6,0,0.44876
Z = 0.8,0.78,1,0.15902
R = 0.4,0.7,1,0.08464
BackgroundColor = 0.596078,0.6,0.513725
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 12
Scale = 3.10832
DoBoxFold = true
RotVector = 1,0,0
RotAngle = 173.102
fo = 0.12,0.42286,0.74286
gh = 0.4273,0.62314,0.5638
gw = 0.,0.,0.
Serial = true
MinRad2 = 0.13794
Julia = true
JuliaC = -1.80488,1.0488,-0.12196
#endpreset

#preset Julia_without_boxfold
FOV = 0.4
Eye = -4.90824,2.53261,-8.51092
Target = 0.0511652,-1.16735,-0.655056
Up = 0.17362,0.915496,0.362937
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -0.5
FudgeFactor = 1
MaxRaySteps = 169
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,1
Specular = 0.01987
SpecularExp = 69.118
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.7936,-0.77936
CamLight = 1,1,1,1.07806
CamLightMin = 0.78445
Glow = 1,1,1,0
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.882353,0.882353,0.882353
OrbitStrength = 0.38776
X = 0.5,0.6,0.6,0.4625
Y = 1,0.6,0,0.4875
Z = 0.8,0.78,1,0.63126
R = 0.4,0.7,1,-0.08464
BackgroundColor = 0,0,0
GradientBackground = 0.3
CycleColors = false
Cycles = 0.1
EnableFloor = false
FloorNormal = 0,0,1
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 10
Scale = 2
DoBoxFold = false
RotVector = 1,0,0
RotAngle = 0
fo = 0.93714,0.40572,1.49714
gh = 1.11864,0.92656,0.77966
gw = 0.,0.,0.
Serial = false
MinRad2 = 0.05298
Julia = true
JuliaC = 0.23172,1,1
#endpreset


#preset Mandelbox
FOV = 0.4
Eye = -5.48673,5.57229,-8.29521
Target = -0.691605,-0.0782387,-1.58117
Up = 0.243612,0.817671,0.521601
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -0.5
FudgeFactor = 1
MaxRaySteps = 56
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,1
Specular = 0.01987
SpecularExp = 69.118
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.7936,-0.77936
CamLight = 1,1,1,0.6171
CamLightMin = 1
Glow = 1,1,1,0
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.65098,0.65098,0.65098
OrbitStrength = 0.14966
X = 0.5,0.6,0.6,0.4625
Y = 1,0.6,0,0.4875
Z = 0.8,0.78,1,0.63126
R = 0.4,0.7,1,-0.2978
BackgroundColor = 0,0,0
GradientBackground = 0.3
CycleColors = false
Cycles = 0.1
EnableFloor = false
FloorNormal = 0,0,1
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 10
Scale = 2
RotVector = 1,0,0
RotAngle = 0
fo = 0,0,0
gh = 0,0,0
gw = 0.,0.,0.
Serial = false
MinRad2 = 0.07524
Julia = false
JuliaC = 0.23172,1,1
DoBoxFold = true
#endpreset


#preset Extrusions
FOV = 0.4
Eye = -7.09247,3.6575,-7.85706
Target = -0.960155,-0.410378,-1.08601
Up = 0.407833,0.818881,0.403865
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -0.88886
FudgeFactor = 1
MaxRaySteps = 56
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,1
Specular = 0.01987
SpecularExp = 34.926
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.7936,-0.77936
CamLight = 1,1,1,0.6171
CamLightMin = 1
Glow = 1,1,1,0
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.65098,0.65098,0.65098
OrbitStrength = 0.14966
X = 0.5,0.6,0.6,0.4625
Y = 1,0.6,0,0.4875
Z = 0.8,0.78,1,0.63126
R = 0.4,0.7,1,-0.2978
BackgroundColor = 0,0,0
GradientBackground = 0.3
CycleColors = false
Cycles = 0.1
EnableFloor = false
FloorNormal = 0,0,1
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 10
Scale = 2
DoBoxFold = false
RotVector = 1,0,0
RotAngle = 0
fo = 0.6967,0,0
gh = 1.11864,0.92656,0.77966
gw = 0.,0.,0.
Serial = false
MinRad2 = 0.07524
Julia = true
JuliaC = 0.23172,1,1
#endpreset


#preset Spaceship
FOV = 0.56284
Eye = -3.61238,0.483741,1.84241
Target = 1.45174,1.93239,-6.42262
Up = -0.915273,-0.286927,-0.282753
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -1.10789
FudgeFactor = 1
MaxRaySteps = 244
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.89655
Specular = 0.08679
SpecularExp = 16
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.36066,-0.60656
CamLight = 1,1,1,0.69828
CamLightMin = 0.81301
Glow = 1,1,1,0.17808
GlowMax = 20
Fog = 0
HardShadow = 1
ShadowSoft = 20
Reflection = 0
DebugSun = false
BaseColor = 0.623529,0.623529,0.623529
OrbitStrength = 0.37743
X = 0.5,0.6,0.6,-0.22968
Y = 1,0.6,0,0.44876
Z = 0.8,0.78,1,0.15902
R = 0.4,0.7,1,0.08464
BackgroundColor = 0.596078,0.6,0.513725
GradientBackground = 0.3
CycleColors = false
Cycles = 7.03846
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 12
DoBoxFold = true
RotVector = 1,0,0
RotAngle = 0
fo = 0.0961,1.28528,0.74286
gh = 0.4273,0.62314,0.5638
gw = 0.,0.,0.
Serial = true
MinRad2 = 0.11258
Julia = true
Scale = -4.92996
JuliaC = -1.6592,1.8392,1.09328
#endpreset


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: DarkBeam on March 10, 2015, 05:58:50 PM
Oh no! Another one...  :o What should I pick! ;)

Oh, yust because you are you;

Mandelbulb3Dv18{
g....kG....9/...w....2....Um98BMoQ4sz8QQEZ5zs60EVpLo4hHTgzfoT4lpOeHkz0jL8UWFP5xj
................................H35kanZMn.2........Y./..................y.2...wD
...Uz6....E1..../Mk//.....Eo1...Y3....E3.....oGdX.x3CUnD/.......mueU/dkpXm1.BnAn
y.EnAngD12../2...................G/k......................U0.....y1...sD...../..
.z1...kDo2l5CTV1swfZmJ3wFNDxv2Oi1IPhoCaDNa7LnK9hXtHlYDEhpGvMyYGTOkw3CUnD7chL7/87
Eq9BFwVnLs.CzsinQBPhoCajU.....22/.............sD.6....sD..G.....................
.............oAnAt1...sD....zw1.........................................a....k1.
.....Ksulz1.......kz.wD...kG..6.0/...M2...EB....m....c3....F....6/...I1.....SF52
...U.46M5pbcatXN./..zTAe906.o6nzzjw3..EbG7eFT5wD6odIWOor/z1............28.kGX81.
.Ub96aAIVz9.Rbdhssszz.........../EU0.wzzz1...........s/...................E.2c..
zzzz.............0...................2./8.kzzzD............8....................
/EU0.wzzz1....................................8cU0.E./2Ezz/cU08../2E.tzDU08c..2E
./IzT/8cU0.E./2EQs5cU08../2E./bTU08c..2E./2ly/8cU0.E./2EMw5cU08../2E.lqTU08c..2E
./2kz/8cU0.E./2E...cU08czz/cU08cyz1cU08cxz3cU08c................................
E....6E.F2......zzzzz1......ZF5Ol.nAm.kPrJaQ..........................k/.MU/4...
...................yz0..................Uz1.....................................
...wz.........zj........kz1.....................................................
.....................2.....3....7....oIMiFKMg3KShgIG4B3.........................
.Q..4MU/.....................Uzj...................sz...........................
..............zD........kz9........wz...........................................
................................}
{Titel: wires modded}

The settings are completely different but it's still full of wires ;)

Scale = -1.5; MinR = 0; Fold = 0.5; ZFold = 1; (Z can be folded indipendently ;) use just zf=nz-zfold ) g = 1, no rotation
Use a Julia seed of...
(0;-5.125;0) ;)


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: knighty on March 11, 2015, 12:04:35 PM
 :thanks1: DB!
I've updated the previous fragmentarium shader.


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: DarkBeam on March 11, 2015, 12:36:49 PM
 :beer: mate!

Also here is the seedup version of my KIFS version, removing some instructions it works faster. They were OK before the octa-fold but it makes them unneeded ;)

Code:
float DE(vec3 pos) {
vec4 p = vec4(pos,1), p0 = p;  // p.w is the distance estimate
       if(Julia) p0.xyz = JuliaC;

for (int i=0; i<Iterations; i++) {
p.xyz*=rot;
             vec3 n = abs(p);
             // Kifs Octahedral fold:
     if(n.y>n.x) n.xy=n.yx;if(n.z>n.y) n.yz=n.zy;if(n.y>n.x) n.xy=n.yx;
             // ABoxKali-like abs folding:
             float fx = -2.*fo+n.x;
             // float fy = -2.*fo+n.y;float fz = -2.*fo+n.z; // unneeded!
             // Edges:
             float xf = (fo-abs(-fo+n.x));
             float yf = (fo-abs(-fo+n.y));
             //float zf = (ztower-abs(-fo+n.z)); // used if ztower > 0
             float zf = ztower+n.z; // used if ztower < 0
             float gy = g+n.y;
             // float gx = g+n.x; float gz = g+n.z; // unneeded!

               if (fx > 0 && fx > n.y ) { // && fx > n.z dropped (speedup) as z<y
                 if (fx > gy ) { // && fx > gz dropped (speedup) as z<y
                  // top:
                  xf += g;
                  yf = (fo-abs(g-fo+n.y));
                  // zf ... unchanged
                 } else {
                  // edges:
                  xf = -n.y;
                  yf = (fo-abs(-3.*fo+n.x));
                  // zf ... unchanged
                 }
       }
             p.x = xf; p.y =yf; p.z = zf;
float r2 = dot(p.xyz, p.xyz);
if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(p.xyz,r2)));
p *= clamp(max(MinRad2/r2, MinRad2), 0.0, 1.0);  // dp3,div,max.sat,mul
p = p*scale + p0;
             if ( r2>1000.0) break;

}
return ((length(p.xyz) - absScalem1) / p.w - AbsScaleRaisedTo1mIters);
}


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: Crist-JRoger on September 14, 2015, 06:37:50 PM
Mandalay Distance Estimator
(http://pre08.deviantart.net/b25c/th/pre/f/2015/240/e/c/above_the_clouds_by_crist_jroger-d97gjzq.jpg) (http://orig06.deviantart.net/3445/f/2015/240/e/c/above_the_clouds_by_crist_jroger-d97gjzq.jpg)


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: Crist-JRoger on November 28, 2015, 07:40:54 AM
playing  with last changes in AO model

(http://pre00.deviantart.net/dbbd/th/pre/f/2015/331/2/7/dwemer_ruins_by_crist_jroger-d9ia2p5.jpg) (http://orig02.deviantart.net/d922/f/2015/331/2/7/dwemer_ruins_by_crist_jroger-d9ia2p5.jpg)


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: 3dickulus on November 28, 2015, 08:07:00 PM
 :o wow! that looks fantastic! can you post the DE frag file? is it DE-Kn2.frag with "return DE(p)*FudgeFactor" and Syntopia's wang_hash_fp function as RNG seed?


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: Crist-JRoger on November 29, 2015, 11:57:26 AM
:o wow! that looks fantastic! can you post the DE frag file? is it DE-Kn2.frag with "return DE(p)*FudgeFactor" and Syntopia's wang_hash_fp function as RNG seed?
Yes. And AO "fix" too  :dink:
I use my own version of DE raytracer based on knighty's mods. I called DE-Kn8 just i like this number and its short title  ;D
Some parameters could be over the sliders limit! So i recomended to use "classic" build of Frag.


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: 3dickulus on November 29, 2015, 08:57:31 PM
ty CJR
 :thumbsup1:


Title: Re: "New" fractal type; Mandalay (in KIFS/ non KIFS versions)
Post by: DaveH on February 01, 2016, 03:38:54 AM
I really, really like these Mandalay images, so I did my own Shadertoy version here:-
https://www.shadertoy.com/view/MdV3Wz (https://www.shadertoy.com/view/MdV3Wz)

I think the formula code has been copied from different sources. I'm not certain though.

Dave H.