Pseudo Knightyan 190316SpaceballMandelbulbMistreatment
Spaceball
Previous Image | Next Image
Description: Extended dark-beams Mandelbulb3D _Folding2 method to all axes
Also kept the signs of z
The code uses the lens flare https://fractalforums.org/code-snippets-fragments/74/lens-flare-post-effect/2281 so if you want to use it too you must implement it in your buffershader.

Am in some kind of FragM-special effects-mode ::) ;D It will pass...

Code: [Select]

#info Mandelbulb Distance Estimator

#define providesColor

#define providesInit
//#define WANG_HASH
#include "MathUtils.frag"
//#include "DE-Raytracer.frag"
#define USE_IQ_CLOUDS
#define KN_VOLUMETRIC
#define USE_EIFFIE_SHADOW
#define MULTI_SAMPLE_AO
uniform float time;
#include "DE-Kn2cr11.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]

// Mandelbulb exponent (8 is standard)
uniform float Power; slider[0,8,16]

// Bailout radius
uniform float Bailout; slider[0,5,30]

// Alternate is slightly different, but looks more like a Mandelbrot for Power=2
uniform bool AlternateVersion; checkbox[false]

uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
uniform float RotAngle; slider[0.00,0,180]

uniform vec3 Rotation1; slider[(-180,-180,-180),(0,0,0),(180,180,180)]
uniform vec3 Rotation2; slider[(-180,-180,-180),(0,0,0),(180,180,180)]

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

uniform vec3 Fold; slider[(-10,-10,-10),(0,0,0),(10,10,10)]

#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;
}
//uniform float time;
mat3 rot;
void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
}



// This is my power function, based on the standard spherical coordinates as defined here:
// http://en.wikipedia.org/wiki/Spherical_coordinate_system
//
// It seems to be similar to the one Quilez uses:
// http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
//
// Notice the north and south poles are different here.
void powN1(inout vec3 z, float r, inout float dr) {
// extract polar coordinates
float theta = acos(z.z/r);
float phi = atan(z.y,z.x);
dr =  pow( r, Power-1.0)*Power*dr + 1.0;

// scale and rotate the point
float zr = pow( r,Power);
theta = theta*Power;
phi = phi*Power;

// convert back to cartesian coordinates
z = zr*vec3(sin(theta)*cos(phi), sin(phi)*sin(theta), cos(theta));
}

// This is a power function taken from the implementation by Enforcer:
// http://www.fractalforums.com/mandelbulb-implementation/realtime-renderingoptimisations/
//
// I cannot follow its derivation from spherical coordinates,
// but it does give a nice mandelbrot like object for Power=2
void powN2(inout vec3 z, float zr0, inout float dr) {
float zo0 = asin( z.z/zr0 );
float zi0 = atan( z.y,z.x );
float zr = pow( zr0, Power-1.0 );
float zo = zo0 * Power;
float zi = zi0 * Power;
dr = zr*dr*Power + 1.0;
zr *= zr0;
z  = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
}



// Compute the distance from `pos` to the Mandelbox.
float DE(vec3 pos) {
vec3 z=pos;
float r;
float dr=1.0;
int i=0;
r=length(z);
lightold=z;  
vec3 signs;
while(r<Bailout && (i<Iterations)) {
if (i<LightIter) {lightold=z;} else {lightold=lightold;};
if (AlternateVersion) {
powN2(z,r,dr);
} else {
powN1(z,r,dr);
}
signs=sign(z);
z = z+abs(z-2.*Fold)-abs(z-Fold)-Fold; //Based on dark-beams _Folding2
z*=signs;
z+=(Julia ? JuliaC : pos);
r=length(z);
z*=rot;
z.x=sin(z.y);
if (i<LightIter) {lightnew=z;} else {lightnew=lightnew;};
if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z.x,z.y,z.z,r*r)));
i++;
}
// if ((type==1) && r<Bailout) return 0.0;
return 0.5*log(r)*r/dr;
/*
Use this code for some nice intersections (Power=2)
float a =  max(0.5*log(r)*r/dr, abs(pos.y));
float b = 1000;
if (pos.y>0)  b = 0.5*log(r)*r/dr;
return min(min(a, b),
max(0.5*log(r)*r/dr, abs(pos.z)));
*/
}








#preset Default
FOV = 0.6901709
Eye = 2.53478,0.4077418,-0.2618418
Target = -5.970693,-0.9513552,1.821053
Up = -0.1378374,0.9223244,0.038963
EquiRectangular = false
FocalPlane = 1.761062
Aperture = 0.2458778
InFocusAWidth = 0.547756
DofCorrect = true
ApertureNbrSides = 5
ApertureRot = 0
ApStarShaped = true
Gamma = 1
ToneMapping = 1
Exposure = 0.3143813
Brightness = 1
Contrast = 1.272222
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
LensFlare = true
FlareIntensity = 0.6217143
FlareSamples = 8
FlareDispersal = 0.0114286
FlareHaloWidth = 1
FlareDistortion = 0.8509174
Bloom = true
BloomIntensity = 0.2893226
BloomPow = 1.509009
BloomTaps = 11
BloomStrong = 1.065068
DepthToAlpha = false
ShowDepth = false
DepthMagnitude = 1
Detail = -3.5
RefineSteps = 4
FudgeFactor = 1
MaxRaySteps = 477
MaxDistance = 18.53998
Dither = 0
NormalBackStep = 1
DetailAO = -2.230769
coneApertureAO = 0.5
maxIterAO = 19
FudgeAO = 0.2513721
AO_ambient = 1
AO_camlight = 1
AO_pointlight = 1
AoCorrect = 0
Specular = 1.140984
SpecularExp = 211.2994
CamLight = 1,0.9058824,0.8078431,2
AmbiantLight = 0.827451,0.9490196,1,0
Reflection = 0.2431373,0.2431373,0.2431373
ReflectionsNumber = 1
SpotGlow = true
SpotLight = 1,0.9098039,0.7529412,8.521537
LightPos = 1.805869,0.677201,-1.354402
LightSize = 0
LightFallOff = 0.367531
LightGlowRad = 0
LightGlowExp = 0
HardShadow = 1
ShadowSoft = 1.692308
ShadowBlur = 0
perf = false
SSS = false
sss1 = 0.1
sss2 = 0.5
BaseColor = 1,1,1
OrbitStrength = 0.8752809
X = 0.003921569,0.1372549,1,0.7763615
Y = 0.972549,0.3215686,0.01568628,1
Z = 1,0.9686275,0,1
R = 0.7960784,0.5019608,0.3098039,1
BackgroundColor = 0.1098039,0.1254902,0.1294118
GradientBackground = 0.3261
CycleColors = true
Cycles = 3.03911
EnableFloor = true NotLocked
FloorNormal = 0,-1,0
FloorHeight = 1.380471
FloorColor = 1,1,1
HF_Fallof = 0.8634915
HF_Const = 0
HF_Intensity = 0.1991051
HF_Dir = 0,0,1
HF_Offset = -4.665179
HF_Color = 0.2588235,0.2078431,0.1411765,0.2735471
HF_Scatter = 5.522682
HF_Anisotropy = 0.03529412,0.3490196,0.8509804
HF_FogIter = 3
HF_CastShadow = false
EnCloudsDir = true
CloudDir = -0.3385301,0.7104677,-0.363029
CloudScale = 0.3463801
CloudFlatness = -0.0867398
CloudTops = 2.585034
CloudBase = -0.4535147
CloudDensity = 1
CloudRoughness = 1.645875
CloudContrast = 6.526526
CloudColor = 0.65,0.68,0.7
CloudColor2 = 0.07,0.17,0.24
SunLightColor = 0.7,0.5,0.3
Cloudvar1 = 2
Cloudvar2 = 9.334641
CloudIter = 3
CloudBgMix = 1
WindDir = 0,0,1
WindSpeed = 1
Iterations = 12
ColorIterations = 8
Power = 8
Bailout = 5.608407
AlternateVersion = true
RotVector = 1,1,1
RotAngle = 52.21219
Rotation1 = 0,0,0
Rotation2 = 0,0,0
Julia = true
JuliaC = 0.6769231,-0.7868132,-0.6461538
LVI = 0.1611526,0.0309498,0.0074707
LVI2 = -0.1944146,0,0.084855
LightIter = 3
RevertDiv = false
AddOrbitStrength = false
Fold = 7.105263,4.144737,0.4166667
#endpreset


Stats:
Views: 68
Total Favorities: 1 View Who Favorited
Filesize: 3.62MB
Height: 1080 Width: 1920
Posted by: Sabine62 February 22, 2019, 11:17:59 PM

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

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

Comments (2) rss

kohlenstoff
Strange Attractor
******
Offline Offline

Posts: 80



View Profile
February 23, 2019, 02:07:29 AM
These effects look great!
Sabine62
Fractal Freak
**
Offline Offline

Posts: 662


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


View Profile WWW
February 23, 2019, 09:50:16 AM
Thank you, Kohlenstoff!  :joy: I still find it unbelievable that this is what Fragmentarium can produce... To me it looks almost like I took the image for a spin Photoshop, but it's really just what comes out of FragM...

Return to Gallery


Powered by SMF Gallery Pro