News: Did you know ? you can use LaTex inside Postings on fractalforums.com!  ## The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!

At the Sulphur Pool Previous Image | Next Image
Description: Tweak of the inverted Mandalay-box. Credits for the parameters go to
Knighty and 3dickulus

Code:
#version 120
#info MandalayBox Distance Estimator.
#define providesInit
#define KN_VOLUMETRIC
//#define USE_IQ_CLOUDS
#define WANG_HASH
#include \"MathUtils.frag\"
uniform float time;
//#include \"DE-Kn2.frag\"
#include \"DE-Kn2cr11.frag\"
#group 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]

// coordinate to invert to infinity
uniform vec3 InvertC; slider[(-5,-5,-5),(0,0,0),(5,5,5)]

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]
// 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){
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);
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 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;
}

// Roqen\'s domain mashup performs the active c = T(s)
vec3 domainMap(vec3 c)
{
float s = dot(c,c);
return c/s * InvertC;
}

float Coloring(vec3 c)
{
float s = dot(c,c);
c = c/s - InvertC;
return dot(c,c);
}

float DE(vec3 p)
{
vec4 JC=Julia? vec4(JuliaC,0.) : vec4(p,1.);

p = InvertC != vec3(0,0,0) ? domainMap(-p) : p;

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,g);
else p=DBFoldParallel(p,fo,g);
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;

//     p = InvertC ? p+domainMap(-p) :p;

//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.3291139
Eye = 4.511375,2.124659,4.178812
Target = 3.426982,1.560495,3.559321
Up = -0.3895342,-0.2314451,0.8926382
Gamma = 1
ToneMapping = 5
Exposure = 1
Brightness = 1
Contrast = 0.9
Saturation = 1
GaussianWeight = 6
AntiAliasScale = 1.5
DepthToAlpha = true
Detail = -3.813793
FudgeFactor = 0.3088496
MaxRaySteps = 1600
Dither = 1
NormalBackStep = 0 NotLocked
CamLight = 0.9686275,0.8705882,0.6313725,0.0814868
BaseColor = 1,0.9882353,0.9490196
OrbitStrength = 0.7568042
X = 0.7568627,0.9098039,0.9098039,0.1917455
Y = 1,0.9803922,0.8980392,0.5872743
Z = 1,0.5490196,0,0.4307825
R = 0.2666667,0.1843137,0,1
BackgroundColor = 1,0.4705882,0.003921569
CycleColors = true
Cycles = 4.759075
EnableFloor = true NotLocked
FloorNormal = 0,0,1
FloorHeight = 0.8900524
FloorColor = 1,0.6666667,0
AutoFocus = true
FocalPlane = 0.9357407
Aperture = 0
InFocusAWidth = 0.1708408
DofCorrect = false
ApertureNbrSides = 5
ApertureRot = 0
ApStarShaped = true
Bloom = false
BloomIntensity = 0.4535714
BloomPow = 6.007036
BloomTaps = 38
BloomStrong = 1
RefineSteps = 4
MaxDistance = 14.1
DetailAO = -0.797239
coneApertureAO = 0.5
maxIterAO = 20
FudgeAO = 1
AO_ambient = 1.82548
AO_camlight = 1.755477
AO_pointlight = 1.903546
AoCorrect = 1
Specular = 0.3041237
SpecularExp = 16
AmbiantLight = 0.3254902,0.3372549,0.2627451,1.09451
Reflection = 0.3254902,0.2039216,0
ReflectionsNumber = 2
SpotGlow = true
SpotLight = 0.6705882,0.7568627,0.827451,0.6859206
LightPos = -0.28922,0.3418054,3.654689
LightSize = 0.0200174
LightFallOff = 0.1338028
LightGlowExp = 0.9050577
perf = false
SSS = false
sss1 = 0.1
sss2 = 0.5
HF_Fallof = 0.5196453
HF_Const = 0.1267483
HF_Intensity = 0.3250664
HF_Dir = 0,0,1
HF_Offset = -0.1149425
HF_Color = 0.09411765,0.1411765,0.2156863,2.892377
HF_Scatter = 1.352785
HF_Anisotropy = 0,0,0
HF_FogIter = 3
EnCloudsDir = false
Clouds_Dir = 0,0,1
CloudScale = 0.72855 NotLocked
CloudFlatness = 0
CloudTops = 2.258 NotLocked
CloudBase = -1.1476 NotLocked
CloudDensity = 0.34483 NotLocked
CloudRoughness = 0.8421 NotLocked
CloudContrast = 10 NotLocked
CloudColor = 0.65,0.68,0.7 NotLocked
CloudColor2 = 0.07,0.17,0.24
SunLightColor = 0.7,0.5,0.3 NotLocked
Cloudvar1 = 0.99
Cloudvar2 = 1
CloudIter = 5
CloudBgMix = 1
WindDir = 0,0,1
WindSpeed = 1
Iterations = 13
Scale = 2.251291
DoBoxFold = false
RotVector = 1,0,0
RotAngle = 0
InvertC = 5,5,5
fo = 1,1,1
g = 2,2,2
Serial = false
Julia = true
JuliaC = 1.64541,1,1
#endpreset

Stats:
Total Favorities: 0 View Who Favorited
Filesize: 4.75MB
Height: 1080 Width: 1920
Discussion Topic: View Topic
Keywords: Fragmentarium inverted mandalay-box
Posted by: Sabine October 25, 2016, 04:42:34 PM

Rating:     by 3 members.

 The Sacred Pool  Rating:     Filesize: 481.96kBDate: December 16, 2010, 05:49:41 PMComments (1)By: Guest Kleinian pool  Rating:     Filesize: 1.26MBDate: January 18, 2017, 11:03:28 AMComments (0)By: Crist-JRoger