De Elf On De FlowerOne more KleinianKleinian3D-LVI colouring
One more Kleinian
Previous Image | Next Image
Description: Kleinian3D by JosLeys and Knighty http://www.fractalforums.com/3d-fractal-generation/an-escape-tim-algorithm-for-kleinian-group-limit-sets/

A little battle between Fudgefactor and MaxRaysteps... Lost it  ::) ;D


Code below only an approximation since standard DE-Kn2cr11.frag's PosLight uniform has a range that is too small to get the light to this place. If comfortable with it, change to
Code: [Select]
uniform vec3 LightPos; slider[(-50,-50,-50),(0,0,0),(50,50,50)]

You will also need to adjust the FocalPlane on the Raytracer-tab

Code: [Select]
#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 license:  Ask Jos Leys ;-)

#define providesColor
//#define USE_IQ_CLOUDS
#define MULTI_SAMPLE_AO
#define KN_VOLUMETRIC
#define USE_EIFFIE_SHADOW
#include "MathUtils.frag"
#include "DE-Kn2cr11.frag"
//#include "DE-Raytracer.frag"




#group Kleinian_test
uniform int Box_Iterations;  slider[1,50,100]
//Trace of the transformation a
uniform float KleinR;  slider[1.8,2.0,2.0]
uniform float KleinI;  slider[-0.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 Coloring
uniform vec3 LVI; slider[(-1,-1,-1),(0,0,0),(1,1,1)]
uniform vec3 LVI2; slider[(-1,-1,-1),(0,0,0),(1,1,1)]
uniform int LightIter; slider[0,1,100]
uniform bool RevertDiv; checkbox[false]
uniform bool AddOrbitStrength; checkbox[false]
vec3 lightold;
vec3 lightnew;

vec3 baseColor(vec3 p, vec3 q){
if (RevertDiv) {q=abs(lightnew/lightold);} else {q=abs(lightold/lightnew);};
q*=(LVI+LVI2);
if (AddOrbitStrength) q+=OrbitStrength;
   return q;
}

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) ;
lightold=z;    
for (int i = 0; i < Box_Iterations ; i++)
{
//if(z.y<0. || z.y>a) break;
if (i<LightIter) {lightold=z;} else {lightold=lightold;};
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)))))
//if  (z.y >= a * 0.5 +  f *(2*a-1.95)/4 * sign(z.x + b * 0.5)* (1. - exp(-(7.2-(1.95-a)*15)* abs(z.x + b * 0.5))))

//a/2+f*ff*(2*a-1.95)/4*(1-1/exp((7.2-(1.95-a)*15)*abs(zx+b/2)))
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 (i<LightIter) {lightnew=z;} else {lightnew=lightnew;};
//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) {
    return JosKleinian(p);
}


































































#preset Default
FOV = 0.6431624
Eye = 10.80619,5.075589,46.04659
Target = 8.879445,5.920539,44.4538
Up = -0.0002798,-0.0013666,-0.0003865
EquiRectangular = false
FocalPlane = 1.252689
Aperture = 0.2667313
InFocusAWidth = 0.9033372
DofCorrect = true
ApertureNbrSides = 7
ApertureRot = 0
ApStarShaped = true
Gamma = 1
ToneMapping = 5
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 0
GaussianWeight = 1
AntiAliasScale = 1
LensFlare = false
FlareIntensity = 0.25
FlareSamples = 8
FlareDispersal = 0.25
FlareHaloWidth = 0.5
FlareDistortion = 1
Bloom = false
BloomIntensity = 0.3511905
BloomPow = 2.536585
BloomTaps = 17
BloomStrong = 3.869694
DepthToAlpha = false
ShowDepth = false
DepthMagnitude = 1
Detail = -3.25
RefineSteps = 4
FudgeFactor = 0.0170261
MaxRaySteps = 7533
MaxDistance = 19
Dither = 0
NormalBackStep = 1
DetailAO = -1.744986
coneApertureAO = 0.4871542
maxIterAO = 11
FudgeAO = 0.2003817
AO_ambient = 0.8665377
AO_camlight = 0.8848015
AO_pointlight = 0.7490272
AoCorrect = 0.1752874
Specular = 0.4657795
SpecularExp = 2.978474
CamLight = 0.9921569,0.9686275,0.8980392,0.7590954
AmbiantLight = 0.6117647,0.7019608,0.8509804,0.0858469
Reflection = 0.8705882,0.8313725,0.7607843
ReflectionsNumber = 3
SpotGlow = true
SpotLight = 1,0.8901961,0.7921569,0.2328289
LightPos = 10.2715,4.75629,42.713
LightSize = 0
LightFallOff = 0
LightGlowRad = 1.4222
LightGlowExp = 2.09901
HardShadow = 0.9607073
ShadowSoft = 0
ShadowBlur = 0
perf = false
SSS = false
sss1 = 0.1049149
sss2 = 0.31569
BaseColor = 0.9921569,0.9921569,0.9921569
OrbitStrength = 0.6393258
X = 1,0.4980392,0.2980392,1
Y = 1,0.4509804,0,1
Z = 0.3803922,0.4470588,0.5176471,1
R = 0.8470588,0.9411765,0.9921569,0.2471042
BackgroundColor = 0.2392157,0.2745098,0.3764706
GradientBackground = 4.714868
CycleColors = true
Cycles = 0.1
EnableFloor = false NotLocked
FloorNormal = 0,0,1
FloorHeight = 0
FloorColor = 1,1,1
HF_Fallof = 0.0005
HF_Const = 0
HF_Intensity = 0.5869565
HF_Dir = 1,1,1
HF_Offset = -0.8086786
HF_Color = 0.2235294,0.2941176,0.3921569,1.112662
HF_Scatter = 1.646943
HF_Anisotropy = 1,0.3333333,0
HF_FogIter = 1
HF_CastShadow = true
EnCloudsDir = true
CloudDir = -0.3385301,0.7104677,-0.363029
CloudScale = 2.029579
CloudFlatness = -0.7757937
CloudTops = 3.581943
CloudBase = 3.660451
CloudDensity = 0.1909449
CloudRoughness = 1.48949
CloudContrast = 7.719123
CloudColor = 0.65,0.68,0.7
CloudColor2 = 0.07,0.17,0.24
SunLightColor = 0.7,0.5,0.3
Cloudvar1 = 1.829126
Cloudvar2 = 15.41699
CloudIter = 5
CloudBgMix = 0.921875
WindDir = 0,0,1
WindSpeed = 1
Box_Iterations = 24
KleinI = 0.0302682
box_size_z = 0.9823702
box_size_x = 0.9941176
Final_Iterations = 19
ShowBalls = true
FourGen = true
Clamp_y = 7.879435
Clamp_DF = 0
KleinR = 1.9489
LVI = 0.1419424,-0.1056564,0.2614728
LVI2 = -0.0590763,0.0397422,-0.7035446
LightIter = 2
RevertDiv = true
AddOrbitStrength = false
#endpreset
 

Stats:
Views: 51
Total Favorities: 1 View Who Favorited
Filesize: 2.72MB
Height: 1080 Width: 1440
Posted by: Sabine62 January 26, 2019, 12:35:07 PM

Rating: ***** by 4 members.
Total Likes: 3

Image Linking Codes
BB Thumbnail Image Code
BB Medium Image Code
Direct Link
0 Members and 1 Guest are viewing this picture.

Comments (4) rss

quaz0r
Strange Attractor
******
Offline Offline

Posts: 97



View Profile
January 26, 2019, 09:43:22 PM
this is a family site!   :o
Sabine62
Fractal Frogurt
******
Offline Offline

Posts: 497


It's just a jump to the left...


View Profile WWW
January 26, 2019, 09:52:47 PM
:)) C:-)
gerson
Strange Attractor
******
Offline Offline

Posts: 82



View Profile
January 28, 2019, 04:53:35 PM
Beautiful one. Thanks for sharing.
Sabine62
Fractal Frogurt
******
Offline Offline

Posts: 497


It's just a jump to the left...


View Profile WWW
January 28, 2019, 08:30:59 PM
Thank you kindly, Gerson!  :)

Return to Gallery


Powered by SMF Gallery Pro