// Created: Fri Dec 23 23:05:00 2016
/* A Mandelcup fractal by Pupukuusikko
Result of random tinkering with Tglad's Tetrahedral and Dihedral fold fractals,
introduced in http://www.fractalforums.com/the-3d-mandleblulb/2d-conformal-formula-suggestion/
Script is based on Knighty's tetrahedral implementation with Tglad's DE addition from the same source
*/
#info Mandelbulb Distance Estimator
#define providesInit
//#include "DE-kn2.frag"
#include "DE-Kn2cr11.frag"
#include "MathUtils.frag"
#group Mandelbulb
// Number of fractal iterations.
uniform int Iterations; slider[0,9,100]
// Number of color iterations.
uniform int ColorIterations; slider[0,9,100]
// adjustable parameters,
uniform float c1; slider[-10,0,10]
uniform float c2; slider[-10,2,10]
//uniform float c3; slider[-2,2,10]
uniform float Bailout; slider[0,5,1000]
// just changed sign of the DE
uniform bool InsideDE; checkbox[false]
// for fine tuning the DE
uniform float DEtuner;slider[0,0.5,2]
uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
// abs and rotation included for fun
uniform bool absX; checkbox[false]
uniform bool absY; checkbox[false]
uniform bool absZ; checkbox[false]
uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
uniform float RotAngle; slider[0.00,0,180]
mat3 rot;
uniform float time;
void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle+time*10.0);
}
#define complexMult(a,b) vec2(a.x*b.x - a.y*b.y, a.x*b.y + a.y*b.x)
#define complexMag(z) dot(z,z)
#define complexReciprocal(z) (vec2(z.x , -z.y)/ complexMag(z))
#define complexDivision(a,b) complexMult(a, complexReciprocal(b))
void dihed2(inout vec3 p) {
//modifiying p.z is probably optional
// p.z = p.z*p.z;
//c1 default zero, adjusting is nice for julias
vec2 z = complexDivision(p.xy,vec2(p.z,c1));
// repeat for higher powers
z = complexMult(z,z)*c2;
// from knighty's tetrahedral frag
p=vec3(2.*z.x, 2.*z.y, dot(z,z)-1.)/(dot(z,z)+1.);
}
float DE(vec3 pos) {
vec3 z=pos;
float r;
float dr=1.0;
int i=0;
r=length(z);
while(r<Bailout && (i<Iterations)) {
z=z / r ;
dr = r*2.*dr+1.;
dihed2(z);
z*=rot;
z*=r*r;
if (absX) z.x= abs(z.x);
if (absY) z.y= abs(z.y);
if (absZ) z.z= abs(z.z);
z+=(Julia ? JuliaC : pos);
r=length(z);
if (i<ColorIterations) orbitTrap = min(orbitTrap,(abs(vec4(z.x,z.y,z.z,r*r))));
i++;
}
if (InsideDE)
return -(DEtuner*log(r)*r/dr);
return DEtuner*log(r)*r/dr;
}
#preset MuranoMint
FOV = 0.9782609
Eye = 0.0005362,-0.0034008,-0.409836
Target = 0.0245764,-0.1558707,-9.50692
Up = 1,0.6881455,-0.0072559
Gamma = 1.354816
ToneMapping = 5
Exposure = 0.9043964
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 0.7112376
Detail = -3.782999
FudgeFactor = 1
Dither = 0.4513458
NormalBackStep = 1
CamLight = 1,0.7019608,0.2784314,0.6313559
BaseColor = 1,0.5137255,0.1921569
OrbitStrength = 0.8513324
X = 1,1,1,0.982069
Y = 0.9333333,0.2078431,0.1411765,-0.8772414
Z = 1,0.627451,0.3215686,-0.3517241
R = 0.3607843,0.9490196,1,0.8785369
BackgroundColor = 0.5490196,0.8509804,0.8666667
GradientBackground = 0.1577061
CycleColors = true
Cycles = 20.10605
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 5
ColorIterations = 5
RotVector = 1,1,0.720979
RotAngle = 103.038
Julia = true
JuliaC = -1.427386,-1.363762,-1.466113
c1 = 1.461908
c2 = -9.725463
Bailout = 6.279
InsideDE = false
DEtuner = 0.3321751
absX = true
absY = true
absZ = true
UpLock = false
FocalPlane = 0.2914356
Aperture = 0.002439
InFocusAWidth = 0.8846975
DofCorrect = true
ApertureNbrSides = 7
ApertureRot = 0
ApStarShaped = true
Bloom = false
BloomIntensity = 0.6012793
BloomPow = 1.544944
BloomTaps = 7
BloomStrong = 1.148017
RefineSteps = 16
MaxRaySteps = 1844
MaxDistance = 20
DetailAO = -0.0096819
coneApertureAO = 0.5
maxIterAO = 20
FudgeAO = 1
AO_ambient = 1.838102
AO_camlight = 0.8854749
AO_pointlight = 0.4050456
AoCorrect = 0.009009
Specular = 0.6423156
SpecularExp = 16
AmbiantLight = 1,0.6313725,0.2627451,0.304721
Reflection = 0.5137255,0.5764706,0.6
ReflectionsNumber = 3
SpotGlow = true
SpotLight = 0.745098,0.8784314,1,1.419355
LightPos = -0.0840336,-1.330532,1.246499
LightSize = 0.0752089
LightFallOff = 0.0534083
LightGlowRad = 0.4706299
LightGlowExp = 0.6966054
HardShadow = 0.6175018
ShadowSoft = 0
ShadowBlur = 0.4662447
perf = false
SSS = false
sss1 = 0.1
sss2 = 0.5
HF_Fallof = 1.769501
HF_Const = 0.2311419
HF_Intensity = 0.3895105
HF_Dir = -0.4093407,0.2760989,-0.4107143
HF_Offset = -0.349162
HF_Color = 0.1098039,0.1137255,0.09411765,2.466102
HF_Scatter = 0
HF_Anisotropy = 0,0,0
HF_FogIter = 1
HF_CastShadow = false
EnCloudsDir = false
Clouds_Dir = 0,0,1
CloudScale = 1
CloudFlatness = 0
CloudTops = 1
CloudBase = -1
CloudDensity = 1
CloudRoughness = 1
CloudContrast = 1
CloudColor = 0.65,0.68,0.7
CloudColor2 = 0.07,0.17,0.24
SunLightColor = 0.7,0.5,0.3
Cloudvar1 = 0.99
Cloudvar2 = 1
CloudIter = 5
CloudBgMix = 1
#endpreset