News: Support us via Flattr FLATTR Link  Welcome, Guest. Please login or register. October 05, 2022, 08:35:36 PM 1 Hour 1 Day 1 Week 1 Month Forever Login with username, password and session length

## The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!

Contained Previous Image | Next Image
Description: just mucking about with the super Kleinian frag.. just about to take a look at Aexions latest version what fun
Code:
#info Kleinian groups
#info Original idea and code by Jos Leys (Dec 2016)
#info Some cosmetic modifications by Naït Merzouk Abdelaziz (A.k.a. Knighty)
#info liscence:  Ask Jos Leys ;-)

//#include "IBL-Raytracer.frag"
#include "DE-Kn2cr11.frag"

#group Kleinian_test
uniform int Box_Iterations;  slider[1,50,180]
//Trace of the transformation a
uniform float KleinR;  slider[-0.2,2.0,5.0]
uniform float KleinI;  slider[-1.2,0.0,0.2]
//To really give a kleinian group they must be of the form cos(PI/n) if <1 and any value if >=1
uniform float box_size_z;  slider[0.0,0.5,1.0]
uniform float box_size_x;  slider[0.0,0.5,1.0]
//WIP: Help get better DE?
uniform int Final_Iterations;  slider[0,5,20]
//Want do show the balls
uniform bool ShowBalls; checkbox[true]
//4 generators or 3? apply y translation
uniform bool FourGen; checkbox[false]
//The DE is wilde. It needs some clamping
uniform float Clamp_y;  slider[0.01,1.0,10.0]
uniform float Clamp_DF;    slider[0.0,1.0,10.0]

#group SphInv

//Want do do an inversion
uniform bool DoInversion; checkbox[false]
//Inversion center
uniform vec3 InvCenter; slider[(-1,-1,-1),(0,0,0),(1,1,1)]
uniform float InvRadius;  slider[0.01,1,2]
//Recenter
uniform vec3 ReCenter; slider[(-5,-5,-5),(0,0,0),(5,5,5)]
uniform float DeltaAngle;    slider[0.0,0.0,6.283185307179586476925286766559]
float dot2(vec3 z){ return dot(z,z);}

vec3 wrap(vec3 x, vec3 a, vec3 s){
x -= s;
return (x-a*floor(x/a)) + s;
}

vec2 wrap(vec2 x, vec2 a, vec2 s){
x -= s;
return (x-a*floor(x/a)) + s;
}

void TransA(inout vec3 z, inout float DF, float a, float b){
float iR = 1. / dot2(z);
z *= -iR;
z.x = -b - z.x; z.y = a + z.y;
DF *= iR;//max(1.,iR);
}

void TransAInv(inout vec3 z, inout float DF, float a, float b){
float iR = 1. / dot2(z + vec3(b,-a,0.));
z.x += b; z.y = a - z.y;
z *= iR;
DF *= iR;//max(1.,iR);
}

float  JosKleinian(vec3 z)
{
vec3 lz=z+vec3(1.), llz=z+vec3(-1.);
float DE=1e10;
float DF = 1.0;
float a = KleinR, b = KleinI;
float f = sign(b) ;
for (int i = 0; i < Box_Iterations ; i++)
{
//if(z.y<0. || z.y>a) break;

z.x=z.x+b/a*z.y;
if (FourGen)
z = wrap(z, vec3(2. * box_size_x, a, 2. * box_size_z), vec3(- box_size_x, 0., - box_size_z));
else
z.xz = wrap(z.xz, vec2(2. * box_size_x, 2. * box_size_z), vec2(- box_size_x, - box_size_z));
z.x=z.x-b/a*z.y;

//If above the separation line, rotate by 180° about (-b/2, a/2)
if  (z.y >= a * (0.5 +  f * 0.25 * sign(z.x + b * 0.5)* (1. - exp( - 3.2 * abs(z.x + b * 0.5)))))
z = vec3(-b, a, 0.) - z;//
//z.xy = vec2(-b, a) - z.xy;//

orbitTrap = min(orbitTrap, abs(vec4(z,dot(z,z))));//For colouring

//Apply transformation a
TransA(z, DF, a, b);

//If the iterated points enters a 2-cycle , bail out.
if(dot2(z-llz) < 1e-12) {
#if 0
orbitTrap =vec4(1./float(i),0.,0.,0.);
#endif
break;
}
//Store prévious iterates
llz=lz; lz=z;
}

//WIP: Push the iterated point left or right depending on the sign of KleinI
for (int i=0;i<Final_Iterations;i++){
float y = ShowBalls ? min(z.y, a-z.y) : z.y;
DE=min(DE,min(y,Clamp_y)/max(DF,Clamp_DF));
TransA(z, DF, a, b);
}
float y = ShowBalls ? min(z.y, a-z.y) : z.y;
DE=min(DE,min(y,Clamp_y)/max(DF,Clamp_DF));

return DE;
}

float DE(vec3 p) {
if(DoInversion){

p=p-InvCenter-ReCenter;
float r=length(p);
float r2=r*r;

float an=atan(p.y,p.x)+DeltaAngle;
float ra=sqrt(p.y*p.y+p.x*p.x);
p.x=cos(an)*ra;
p.y=sin(an)*ra;
float de=JosKleinian(p);
return de;
}
else return JosKleinian(p);
}

#preset contained
FOV = 0.4089674
Eye = -1.320812,-7.389851,-4.243041
Target = -1.1801,-5.279903,-2.927399
Up = -0.1569399,0.6203227,-0.9780512
Gamma = 0.7415107
ToneMapping = 5
Exposure = 1.032101
Brightness = 0.9943978
Contrast = 0.9923398
Saturation = 0.9978992
GaussianWeight = 0.9032258
AntiAliasScale = 0.6543385
Detail = -3.70076
FudgeFactor = 0.0649259
Dither = 0.1352657
NormalBackStep = 1
CamLight = 0.8352941,0.5686275,0.4117647,1.733051
BaseColor = 0.0627451,0.07058824,0.09411765
OrbitStrength = 0.7398317
X = 0,1,0.164706,1
Y = 1,0.533333,0,0.5751724
Z = 0.603922,0.164706,0.776471,0.737931
R = 0.4509804,0.6235294,1,0.7087647
BackgroundColor = 0,0,0
CycleColors = true
Cycles = 15.10454
EnableFloor = true
FloorNormal = -0.234102,-0.3612858,-0.85884
FloorHeight = -4.330077
FloorColor = 0.8392157,0.3529412,0.1882353
UpLock = false
FocalPlane = 8.558606
Aperture = 0
InFocusAWidth = 0.2918149
DofCorrect = true
ApertureNbrSides = 5
ApertureRot = 0
ApStarShaped = false
Bloom = true
BloomIntensity = 0.098081
BloomPow = 2.134831
BloomTaps = 6
BloomStrong = 3.825779
RefineSteps = 16
MaxRaySteps = 1588
MaxDistance = 120
DetailAO = -0.0242047
coneApertureAO = 0.5
maxIterAO = 20
FudgeAO = 1
AO_ambient = 2
AO_camlight = 2
AO_pointlight = 1.953749
AoCorrect = 0.3000693
Specular = 0.0317023
SpecularExp = 100
AmbiantLight = 0.3098039,0.4588235,0.4862745,0.9313305
Reflection = 0.1529412,0.1529412,0.1686275
ReflectionsNumber = 2
SpotGlow = true
SpotLight = 0.4509804,0.5058824,0.3921569,6.702509
LightPos = -0.0560224,-3.277311,-7.366947
LightSize = 0
LightFallOff = 0.1321152
LightGlowExp = 0.8769448
perf = false
SSS = true
sss1 = 0.7803706
sss2 = 0.5573095
HF_Fallof = 0.0765117
HF_Const = 0
HF_Intensity = 0.1643357
HF_Dir = -0.2815934,-0.6483516,0.7760989
HF_Offset = -10
HF_Color = 0.5294118,0.6588235,0.9215686,0.4216102
HF_Scatter = 0
HF_Anisotropy = 0,0,0
HF_FogIter = 1
EnCloudsDir = true NotLocked
Clouds_Dir = 0,0,1 NotLocked
CloudScale = 1
CloudFlatness = 0 NotLocked
CloudTops = 1
CloudBase = -1
CloudDensity = 1
CloudRoughness = 1
CloudContrast = 1
CloudColor = 0.65,0.68,0.7
CloudColor2 = 0.07,0.17,0.24 NotLocked
SunLightColor = 0.7,0.5,0.3
Cloudvar1 = 0.99 NotLocked
Cloudvar2 = 1 NotLocked
CloudIter = 5 NotLocked
CloudBgMix = 1 NotLocked
box_size_z = 0.6907575
box_size_x = 0.8317107
Final_Iterations = 20
ShowBalls = true
FourGen = true
Clamp_y = 0.8050519
Clamp_DF = 0.81363
DoInversion = true
InvCenter = -0.9555247,0.0451703,0.0924253
ReCenter = -0.9292649,-0.8252427,0.887656
DeltaAngle = 3.704461
Box_Iterations = 48
KleinI = 0.0010108
KleinR = 1.967444
#endpreset

#preset tears
FOV = 0.5461957
Eye = -1.334604,-5.322946,-4.11239
Target = -1.18777,-3.591508,-2.328249
Up = -0.271562,0.8030165,-0.7569461
Gamma = 0.7415107
ToneMapping = 5
Exposure = 1.032101
Brightness = 0.9943978
Contrast = 0.9923398
Saturation = 0.9978992
GaussianWeight = 0.9032258
AntiAliasScale = 0.6543385
Detail = -3.70076
FudgeFactor = 0.0649259
Dither = 0.1352657
NormalBackStep = 1
CamLight = 0.8352941,0.5686275,0.4117647,1.346045
BaseColor = 0.0627451,0.07058824,0.09411765
OrbitStrength = 0.5673212
X = 0,1,0.164706,1
Y = 1,0.533333,0,0.5751724
Z = 0.603922,0.164706,0.776471,0.737931
R = 0.4509804,0.6235294,1,0.6038647
BackgroundColor = 0,0,0
CycleColors = true
Cycles = 15.39223
EnableFloor = true
FloorNormal = -0.234102,-0.3612858,-0.85884
FloorHeight = -4.330077
FloorColor = 0.8392157,0.3529412,0.1882353
UpLock = false
FocalPlane = 8.558606
Aperture = 0
InFocusAWidth = 0.2918149
DofCorrect = true
ApertureNbrSides = 5
ApertureRot = 0
ApStarShaped = false
Bloom = true
BloomIntensity = 0.098081
BloomPow = 2.134831
BloomTaps = 6
BloomStrong = 3.825779
RefineSteps = 16
MaxRaySteps = 1588
MaxDistance = 120
DetailAO = -0.0242047
coneApertureAO = 0.5
maxIterAO = 20
FudgeAO = 1
AO_ambient = 2
AO_camlight = 2
AO_pointlight = 1.953749
AoCorrect = 0.3000693
Specular = 0.0317023
SpecularExp = 100
AmbiantLight = 0.3098039,0.4588235,0.4862745,1.216023
Reflection = 0.1529412,0.1529412,0.1686275
ReflectionsNumber = 2
SpotGlow = true
SpotLight = 0.4509804,0.5058824,0.3921569,6.702509
LightPos = -0.0560224,-3.277311,-7.366947
LightSize = 0
LightFallOff = 0.1321152
LightGlowExp = 0.8769448
perf = false
SSS = true
sss1 = 0.7803706
sss2 = 0.5573095
HF_Fallof = 0.0765117
HF_Const = 0
HF_Intensity = 0.1643357
HF_Dir = -0.2815934,-0.6483516,0.7760989
HF_Offset = -10
HF_Color = 0.5294118,0.6588235,0.9215686,0.4216102
HF_Scatter = 0
HF_Anisotropy = 0,0,0
HF_FogIter = 1
EnCloudsDir = true NotLocked
Clouds_Dir = 0,0,1 NotLocked
CloudScale = 1
CloudFlatness = 0 NotLocked
CloudTops = 1
CloudBase = -1
CloudDensity = 1
CloudRoughness = 1
CloudContrast = 1
CloudColor = 0.65,0.68,0.7
CloudColor2 = 0.07,0.17,0.24 NotLocked
SunLightColor = 0.7,0.5,0.3
Cloudvar1 = 0.99 NotLocked
Cloudvar2 = 1 NotLocked
CloudIter = 5 NotLocked
CloudBgMix = 1 NotLocked
box_size_z = 0.5489924
box_size_x = 0.8963839
Final_Iterations = 20
ShowBalls = true
FourGen = true
Clamp_y = 0.8050519
Clamp_DF = 0.81363
DoInversion = true
InvCenter = -0.9555247,0.0451703,0.0924253
ReCenter = -0.9292649,-0.8252427,0.887656
DeltaAngle = 3.704461
Box_Iterations = 48
KleinI = 0.0180575
KleinR = 1.966964
#endpreset

#preset dragon
FOV = 1.353261
Eye = -1.678374,-2.270074,-3.424252
Target = -1.53357,-1.894765,-1.497344
Up = -0.9729168,-0.9944652,0.2668077
Gamma = 0.7415107
ToneMapping = 5
Exposure = 1.032101
Brightness = 0.9943978
Contrast = 0.9923398
Saturation = 0.9978992
GaussianWeight = 0.9032258
AntiAliasScale = 0.6543385
Detail = -3.70076
FudgeFactor = 0.0649259
Dither = 0.1352657
NormalBackStep = 1
CamLight = 0.8352941,0.5686275,0.4117647,1.374294
BaseColor = 0.0627451,0.07058824,0.09411765
OrbitStrength = 0.7685835
X = 0,1,0.164706,0.9586207
Y = 1,0.533333,0,0.8068966
Z = 0.603922,0.164706,0.776471,0.6413793
R = 1,0.8235294,0.2862745,0.2850242
BackgroundColor = 0,0,0
CycleColors = true
Cycles = 5.721169
EnableFloor = true
FloorNormal = -0.234102,-0.3612858,-0.85884
FloorHeight = -4.330077
FloorColor = 0.8392157,0.3529412,0.1882353
UpLock = false
FocalPlane = 8.558606
Aperture = 0
InFocusAWidth = 0.2918149
DofCorrect = true
ApertureNbrSides = 5
ApertureRot = 0
ApStarShaped = false
Bloom = true
BloomIntensity = 0.098081
BloomPow = 2.134831
BloomTaps = 6
BloomStrong = 3.825779
RefineSteps = 16
MaxRaySteps = 1588
MaxDistance = 120
DetailAO = -0.0242047
coneApertureAO = 0.5
maxIterAO = 20
FudgeAO = 1
AO_ambient = 2
AO_camlight = 2
AO_pointlight = 1.953749
AoCorrect = 0.3000693
Specular = 0.0317023
SpecularExp = 100
AmbiantLight = 0.3098039,0.4588235,0.4862745,1.107296
Reflection = 0.1529412,0.1529412,0.1686275
ReflectionsNumber = 2
SpotGlow = true
SpotLight = 0.4509804,0.5058824,0.3921569,6.702509
LightPos = 8.347339,-2.759104,-6.106443
LightSize = 0
LightFallOff = 0.0632467
LightGlowExp = 0.6683168
perf = false
SSS = true
sss1 = 0.7803706
sss2 = 0.5573095
HF_Fallof = 0.0765117
HF_Const = 0
HF_Intensity = 0.1643357
HF_Dir = -0.2815934,-0.6483516,0.7760989
HF_Offset = -10
HF_Color = 0.5294118,0.6588235,0.9215686,0.5550847
HF_Scatter = 0
HF_Anisotropy = 0,0,0
HF_FogIter = 1
EnCloudsDir = true NotLocked
Clouds_Dir = 0,0,1 NotLocked
CloudScale = 1
CloudFlatness = 0 NotLocked
CloudTops = 1
CloudBase = -1
CloudDensity = 1
CloudRoughness = 1
CloudContrast = 1
CloudColor = 0.65,0.68,0.7
CloudColor2 = 0.07,0.17,0.24 NotLocked
SunLightColor = 0.7,0.5,0.3
Cloudvar1 = 0.99 NotLocked
Cloudvar2 = 1 NotLocked
CloudIter = 5 NotLocked
CloudBgMix = 1 NotLocked
Box_Iterations = 69
Final_Iterations = 20
ShowBalls = true
FourGen = true
Clamp_y = 0.8050519
Clamp_DF = 0.81363
DoInversion = true
InvCenter = 0.0257123,-0.8540653,-0.0215427
ReCenter = -1.158114,-0.665742,-0.0554785
DeltaAngle = 2.282018
KleinR = 1.860971
KleinI = 0.1339261
box_size_z = 0.7164698
box_size_x = 0.798331
#endpreset

There are a couple of extra presets there

Stats:
Total Favorities: 0 View Who Favorited
Filesize: 575.91kB
Height: 1080 Width: 1920
Discussion Topic: View Topic
Keywords: timemit fragmentarium kleinian jewels ship
Posted by: Tim Emit January 09, 2017, 07:29:49 PM

Rating:     by 3 members.