MandelbulbAbs(XY) texture colouringMandelbulbAbs(XYZ)De Elf On De Flower
MandelbulbAbs(XYZ)
Previous Image | Next Image
Description:
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 bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
uniform bool AbsX; checkbox[false]
uniform bool AbsY; checkbox[false]
uniform bool AbsZ; checkbox[false]




#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;  
while(r<Bailout && (i<Iterations)) {
if (i<LightIter) {lightold=z;} else {lightold=lightold;};
if (AlternateVersion) {
powN2(z,r,dr);
} else {
powN1(z,r,dr);
}
z+=(Julia ? JuliaC : pos);
r=length(z);
z*=rot;
if (AbsX) (z.x=abs(z.x));
if (AbsY) (z.y=abs(z.y));
if (AbsZ) (z.z=abs(z.z));
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.4316239
Eye = -1.722682,-0.0811439,0.1328667
Target = -3.290418,2.430428,-7.658644
Up = 0.0291373,-0.8123196,-0.2677117
EquiRectangular = false
FocalPlane = 1.704576
Aperture = 0
InFocusAWidth = 1
DofCorrect = true
ApertureNbrSides = 5
ApertureRot = 0
ApStarShaped = true
Gamma = 1.08335
ToneMapping = 5
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
LensFlare = false
FlareIntensity = 0.25
FlareSamples = 8
FlareDispersal = 0.25
FlareHaloWidth = 0.5
FlareDistortion = 1
Bloom = false
BloomIntensity = 0
BloomPow = 2
BloomTaps = 4
BloomStrong = 1
DepthToAlpha = false
ShowDepth = false
DepthMagnitude = 1
Detail = -4.5
RefineSteps = 4
FudgeFactor = 1
MaxRaySteps = 500
MaxDistance = 1
Dither = 0
NormalBackStep = 1
DetailAO = -1.807692
coneApertureAO = 0.5
maxIterAO = 46
FudgeAO = 0.3743139
AO_ambient = 0.9810479
AO_camlight = 1.035714
AO_pointlight = 0.9753086
AoCorrect = 0
Specular = 1.6456
SpecularExp = 16.364
CamLight = 1,0.9058824,0.8078431,0.8340909
AmbiantLight = 0.827451,0.9490196,1,0.8027842
Reflection = 0.227451,0.227451,0.227451
ReflectionsNumber = 2
SpotGlow = true
SpotLight = 1,1,1,20
LightPos = -4.147982,-8.183856,-2.690583
LightSize = 0
LightFallOff = 0.1177163
LightGlowRad = 0
LightGlowExp = 0
HardShadow = 1
ShadowSoft = 11.43508
ShadowBlur = 0
perf = true
SSS = true
sss1 = 0.6482085
sss2 = 0.1096634
BaseColor = 1,1,1
OrbitStrength = 0.7640449
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.6705883,0.8235294,0.8313726
GradientBackground = 0.0756694
CycleColors = true
Cycles = 3.03911
EnableFloor = true NotLocked
FloorNormal = 0.0011173,1,-1
FloorHeight = -0.0004259
FloorColor = 0.2078431,0.1960784,0.09411765
HF_Fallof = 0.0005
HF_Const = 0
HF_Intensity = 0.0749441
HF_Dir = 1,1,1
HF_Offset = -2.34375
HF_Color = 0.4627451,0.6196079,0.6745098,1.905682
HF_Scatter = 0.6361607
HF_Anisotropy = 0.8509804,0.3529412,0.01960784
HF_FogIter = 3
HF_CastShadow = false
EnCloudsDir = true
CloudDir = 0,1,0
CloudScale = 0.1
CloudFlatness = 0.2698048
CloudTops = 1.70068
CloudBase = 0.7029478
CloudDensity = 0.3754266
CloudRoughness = 0.7238979
CloudContrast = 0.6689735
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 = 26
ColorIterations = 8
Power = 2
Bailout = 6.279
AlternateVersion = true
RotVector = 1,1,1
RotAngle = 0
Julia = false
JuliaC = 0,0,0
LVI = 1,-0.0651014,-0.1526147
LVI2 = 1,0.0655209,0.0397422
LightIter = 3
RevertDiv = false
AddOrbitStrength = false
AbsX = true
AbsY = true
AbsZ = true
#endpreset

Stats:
Views: 51
Total Favorities: 0 View Who Favorited
Filesize: 2.4MB
Height: 1200 Width: 1200
Posted by: Sabine62 February 11, 2019, 04:38:28 PM

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

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

Comments (3) rss

marcm200
Fractal Flamingo
****
Offline Offline

Posts: 348



View Profile
February 15, 2019, 02:27:37 PM
Perfect shading, looks very professional. How long did it take you to render that image? (Looks to me like a sailing ship has gone too far into the harbour and landed on the pier).
3DickUlus
3f
******
Offline Offline

Posts: 1225



View Profile WWW
February 17, 2019, 10:33:20 AM
Nice! Is it working with Buffalo bulb DeltaDE too ? ;) if not yet then soon I would think  :yes:
Sabine62
Fractal Freak
**
Offline Offline

Posts: 655


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


View Profile WWW
February 17, 2019, 10:57:25 AM
Thanks a lot, @marc200 and @3Dickulus
Rendertime was 4 minutes, and the BuffaloBulb has soo many options  :yes: ;)

Return to Gallery


Powered by SMF Gallery Pro