Burning NovaMandelbulbAbs(XY) texture colouringMandelbulbAbs(XYZ)
MandelbulbAbs(XY) texture colouring
Previous Image | Next Image
Description:
Code: [Select]
#info Mandelbulb Distance Estimator
#define USE_TERRAIN
//#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;
#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);
//if (AddOrbitStrength) q+=OrbitStrength;
   return q;
}
#include "DE-Kn2ColorandHeightmap.frag"
//#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]







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.267094
Eye = -0.0705702,0.0893492,-3.752456
Target = -0.6257869,-0.3063696,-0.1964222
Up = 0,-1,0
EquiRectangular = false
Gamma = 1
ToneMapping = 5
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 1
LensFlare = false
FlareIntensity = 0.3474286
FlareSamples = 8
FlareDispersal = 0.8468571
FlareHaloWidth = 0.8699655
FlareDistortion = 1.949541
Bloom = false
BloomIntensity = 0
DepthToAlpha = false
Detail = -4
FudgeFactor = 1
MaxDistance = 10
NormalBackStep = 1
Specular = 0.1377049
SpecularExp = 6.779661
CamLight = 1,0.9254902,0.8509804,0.425
Reflection = 0.282353,0.282353,0.282353
ReflectionsNumber = 1
SpotGlow = true
LightSize = 0
LightFallOff = 0.7373168
LightGlowRad = 0
LightGlowExp = 0.0683371
HardShadow = 0.8558659
ShadowSoft = 20
BaseColor = 1,1,1
OrbitStrength = 0.9748858
X = 0.5,0.6,0.6,1
Y = 1,0.6,0,1
Z = 0.8,0.78,1,1
R = 0.4,0.7,1,1
BackgroundColor = 0.7764706,0.945098,0.9960784
GradientBackground = 0.6331361
CycleColors = false
Cycles = 1.060663
EnableFloor = true NotLocked
FloorNormal = 0,0,1
FloorHeight = 0.083612
FloorColor = 1,1,1
HF_Fallof = 0.1
HF_Const = 0
HF_Intensity = 0
HF_Dir = 0,0,1
HF_Offset = 0
HF_Color = 1,1,1,1
HF_Scatter = 0
HF_Anisotropy = 0,0,0
HF_FogIter = 1
HF_CastShadow = false
CloudScale = 1
CloudTops = 1
CloudBase = -0.0907029
CloudDensity = 1
CloudRoughness = 1
CloudContrast = 1
CloudColor = 0.65,0.68,0.7
SunLightColor = 0.7,0.5,0.3
WindDir = 0,0,1
WindSpeed = 1
Iterations = 13
ColorIterations = 9
Power = 2
Bailout = 5
AlternateVersion = true
RotVector = 1,1,1
RotAngle = 0
Julia = false
JuliaC = 0,-0.009,0
LVI = 0.3304442,0.2264355,0.6121343
LVI2 = 0.1,0.9,0.3
LightIter = 13
RevertDiv = false
AddOrbitStrength = false
AutoFocus = false
FocalPlane = 1
Aperture = 0
InFocusAWidth = 0
ApertureNbrSides = 5
ApertureRot = 0
ApStarShaped = false
BloomPow = 2
BloomTaps = 4
DetailAO = -0.5
MaxRaySteps = 271
Dither = 0.5
AO = 0,0,0,1
AoCorrect = 0
CamLightMin = 0
Glow = 1,1,1,0
GlowMax = 34
SpotLight = 1,1,1,2.932417
LightPos = 1.125828,0.3532009,-1.699779
paletteColoring = true
pBaseColor = 0,0,0
BaseStrength = 0.3
cSpeed = 10
pOffset = 0
color0 = 0.95,0.83,0.42
Sharp0to1 = false
Dist0to1 = 1
color1 = 1,0,0.07
Sharp1to2 = false
Dist1to2 = 1
color2 = 0.7,0.7,0.42
Sharp2to3 = false
Dist2to3 = 1
color3 = 1,0.37,0
Sharp3to0 = false
Dist3to0 = 1
orbitStrengthXYZR = 1,1,1,1
ifTexture = true
tex = D:/fractal/Mandelbulb3D/maps/p/32.jpg
TextSpeedMult = 1
TextureSpeed = 2.758621
intensity = 0.9297659
orbitTexX = 0.4394619,-0.0224215,-0.2174888,0
orbitTexY = -0.1569507,-0.0269058,-0.3318386,-0.0022422
TextureOffset = -27.65461,-28.12135
MapType = 6
testA = false
tsides = 2
tsides2 = 2
ThetaSteps = 2
PhiSteps = 2
ConeWidth = 0.01
InteriorIntensity = 0
InteriorWeight = 0.01
PostWeight = 0
PostIntensity = 1.112385
allsample = false
normalColor = false
colorDepth = 0
SampleStepsShort = 1
SampleDepthShort = 0
LongFirst = false
SampleStepsLong = 0
SampleDepthLong = 0
CloudFlatness = 0
AbsX = true
AbsY = true
AbsZ = false
#endpreset



Stats:
Views: 66
Total Favorities: 1 View Who Favorited
Filesize: 2.65MB
Height: 1080 Width: 1920
Posted by: Sabine62 February 11, 2019, 04:41:49 PM

Rating: ***** by 5 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 (4) rss

timemit
Fractal Friar
*
Offline Offline

Posts: 137



View Profile WWW
September 13, 2019, 05:12:30 PM
nice but it just shuts my frag down if I try to run it!
Sabine62
Fractal Freak
**
Offline Offline

Posts: 659


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


View Profile WWW
September 13, 2019, 05:33:28 PM
Thanks a lot Tim! :joy:
And good to see you  :)

Have adjustd the code. Try again?
timemit
Fractal Friar
*
Offline Offline

Posts: 137



View Profile WWW
September 14, 2019, 11:33:04 AM
@Sabine, yes that works nicely now, thanks
It has been a rough year so far, trying to settle down to some Autumnal fractalising before I lose it completely  :))

Great to see so much going on in the snippets threads, lots to catch up on  O0
Sabine62
Fractal Freak
**
Offline Offline

Posts: 659


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


View Profile WWW
September 15, 2019, 10:39:50 AM
Hope you'll sail in less rough seas from now on, Tim!
I am not really here either lately, too much going on outside FF to have room in my brain to play with fractals. Though I really Really miss them ('rehab is futile' for fractal addicts  ;D )
And glad to see the code works! Thanks for letting me know :) :thumbs:

Return to Gallery


Powered by SMF Gallery Pro