DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« on: March 08, 2015, 11:44:06 AM » |
|
This is my attempt to realize a Mandalex without adding any discontinuity! The idea seems simple but it's not. -------------------- The Mandalex has nice "towers", it kind of extrudes Mandelbox adding nice towers at the edges. This is also possible with folding. If you do it carefully, you can even keep axis orthogonal, this is fundamental to keep fractal details. I think I managed ti in 2D, not 100% sure of 3D .......... ....... ...because I made it just following my intuition Master Knighty please take a look!!! This is my Evaldraw 2D script. To visualize the fold change last line to; -xf to see negative x folded, yf or -yf to see y fold. They should be perfectly orthogonal and continuous. (x,y) //press F1 for help //press ALT/ESC for menu double nx = abs(x); double ny = abs(y); double fo = .5; // change!!!! double g = .9; // change!!!! double fx = -2*fo+nx; double fy = -2*fo+ny; double xf = (fo-abs(-fo+nx)); double yf = (fo-abs(-fo+ny)); double gx = g+nx; double gy = g+ny;
if (fx > 0 && fx>ny) { // && fx>nz presumably if (fx>gy) { // square edge: xf += g; // orthogonal axis must stay ortho: yf = (fo-abs(g-fo+ny)); // do similarly zf here... } else { // top: xf = -ny; // orthogonal axis must stay ortho: yf = (fo-abs(-3*fo+nx)); // do similarly zf... } } if (fy > 0 && fy>nx) { // && fy>nz presumably if (fy>gx) { // square edge: yf += g; xf = (fo-abs(g-fo+nx)); // do similarly zf... } else { // top: yf = -nx; // orthogonal axis must stay ortho: xf = (fo-abs(-3*fo+ny)); // do similarly zf... } } -xf This is a Fragmentarium horrible script, it gives nice strange cubes ... Don't know if axis are really ortho. If not ... it's incorrect but don't know how to fix it #info Mandelbox Distance Estimator (Rrrola's version). #define providesInit #include "DE-Raytracer.frag" #include "MathUtils.frag" #group Mandelbox
/* The distance estimator below was originalled devised by Buddhi. This optimized version was created by Rrrola (Jan Kadlec), http://rrrola.wz.cz/
See this thread for more info: http://www.fractalforums.com/3d-fractal-generation/a-mandelbox-distance-estimate-formula/15/ */
// Number of fractal iterations. uniform int Iterations; slider[0,17,300] uniform int ColorIterations; slider[0,3,300]
uniform float MinRad2; slider[0,0.25,2.0]
// Scale parameter. A perfect Menger is 3.0 uniform float Scale; slider[-3.0,3.0,5.0] vec4 scale = vec4(Scale, Scale, Scale, abs(Scale)) / MinRad2;
// precomputed constants
uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
// Scale parameter. A perfect Menger is 3.0 uniform float RotAngle; slider[0.00,0,180]
mat3 rot;
void init() { rot = rotationMatrix3(normalize(RotVector), RotAngle); }
float absScalem1 = abs(Scale - 1.0); float AbsScaleRaisedTo1mIters = pow(abs(Scale), float(1-Iterations));
// Compute the distance from `pos` to the Mandelbox. float DE(vec3 pos) { vec4 p = vec4(pos,1), p0 = p; // p.w is the distance estimate p0 =vec4 (1.,-1.,1.,1.); // Julia mode for dummies ^_________^ for (int i=0; i<Iterations; i++) { p.xyz*=rot; float nx = abs(p.x); float ny = abs(p.y); float nz = abs(p.z); float fo = .5; float g = .9; float fx = -2.*fo+nx; float fy = -2.*fo+ny; float fz = -2.*fo+nz; float xf = (fo-abs(-fo+nx)); float yf = (fo-abs(-fo+ny)); float zf = (fo-abs(-fo+nz)); float gx = g+nx; float gy = g+ny; float gz = g+nz;
if (fx > 0 && fx>ny&& fx>nz) { if (fx>gy&& fx>gz) { // square edge: xf += g; // orthogonal axis must stay ortho: yf = (fo-abs(g-fo+ny)); zf = (fo-abs(g-fo+nz)); } else { // top: xf = -max(ny,nz); // orthogonal axis must stay ortho: yf = (fo-abs(-3.*fo+max(nx,nz))); zf = (fo-abs(-3.*fo+max(ny,nx))); } } if (fy > 0 && fy>nx&& fy>nz) { if (fy>gx&& fy>gz) { // square edge: yf += g; // orthogonal axis must stay ortho: xf = (fo-abs(g-fo+nx)); zf = (fo-abs(g-fo+nz)); } else { // top: yf = -max(nx,nz); // orthogonal axis must stay ortho: xf = (fo-abs(-3.*fo+max(ny,nz))); zf = (fo-abs(-3.*fo+max(ny,nx))); } } if (fz > 0 && fz>nx&& fz>ny) { if (fz>gx&& fz>gy) { // square edge: zf += g; // orthogonal axis must stay ortho: xf = (fo-abs(g-fo+nx)); zf = (fo-abs(g-fo+nz)); } else { // top: zf = -max(ny,nx); // orthogonal axis must stay ortho: xf = (fo-abs(-3.*fo+max(ny,nz))); yf = (fo-abs(-3.*fo+max(nx,nz))); } } p.x = xf; p.y =yf; p.z = zf; float r2 = dot(p.xyz, p.xyz); if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(p.xyz,r2))); p *= clamp(max(MinRad2/r2, MinRad2), 0.0, 1.0); // dp3,div,max.sat,mul p = p*scale + p0; if ( r2>1000.0) break; } return ((length(p.xyz) - absScalem1) / p.w - AbsScaleRaisedTo1mIters); }
#preset Inside 1 FOV = 0.62536 Eye = -1.16945,-1.12305,-2.79412 Target = 6.16354,-1.00522,-2.00173 Up = -0.619851,-0.17831,0.764193 Detail = -3.09736 DetailAO = -0.28574 FudgeFactor = 0.81928 MaxRaySteps = 220 Dither = 0.5 AO = 0,0,0,0.7 Specular = 2.4348 SpecularExp = 16 SpotLight = 1,1,1,0.73563 SpotLightDir = -0.52,0.1 CamLight = 1,1,1,1.15384 CamLightMin = 0.15151 Glow = 0.0941176,0.341176,0.87451,0.31507 Fog = 0.5 HardShadow = 0 Reflection = 0 BaseColor = 1,1,1 OrbitStrength = 0.5625 X = 0.411765,0.6,0.560784,-0.21312 Y = 0.666667,0.666667,0.498039,0.86886 Z = 0.666667,0.333333,1,-0.18032 R = 0.4,0.7,1,0.31372 BackgroundColor = 0.6,0.6,0.45 GradientBackground = 0.3 CycleColors = false Cycles = 7.03846 FloorNormal = 0,0,0 FloorHeight = 0 FloorColor = 1,1,1 Iterations = 10 ColorIterations = 2 MinRad2 = 0.25 Scale = 2.39128 RotVector = 1,1,1 RotAngle = 0 #endpreset
#preset Other FOV = 0.4 Eye = 0.136312,-0.357184,2.20031 Target = -2.1701,4.89792,-1.82586 Up = -0.314748,0.483089,0.817043 AntiAlias = 1 Detail = -2.97353 DetailAO = -0.21074 FudgeFactor = 1 MaxRaySteps = 110 BoundingSphere = 7.5904 Dither = 0.5 AO = 0,0,0,0.7 Specular = 4 SpecularExp = 16 SpotLight = 1,1,1,0.4 SpotLightDir = 0.1,0.1 CamLight = 1,1,1,1 CamLightMin = 0.15151 Glow = 1,1,1,0 Fog = 0.02684 HardShadow = 0.58462 Reflection = 0 BaseColor = 1,1,1 OrbitStrength = 0.8 X = 0.5,0.6,0.6,0.7 Y = 1,0.6,0,0.4 Z = 0.8,0.78,1,0.5 R = 0.4,0.7,1,0.12 BackgroundColor = 0.6,0.6,0.45 GradientBackground = 0.3 CycleColors = false Cycles = 7.03846 FloorNormal = 0,0,0 FloorHeight = 0 FloorColor = 1,1,1 Iterations = 18 ColorIterations = 3 MinRad2 = 0.0172 Scale = -1.49272 RotVector = 1,1,1 RotAngle = 0 #endpreset
#preset Default FOV = 0.56284 Eye = -1.80087,13.736,2.87241 Target = -1.52812,3.93906,2.87915 Up = -0.296524,-0.00759792,0.954991 Detail = -2.35396 DetailAO = -0.28574 FudgeFactor = 1 MaxRaySteps = 105 Dither = 0.5 AO = 0,0,0,0.7 Specular = 4 SpecularExp = 16 SpotLight = 1,1,1,0.4 SpotLightDir = -0.33334,0.1 CamLight = 1,1,1,1 CamLightMin = 0.4697 Glow = 1,1,1,0.17808 Fog = 0 HardShadow = 0 Reflection = 0 BaseColor = 1,1,1 OrbitStrength = 0.8 X = 0.5,0.6,0.6,0.7 Y = 1,0.6,0,0.4 Z = 0.8,0.78,1,0.5 R = 0.4,0.7,1,0.12 BackgroundColor = 0.596078,0.6,0.513725 GradientBackground = 0.3 CycleColors = false Cycles = 7.03846 FloorNormal = 0,0,0 FloorHeight = 0 FloorColor = 1,1,1 Iterations = 12 ColorIterations = 3 MinRad2 = 0.25 Scale = 2.04344 RotVector = 1,1,1 RotAngle = 0 #endpreset
#preset M1 FOV = 0.4 Eye = 3.4315,-5.57625,-2.47321 Target = -1.74219,2.244,1.00192 Up = -0.820324,-0.551717,-0.15059 AntiAlias = 1 Detail = -2.78761 DetailAO = -0.28574 FudgeFactor = 0.916 MaxRaySteps = 112 BoundingSphere = 7.1083 Dither = 0.5 AO = 0,0,0,0.96721 Specular = 1.4167 SpecularExp = 18.8 SpotLight = 1,1,1,0.17391 SpotLightDir = 0.31428,0.1 CamLight = 1,1,1,1.41936 CamLightMin = 0.4697 Glow = 0.835294,0.0784314,0.0784314,0 Fog = 0.45638 HardShadow = 0 Reflection = 0 BaseColor = 1,1,1 OrbitStrength = 0.515 X = 0.6,0.0117647,0.0117647,0.59056 Y = 1,0.6,0,0.44882 Z = 1,1,1,0.49606 R = 0.666667,0.666667,0.498039,0.07936 BackgroundColor = 0.666667,0.666667,0.498039 GradientBackground = 0.3 CycleColors = false Cycles = 7.03846 FloorNormal = 0,0,0 FloorHeight = 0 FloorColor = 1,1,1 Iterations = 17 ColorIterations = 3 MinRad2 = 0.25 Scale = 3 RotVector = 1,1,1 RotAngle = 0 #endpreset
#preset Noname FOV = 0.2439 Eye = -19.9282,-27.7195,21.9276 Target = -14.6946,-21.4244,16.5391 Up = 0.312177,0.454534,0.83422 EquiRectangular = false FocalPlane = 1 Aperture = 0 Gamma = 2.4074 ToneMapping = 5 Exposure = 1 Brightness = 1 Contrast = 1 Saturation = 1 GaussianWeight = 1 AntiAliasScale = 2 Detail = -3.22126 DetailAO = -0.28574 FudgeFactor = 1 MaxRaySteps = 198 Dither = 0.5 NormalBackStep = 1 AO = 0,0,0,0.7 Specular = 0.30392 SpecularExp = 45.833 SpecularMax = 10 SpotLight = 1,1,1,0.4 SpotLightDir = -0.20988,0.1 CamLight = 1,1,1,1.82608 CamLightMin = 0.4697 Glow = 1,1,1,0 GlowMax = 20 Fog = 0.064 HardShadow = 0.45122 NotLocked ShadowSoft = 6.3292 Reflection = 0 DebugSun = false BaseColor = 1,1,1 OrbitStrength = 0.37662 X = 0.5,0.6,0.6,-0.8835 Y = 1,0.6,0,0.4 Z = 0.8,0.78,1,0.5 R = 0.4,0.7,1,0.12 BackgroundColor = 0.596078,0.6,0.513725 GradientBackground = 0.3 CycleColors = false Cycles = 7.03846 EnableFloor = true NotLocked FloorNormal = 0,0,0.17074 FloorHeight = -6.4 FloorColor = 1,1,1 Iterations = 12 ColorIterations = 3 MinRad2 = 0.25 Scale = 2.04344 RotVector = 1,1,1 RotAngle = 0 #endpreset
|
|
« Last Edit: March 09, 2015, 05:16:44 PM by DarkBeam »
|
Logged
|
No sweat, guardian of wisdom!
|
|
|