Knighty Menger Sponge basic setup for FragM

  • 2 Replies
  • 163 Views

0 Members and 1 Guest are viewing this topic.

Offline mclarekin

  • *
  • Fractal Frankfurter
  • *
  • Posts: 594
« on: November 18, 2018, 07:15:34 AM »
This is a  basic set up  = rotation, offset, scale, 2nd offset
Code: [Select]
// Menger Sponge formula created by Knighty
// reference http://www.fractalforums.com/ifs-iterated-function-systems/kaleidoscopic-(escape-time-ifs)/
// The distance estimation code was originally devised by Buddhi.
// reference http://www.fractalforums.com/3d-fractal-generation/a-mandelbox-distance-estimate-formula/15/

#info Menger Sponge Distance Estimator.
#include "MathUtils.frag"
#define providesInit
//#define USE_IQ_CLOUDS
//#define KN_VOLUMETRIC
//#define USE_EIFFIE_SHADOW
//#define MULTI_SAMPLE_AO
//uniform float time;
#include "DE-Raytracer.frag"


#group Menger

uniform int maxiter;  slider[0,10,50]
uniform int ColorIterations;  slider[0,3,300]
uniform float bailout; slider[0,16,100]
uniform vec3 Rotation; slider[(-180,-180,-180),(0,0,0),(180,180,180)]
mat3 rot;
uniform vec3 PreOffset; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
uniform float Scale; slider[0.0,3.0,5.0]
uniform vec3 PostOffset; slider[(-2,-2,-2),(0,0,0),(2,2,2)]




void init() {

 rot = rotationMatrixXYZ(Rotation);
}




int i = 0;


float DE(vec3 pos)
{

vec3 z = vec3(pos);
float rr = 0.0;
float Dd = 1.0;

for( i=0; i<maxiter ; i++)

  {
z *= rot;

z += PreOffset;

z = abs(z);
if (z.x - z.y < 0.0) z.xy = z.yx;
if (z.x - z.z < 0.0) z.xz = z.zx;
if (z.y - z.z < 0.0) z.yz = z.zy;

z *= Scale;
Dd *= Scale;

z.x -= 2.0;
z.y -= 2.0;
if (z.z > 1.0) z.z -= 2.0;

z += PostOffset;

rr = dot(z,z);

if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z.xyz,rr)));

if ( rr > bailout)
{
float r = sqrt(rr);
return r / Dd;
}
}
}



#preset std preset
FOV = 0.5062657
Eye = 0,-3,0
Target = 0,0,0
Up = 0,0,1
EquiRectangular = false
AutoFocus = false
FocalPlane = 1
Aperture = 0
Gamma = 2.08335
ToneMapping = 3
Exposure = 0.6522
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
DepthToAlpha = false
ShowDepth = false
DepthMagnitude = 1
Detail = -3.173575
DetailAO = -1.35716
FudgeFactor = 0.4573864
MaxDistance = 1000
MaxRaySteps = 164
Dither = 0
NormalBackStep = 1
AO = 0,0,0,0.85185
Specular = 1
SpecularExp = 16.364
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = 0.63626,0.5
CamLight = 1,1,1,1.53846
CamLightMin = 0.12121
Glow = 1,1,1,0.43836
GlowMax = 52
Fog = 0
HardShadow = 0.35385
ShadowSoft = 12.5806
QualityShadows = false
Reflection = 0
DebugSun = false
BaseColor = 1,1,1
OrbitStrength = 1
X = 1,1,1,0.1851852
Y = 0.345098,0.666667,0,0.02912
Z = 1,0.666667,0,0.6147757
R = 0.0784314,1,0.941176,-0.0194
BackgroundColor = 0.607843,0.866667,0.560784
GradientBackground = 0.3261
CycleColors = false
Cycles = 4.04901
EnableFloor = false NotLocked
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
analytic = false
maxiter = 10
ColorIterations = 3
bailout = 16
PreOffset = 0,0,0
Scale = 3
PostOffset = 0,0,0
#endpreset


Linkback: https://fractalforums.org/fragmentarium/17/knighty-menger-sponge-basic-setup-for-fragm/2322/

Offline Sabine62

  • *
  • Fractal Freak
  • **
  • Posts: 661
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #1 on: November 18, 2018, 08:35:19 AM »
We are swamped with fantastic goodies  :joy: :joy: :joy:
Thank you so very much, mclarekin!  :)
To thine own self be true

Offline timemit

  • *
  • Fractal Friar
  • *
  • Posts: 137
    • timemit@DeiantArt
« Reply #2 on: November 18, 2018, 11:27:00 AM »
Excellent thanks mclarekin..yes so much to explore atm : )


xx
colorTrial Knighty's menger sphere

Started by mclarekin on Fractal Image Gallery

0 Replies
140 Views
Last post February 01, 2018, 08:32:27 AM
by mclarekin
xx
Menger sponge

Started by ArtIco on Fractal Image Gallery

0 Replies
160 Views
Last post December 21, 2017, 11:33:39 AM
by ArtIco
xx
Menger Sponge Tour 2

Started by utak3r on Fractal movie gallery

1 Replies
196 Views
Last post February 22, 2018, 11:37:07 AM
by freakiebeat
xx
inverted Menger Sponge C

Started by mclarekin on Fractal Image Gallery

0 Replies
81 Views
Last post September 26, 2018, 11:22:38 AM
by mclarekin
xx
Menger sponge transformation

Started by Nintendokater on Fractal movie gallery

0 Replies
69 Views
Last post January 27, 2019, 01:59:46 PM
by Nintendokater