Title: Funball code
Post by: M Benesi on September 10, 2016, 08:03:56 AM
It's also a plane! If you set the RotXYangle=0, it's a plane. RotIter changes the starting iteration of the rotation (which is applied every iteration thereafter). Basically, it's a thin cylinder, copied around a bunch. I think eventually we could try a more complex shape to copy, but until then. Try changing the splitrads around in the presets. You might want to increase the range in the code (of the splitrads) so the sliders don't stop you. I set it low (-20 to 20) because I wanted a bit more control?? hmm... funball.frag: https://drive.google.com/open?id=0B0EcJQ49B_yOMTlBSk0yYVN1am8 I use a modified ray tracer, so you'll have to change the include statement to the name of a raytracer you have, if you don't have this one. #version 120 #info Funball. Benesi. #define providesInit const float pi=2.*1.570796326794897; const float pi2=2.*pi;
#include "MathUtils.frag" // Change the raytracer if you don't have this one!!! // colors are set up for it though... #include "Fast-Raytracer-with-Textures.frag"
float sr32=1.2247448713915890491; uniform float time; float dummy(vec3 p) { p*=time; return time; } const float sr13=sqrt(1./3.); const float sr23=sqrt (2./3.);
// Number of fractal iterations. uniform int Iterations; slider[0,5,100]
//uniform int ColorIterations; slider[0,8,100]
uniform float lengthC; slider[0,10,30] uniform float widthC;slider[-2,0,2]
// NOTE: // going to add a polygon (not polyhedral!) to circle // transform later, for application at some iteration/iterations // it will hopefully... do neat stuff like it did in M3D // Benesi
//uniform int StellIter; slider[0,0,30] //uniform float starangle;slider[-3.1416,0.0,3.1416] //uniform float starangle2;slider[-3.1416,0.00,3.1416]
//set both sides to 3 for a tetra hedron, 4 for a cube, and that's it for the Platonics from this set //uniform float sides;slider[2.0,6.0,15.0] //uniform float sides2;slider[2.0,8.0,15.0] /* vec3 Stellate (inout vec3 z) { float rCyz=abs(atan(z.z,z.y)); float i=1.; while (rCyz>pi/sides && i<sides) {rCyz-=pi2/sides; i++;} rCyz=abs(rCyz); z.yz*=(cos(pi/sides*.5)*cos(rCyz-starangle))/cos(pi/(sides)*.5-starangle); float rCxyz; rCxyz= abs(atan(sqrt(z.y*z.y+z.z*z.z),z.x)); i=1.; while (rCxyz>pi/sides2 && i<sides2) {rCxyz-=pi2/sides2; i++;} rCxyz=abs(rCxyz); z*=(cos(pi/sides2*.5)*cos(rCxyz-starangle2))/cos(pi/(sides2)*.5-starangle2); rCyz= (z.y*z.y)/(z.z*z.z);
if (rCyz<1.) {rCyz=sqrt(rCyz+1.);} else {rCyz=sqrt(1./rCyz+1.);}
rCxyz= (z.y*z.y+z.z*z.z)/(z.x*z.x); if (rCxyz<1.) {rCxyz=sqrt(rCxyz+1.);} else {rCxyz=sqrt(1./rCxyz+1.);} z*=rCxyz; z.yz*=rCyz; return(z);
}
*/
//uniform vec3 RotVector; slider[(-1,-1,-1),(1,1,1),(1,1,1)] //uniform float RotAngle; slider[-360.00,0,360]
uniform float RotXYangle; slider[-360.00,0,360] uniform int RotIter;slider[0,1,99]
//mat3 rot; mat3 rotxy; //mat3 rotinv; void init() { rotxy = rotationMatrix3(vec3(0,0,1), RotXYangle); //rot = rotationMatrix3(normalize(RotVector), RotAngle); //rotinv= rotationMatrix3(normalize(RotVector), -RotAngle); }
uniform int Splits1; slider[1,4,33] uniform int splititer1; slider[0,1,20]
uniform int Splits2; slider[1,4,33] uniform int splititer2; slider[0,1,20]
uniform int Splits3; slider[1,4,33] uniform int splititer3; slider[0,1,20]
uniform int Splits4; slider[1,4,33] uniform int splititer4; slider[0,1,20]
int spliti2=splititer1+splititer2; int spliti3=spliti2+splititer3; int spliti4=spliti3+splititer4;
//increase the limits if you want too..... uniform float Splitrad1; slider[-20,1,20] uniform float Splitrad2; slider[-20,1,20] uniform float Splitrad3; slider[-20,1,20] uniform float Splitrad4; slider[-20,1,20]
float splits=Splits1; float splitrad=Splitrad1;
vec3 split(inout vec3 z) { //int split version!!!!!
float ryz; float ratrack=pi2-pi2/splits; float rotadjust=-pi/splits; float pintrack=pi/splits; float pi2splits=pi2/splits; float i=0.0; float omega=atan(z.z,z.y); if (omega<0.0) {omega+=pi2;}
while (omega>pi2splits && i<floor(splits+1.0)) { i+=1.0; rotadjust+=ratrack; pintrack+=pi2splits; omega-=pi2splits; } z.y-=cos(pintrack)*splitrad; z.z-=sin(pintrack)*splitrad; ryz=sqrt(z.y*z.y+z.z*z.z); omega=atan(z.z,z.y)+rotadjust; z.y=cos(omega)*ryz; z.z=sin(omega)*ryz; return z; }
//#include "FeedBack.frag"
float DE(vec3 z) { int n = 1; int m=n; while (n <= Iterations) { if (n>=RotIter) {z*=rotxy;}
if (m<=splititer1) {splits=Splits1;splitrad=Splitrad1; split(z);} else if (m<spliti2) {splits=Splits2;splitrad=Splitrad2; split(z);} else if (m<spliti3) {splits=Splits3; splitrad=Splitrad3;split(z);} else if (m<spliti4) {splits=Splits4;splitrad=Splitrad4; split(z);} else {split(z);m=0;} m++;
orbitTrap = min(orbitTrap, vec4(abs(z),length(z)));
n++; }
return max(length(z.xz)-widthC,abs(z.y)-lengthC); //yup, it's a cylinder }
#preset Default FOV = 0.4 Eye = 29.14345,-1.519427,-2.139277 Target = 4.300402,0.4048966,-0.2264567 DepthToAlpha = true depthMag = 1 ShowDepth = false AntiAlias = 1 Detail = -2.3 DetailAO = -0.5 FudgeFactor = 1 MaxRaySteps = 110 BoundingSphere = 4 Dither = 0.5 NormalBackStep = 1 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 Glow = 1,1,1,0 GlowMax = 20 Fog = 0 HardShadow = 0 ShadowSoft = 2 Reflection = 0 EnableFloor = false FloorNormal = 0,0,0 FloorHeight = 0 FloorColor = 1,1,1 PalettePercent = 100 BackgroundColor = 0.0627451,0.0627451,0.04313725 GradientBackground = 0.3 pBaseColor = 0,0,0 BaseStrength = 0.3 cSpeed = 13 pOffset = 40.60151 pIntensity = 1.395349 color0 = 0,0.7294118,0.9490196 Sharp0to1 = false Dist0to1 = 1 color1 = 0.01176471,1,0.8862745 Sharp1to2 = false Dist1to2 = 1 color2 = 0.007843137,0.7019608,0.9960784 Sharp2to3 = false Dist2to3 = 1 color3 = 0.1568627,1,0.01176471 Sharp3to0 = false Dist3to0 = 1 orbitStrengthXYZR = 1,1,1,1 BaseColorTex = 1 tex1 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/burning-fire-.jpg tex2 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1005.jpg tex3 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1025.PNG tex4 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1034.jpg SpeedMult = 1 TextureSpeed = 1.216216 intensity = 2.5 orbitTexX = 0,0,0,0.1 orbitTexY = 0,0,0,1 TextureOffset = 76,28 BaseMapType = 0 testA = false tsides = 4 tsides2 = 4 HeightMapType = 0 HeightMap1Tex = 1 HeightIter = 0 HighStrength1 = 1 hTextureOffset1 = 0,0 hTextureSpeed1 = 1 HeightMap2Tex = 1 HeightIter2 = 0 HighStrength2 = 1 hTextureOffset2 = 0,0 hTextureSpeed2 = 1 HeightMap3Tex = 1 HeightIter3 = 0 HighStrength3 = 1 hTextureOffset3 = 0,0 hTextureSpeed3 = 1 HeightAngle3 = 3.14 HeightVector3 = 1,0,0 HeightStart3 = -1 HeightEnd3 = 1 HeightTextSpeed3 = 1 HeightTextIntensity3 = 1 DropOff = 1 cylinder = 0.01,9,0.2 Iterations = 22 ColorIterations = 8 FBTarget = 0,0,0 ApplyOnIteration = 0 FormulaType = 1 ApplicationType = 1 FeedbackRadius = 0.25 FeedbackStrength = 0.2 feednormdist = 0.01 FBRotVector = 0,0,0 FBRotAngle = 0 FeedBackCutOff = 60 MaxFeedbackValue = 10 TargetDepthMult = 0.1 FeedbackVariable1 = 1 FeedbackVariable2 = 1 FeedbackVariable3 = 1 RotVector = 0,0,1 RotAngle = 0 RotIter = 1 Splits1 = 5 splititer1 = 6 Splits2 = 3 splititer2 = 9 Splits3 = 4 splititer3 = 1 Splits4 = 7 splititer4 = 4 rotaddin = 0 Splitrad1 = 1.492537 Splitrad2 = 2.208955 Splitrad3 = 1.492537 Splitrad4 = 1.134328 RotXYangle = 18.60656 Up = -0.058801,-0.9699836,0.2121306 #endpreset
#preset CrazyBall2 FOV = 0.4 Eye = 45.92135,19.41448,-3.782594 Target = 0,0,0 DepthToAlpha = true depthMag = 1 ShowDepth = false AntiAlias = 1 Detail = -2.3 DetailAO = -0.5 FudgeFactor = 1 MaxRaySteps = 110 BoundingSphere = 4 Dither = 0.5 NormalBackStep = 1 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 Glow = 1,1,1,0 GlowMax = 20 Fog = 0 HardShadow = 0 ShadowSoft = 2 Reflection = 0 EnableFloor = false FloorNormal = 0,0,0 FloorHeight = 0 FloorColor = 1,1,1 PalettePercent = 100 BackgroundColor = 0.0627451,0.0627451,0.04313725 GradientBackground = 0.3 pBaseColor = 0,0,0 BaseStrength = 0.3 cSpeed = 13 pOffset = 40.60151 pIntensity = 1.395349 color0 = 0,0.7294118,0.9490196 Sharp0to1 = false Dist0to1 = 1 color1 = 0.01176471,1,0.8862745 Sharp1to2 = false Dist1to2 = 1 color2 = 0.007843137,0.7019608,0.9960784 Sharp2to3 = false Dist2to3 = 1 color3 = 0.1568627,1,0.01176471 Sharp3to0 = false Dist3to0 = 1 orbitStrengthXYZR = 1,1,1,1 BaseColorTex = 1 tex1 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/burning-fire-.jpg tex2 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1005.jpg tex3 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1025.PNG tex4 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1034.jpg SpeedMult = 1 TextureSpeed = 1.216216 intensity = 2.5 orbitTexX = 0,0,0,0.1 orbitTexY = 0,0,0,1 TextureOffset = 76,28 BaseMapType = 0 testA = false tsides = 4 tsides2 = 4 HeightMapType = 0 HeightMap1Tex = 1 HeightIter = 0 HighStrength1 = 1 hTextureOffset1 = 0,0 hTextureSpeed1 = 1 HeightMap2Tex = 1 HeightIter2 = 0 HighStrength2 = 1 hTextureOffset2 = 0,0 hTextureSpeed2 = 1 HeightMap3Tex = 1 HeightIter3 = 0 HighStrength3 = 1 hTextureOffset3 = 0,0 hTextureSpeed3 = 1 HeightAngle3 = 3.14 HeightVector3 = 1,0,0 HeightStart3 = -1 HeightEnd3 = 1 HeightTextSpeed3 = 1 HeightTextIntensity3 = 1 DropOff = 1 cylinder = 0.01,9,0.2 Iterations = 22 ColorIterations = 8 FBTarget = 0,0,0 ApplyOnIteration = 0 FormulaType = 1 ApplicationType = 1 FeedbackRadius = 0.25 FeedbackStrength = 0.2 feednormdist = 0.01 FBRotVector = 0,0,0 FBRotAngle = 0 FeedBackCutOff = 60 MaxFeedbackValue = 10 TargetDepthMult = 0.1 FeedbackVariable1 = 1 FeedbackVariable2 = 1 FeedbackVariable3 = 1 RotVector = 0,0,1 RotAngle = 0 RotIter = 0 Splits1 = 5 splititer1 = 7 Splits2 = 2 splititer2 = 5 Splits3 = 4 splititer3 = 3 Splits4 = 7 splititer4 = 4 rotaddin = 0 Splitrad1 = 6.597015 Splitrad2 = 3.641792 Splitrad3 = -0.2089552 Splitrad4 = 1.850746 RotXYangle = -22.42857 Up = 0.2868111,-0.6445413,0.1737745 #endpreset
#preset SplitPlane FOV = 0.4 Eye = 50,30.75957,-5.800992 Target = 22.36615,15.47297,-3.041924 DepthToAlpha = true depthMag = 1 ShowDepth = false AntiAlias = 1 Detail = -2.3 DetailAO = -0.5 FudgeFactor = 1 MaxRaySteps = 110 BoundingSphere = 4 Dither = 0.5 NormalBackStep = 1 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 Glow = 1,1,1,0 GlowMax = 20 Fog = 0 HardShadow = 0 ShadowSoft = 2 Reflection = 0 EnableFloor = false FloorNormal = 0,0,0 FloorHeight = 0 FloorColor = 1,1,1 PalettePercent = 100 BackgroundColor = 0.0627451,0.0627451,0.04313725 GradientBackground = 0.3 pBaseColor = 0,0,0 BaseStrength = 0.3 cSpeed = 13 pOffset = 40.60151 pIntensity = 1.395349 color0 = 0,0.7294118,0.9490196 Sharp0to1 = false Dist0to1 = 1 color1 = 0.01176471,1,0.8862745 Sharp1to2 = false Dist1to2 = 1 color2 = 0.007843137,0.7019608,0.9960784 Sharp2to3 = false Dist2to3 = 1 color3 = 0.1568627,1,0.01176471 Sharp3to0 = false Dist3to0 = 1 orbitStrengthXYZR = 1,1,1,1 BaseColorTex = 1 tex1 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/burning-fire-.jpg tex2 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1005.jpg tex3 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1025.PNG tex4 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1034.jpg SpeedMult = 1 TextureSpeed = 1.216216 intensity = 2.5 orbitTexX = 0,0,0,0.1 orbitTexY = 0,0,0,1 TextureOffset = 76,28 BaseMapType = 0 testA = false tsides = 4 tsides2 = 4 HeightMapType = 0 HeightMap1Tex = 1 HeightIter = 0 HighStrength1 = 1 hTextureOffset1 = 0,0 hTextureSpeed1 = 1 HeightMap2Tex = 1 HeightIter2 = 0 HighStrength2 = 1 hTextureOffset2 = 0,0 hTextureSpeed2 = 1 HeightMap3Tex = 1 HeightIter3 = 0 HighStrength3 = 1 hTextureOffset3 = 0,0 hTextureSpeed3 = 1 HeightAngle3 = 3.14 HeightVector3 = 1,0,0 HeightStart3 = -1 HeightEnd3 = 1 HeightTextSpeed3 = 1 HeightTextIntensity3 = 1 DropOff = 1 cylinder = 0,9,0.2 Iterations = 23 ColorIterations = 8 FBTarget = 0,0,0 ApplyOnIteration = 0 FormulaType = 1 ApplicationType = 1 FeedbackRadius = 0.25 FeedbackStrength = 0.2 feednormdist = 0.01 FBRotVector = 0,0,0 FBRotAngle = 0 FeedBackCutOff = 60 MaxFeedbackValue = 10 TargetDepthMult = 0.1 FeedbackVariable1 = 1 FeedbackVariable2 = 1 FeedbackVariable3 = 1 RotVector = 0,0,1 RotAngle = 0 RotIter = 0 Splits1 = 5 splititer1 = 7 Splits2 = 2 splititer2 = 5 Splits3 = 4 splititer3 = 3 Splits4 = 7 splititer4 = 4 rotaddin = 0 Splitrad1 = 10 Splitrad2 = 4 Splitrad3 = 4.985075 Splitrad4 = 3.641791 RotXYangle = 0 Up = 0.3494966,-0.6016051,0.1672464 #endpreset
#preset IncreaseSplitrad3 FOV = 0.4 Eye = 50,30.75957,-5.800992 Target = 22.36615,15.47297,-3.041924 DepthToAlpha = true depthMag = 1 ShowDepth = false AntiAlias = 1 Detail = -2.3 DetailAO = -0.5 FudgeFactor = 1 MaxRaySteps = 110 BoundingSphere = 4 Dither = 0.5 NormalBackStep = 1 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 Glow = 1,1,1,0 GlowMax = 20 Fog = 0 HardShadow = 0 ShadowSoft = 2 Reflection = 0 EnableFloor = false FloorNormal = 0,0,0 FloorHeight = 0 FloorColor = 1,1,1 PalettePercent = 100 BackgroundColor = 0.0627451,0.0627451,0.04313725 GradientBackground = 0.3 pBaseColor = 0,0,0 BaseStrength = 0.3 cSpeed = 13 pOffset = 40.60151 pIntensity = 1.395349 color0 = 0,0.7294118,0.9490196 Sharp0to1 = false Dist0to1 = 1 color1 = 0.01176471,1,0.8862745 Sharp1to2 = false Dist1to2 = 1 color2 = 0.007843137,0.7019608,0.9960784 Sharp2to3 = false Dist2to3 = 1 color3 = 0.1568627,1,0.01176471 Sharp3to0 = false Dist3to0 = 1 orbitStrengthXYZR = 1,1,1,1 BaseColorTex = 1 tex1 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/burning-fire-.jpg tex2 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1005.jpg tex3 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1025.PNG tex4 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1034.jpg SpeedMult = 1 TextureSpeed = 1.216216 intensity = 2.5 orbitTexX = 0,0,0,0.1 orbitTexY = 0,0,0,1 TextureOffset = 76,28 BaseMapType = 0 testA = false tsides = 4 tsides2 = 4 HeightMapType = 0 HeightMap1Tex = 1 HeightIter = 0 HighStrength1 = 1 hTextureOffset1 = 0,0 hTextureSpeed1 = 1 HeightMap2Tex = 1 HeightIter2 = 0 HighStrength2 = 1 hTextureOffset2 = 0,0 hTextureSpeed2 = 1 HeightMap3Tex = 1 HeightIter3 = 0 HighStrength3 = 1 hTextureOffset3 = 0,0 hTextureSpeed3 = 1 HeightAngle3 = 3.14 HeightVector3 = 1,0,0 HeightStart3 = -1 HeightEnd3 = 1 HeightTextSpeed3 = 1 HeightTextIntensity3 = 1 DropOff = 1 Iterations = 26 ColorIterations = 8 FBTarget = 0,0,0 ApplyOnIteration = 0 FormulaType = 1 ApplicationType = 1 FeedbackRadius = 0.25 FeedbackStrength = 0.2 feednormdist = 0.01 FBRotVector = 0,0,0 FBRotAngle = 0 FeedBackCutOff = 60 MaxFeedbackValue = 10 TargetDepthMult = 0.1 FeedbackVariable1 = 1 FeedbackVariable2 = 1 FeedbackVariable3 = 1 RotVector = 0,0,1 RotAngle = 0 RotIter = 0 Splits1 = 5 splititer1 = 7 Splits2 = 2 splititer2 = 5 Splits3 = 4 splititer3 = 3 Splits4 = 7 splititer4 = 7 RotXYangle = 0 Splitrad1 = 1.538461 Splitrad2 = -4.615385 Splitrad3 = -10.76923 Splitrad4 = 2.769231 lengthC = 18.34532 widthC = 0 Up = 0.3494966,-0.6016051,0.1672464 #endpreset
#preset Splitrad FOV = 0.4 Eye = 29.14345,-1.519427,-2.139277 Target = 4.300402,0.4048966,-0.2264567 DepthToAlpha = true depthMag = 1 ShowDepth = false AntiAlias = 1 Detail = -2.3 DetailAO = -0.5 FudgeFactor = 1 MaxRaySteps = 110 BoundingSphere = 4 Dither = 0.5 NormalBackStep = 1 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 Glow = 1,1,1,0 GlowMax = 20 Fog = 0 HardShadow = 0 ShadowSoft = 2 Reflection = 0 EnableFloor = false FloorNormal = 0,0,0 FloorHeight = 0 FloorColor = 1,1,1 PalettePercent = 100 BackgroundColor = 0.0627451,0.0627451,0.04313725 GradientBackground = 0.3 pBaseColor = 0,0,0 BaseStrength = 0.3 cSpeed = 13 pOffset = 40.60151 pIntensity = 1.395349 color0 = 0,0.7294118,0.9490196 Sharp0to1 = false Dist0to1 = 1 color1 = 0.01176471,1,0.8862745 Sharp1to2 = false Dist1to2 = 1 color2 = 0.007843137,0.7019608,0.9960784 Sharp2to3 = false Dist2to3 = 1 color3 = 0.1568627,1,0.01176471 Sharp3to0 = false Dist3to0 = 1 orbitStrengthXYZR = 1,1,1,1 BaseColorTex = 1 tex1 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/burning-fire-.jpg tex2 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1005.jpg tex3 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1025.PNG tex4 = C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1034.jpg SpeedMult = 1 TextureSpeed = 1.216216 intensity = 2.5 orbitTexX = 0,0,0,0.1 orbitTexY = 0,0,0,1 TextureOffset = 76,28 BaseMapType = 0 testA = false tsides = 4 tsides2 = 4 HeightMapType = 0 HeightMap1Tex = 1 HeightIter = 0 HighStrength1 = 1 hTextureOffset1 = 0,0 hTextureSpeed1 = 1 HeightMap2Tex = 1 HeightIter2 = 0 HighStrength2 = 1 hTextureOffset2 = 0,0 hTextureSpeed2 = 1 HeightMap3Tex = 1 HeightIter3 = 0 HighStrength3 = 1 hTextureOffset3 = 0,0 hTextureSpeed3 = 1 HeightAngle3 = 3.14 HeightVector3 = 1,0,0 HeightStart3 = -1 HeightEnd3 = 1 HeightTextSpeed3 = 1 HeightTextIntensity3 = 1 DropOff = 1 Iterations = 22 ColorIterations = 8 FBTarget = 0,0,0 ApplyOnIteration = 0 FormulaType = 1 ApplicationType = 1 FeedbackRadius = 0.25 FeedbackStrength = 0.2 feednormdist = 0.01 FBRotVector = 0,0,0 FBRotAngle = 0 FeedBackCutOff = 60 MaxFeedbackValue = 10 TargetDepthMult = 0.1 FeedbackVariable1 = 1 FeedbackVariable2 = 1 FeedbackVariable3 = 1 RotVector = 0,0,1 RotAngle = 0 RotIter = 1 Splits1 = 5 splititer1 = 6 Splits2 = 3 splititer2 = 9 Splits3 = 4 splititer3 = 1 Splits4 = 7 splititer4 = 4 RotXYangle = 18.60656 lengthC = 25.46763 widthC = 0 Splitrad1 = 6.153846 Splitrad2 = 37.69231 Splitrad3 = 43.84615 Splitrad4 = 11.53846 Up = -0.058801,-0.9699836,0.2121306 #endpreset
#preset KeyFrame.001 FOV = 0.4 Eye = -2.541803,-0.5598441,-1.38403 Target = 3.193846,1.186106,2.229 Up = -0.184223,0.9671923,-0.1749312 #endpreset
#preset KeyFrame.002 FOV = 0.4 Eye = -2.070433,-0.1533558,0.1076616 Target = 4.476472,1.692714,-1.544623 Up = -0.3142836,0.9255353,-0.2112114 #endpreset
Title: Re: Funball code
Post by: Sabine on September 11, 2016, 11:35:25 AM
Lots of fun there! Had to resort to fast-raytracer though, as the one with textures wouldn't let the whole thing compile:
Could not create fragment shader: 0(465) : error C7565: assignment to varying 'orbitTrap' Failed to compile script (63 ms).
But fun forms, even a 'ball within ball' (lower middle)
(http://orig00.deviantart.net/a1d4/f/2016/255/e/8/contactsheet_by_sabine62-dahdaoy.jpg)
Thanks a lot, Matt! :)
Title: Re: Funball code
Post by: 3dickulus on September 11, 2016, 05:27:01 PM
O0 :beer:
Title: Re: Funball code
Post by: M Benesi on September 11, 2016, 07:06:24 PM
Lots of fun there! Had to resort to fast-raytracer though, as the one with textures wouldn't let the whole thing compile:
Could not create fragment shader: 0(465) : error C7565: assignment to varying 'orbitTrap' Failed to compile script (63 ms).
3Dickulus told me a solution to that problem, and it apparently didn't propagate to my local files either (I remember trying it... but I don't know why it isn't in my code???). I'm using the palette anyway. Maybe make a palette only raytracer, and one with less palette options. I've got to come up with an interesting coloring scheme anyway (by iteration of split, by location in split, etc.). Change C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/original.jpg to ./ or something? uniform sampler2D tex1; file[C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/original.jpg] uniform sampler2D tex2; file[C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1005.jpg] uniform sampler2D tex3; file[C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1025.PNG] uniform sampler2D tex4; file[C:/Users/MBenesi/Desktop/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/maps/1034.jpg]
Here is a quick youtube video (don't watch if epileptic): https://www.youtube.com/watch?v=A5zjoyMu1uE&feature=youtu.be (https://www.youtube.com/watch?v=A5zjoyMu1uE&feature=youtu.be)
Title: Re: Funball code
Post by: 3dickulus on September 11, 2016, 08:41:44 PM
nice work MB , that is definitely a fun ball!
suggestions...
1) if the texture files are in the Examples/Include folder you can just use the filename without the full path, planning to add an option in preferences dialog for a user defined path for textures 2) when distributing a frag that uses textures set them up to use the ones that come with Fragmentarium or include the files in the frag zip, again, if the texture files are in the Examples/Include folder they will automagically show up in the sampler widget pulldown list ;) 3) sorry I don't recall the fix for error C7565: assignment to varying 'orbitTrap' but maybe 'varying' is the problem? 4) nah, that's all I got
Title: Re: Funball code
Post by: M Benesi on September 11, 2016, 09:51:00 PM
https://www.youtube.com/watch?edit=vd&v=4pHSJ-KaFCM (https://www.youtube.com/watch?edit=vd&v=4pHSJ-KaFCM)
With colors. Working on palette only (no textures) fast raytracer for some coloring.
Maybe try this frag (it writes to the orbitTrap variable- use the z and w for the most symmetric coloring) it with some version of knighty's ray tracers with palettes, for the cool effects?
Title: Re: Funball code
Post by: Sabine on September 11, 2016, 10:40:40 PM
Matt, had a go at things, (no programmer, me, so monkey, keyboard, you probably get the idea :crazyeyes:, praise to the frag gods for the debug dump ;} ) and the culprit is this bit
else if (MapType==1) { polymaptexture2(orbitTrap.xyz,angles); orbittotal=textoff+angles*texturespeed; //color = texture2D(tex,textoff+angles*texturespeed)*intensity;
Tore it out and I am now funballing in full technicolor ;)
Title: Re: Funball code
Post by: M Benesi on September 12, 2016, 01:12:29 AM
Awesome... I updated the raytracer (in the following link) and made a frag called funballcolors too...
Put the raytracer in the include directory if you want to use it. Color set up? doy... I didn't set them up in the presets. Although apparently the "anim" in funball with colors does the color thing?? hmm..
Textures are out of the raytracer. Compiles a million times faster!
https://drive.google.com/open?id=0B0EcJQ49B_yOeUMwTkZwN29KM2c
Title: Re: Funball code
Post by: Sabine on September 12, 2016, 09:35:29 AM
Perfect, works like a charm and indeed: compiles twice as fast or even faster than my attempt too! Thank you, Matt! :) Also for the funballcolors:)
Title: Re: Funball code
Post by: M Benesi on September 18, 2016, 06:16:22 AM
Quick post. I added accordion code and now it makes magic carpets. I suppose this stuff is where Persian rugs came from. Funballwithaccordion in the following directory. Also, try the MengerWithSplits- it makes Menger planets...
Anyway, I also made some incomplete Mandelbulb3d multi split functions (called ~~integersplit/ ~~integersplit3d), but don't have time to fix them up before I don't have access to the intertubes. They are in the following directory as well:
https://drive.google.com/open?id=0B0EcJQ49B_yOeUMwTkZwN29KM2c
Code is even more half baked then usual. Timelines being what they are, I've got to get some sleep before my long journey.
(https://lh3.googleusercontent.com/Fl31McUfALmgkXqifJ5JjDwCZ_7Lme1egKoY5IhEt35EvFvfTsQ49bJakC-97Tj2FMSTcHcCURJIig=w800-h600-no)
(https://lh3.googleusercontent.com/Nq4X-eic70kYbkORW63TDyNEOQWzJogzz566AjqhfvJSthPOPR4sUyWAdoNxC4lZryaEc9RKl1jSUw=w800-h600-no)
(https://lh3.googleusercontent.com/cazJ79ws1GAeQsjz1zmjtfZ1sCfZ_k0BTLNov5JPUkAInmB75D5TMyWHKEaPKJsdzm40dKRVKVSmRA=w800-h600-no)
(https://lh3.googleusercontent.com/I7cyji3hd8ETR1AyMZ1iAohzyqv37mHIglqSOk1vx2HG0RGKmMJ_O_0hfMd_S02n3t-OKx65xyI42A=w800-h600-no)
Have fun!
Title: Re: Funball code
Post by: Sabine on September 18, 2016, 12:37:53 PM
Will have look at it;) Thanks again, Matt!
Title: Re: Funball code
Post by: Tim Emit on September 19, 2016, 10:36:48 AM
Thanks Matt : )
Title: Re: Funball code
Post by: M Benesi on October 06, 2016, 01:36:45 AM
So... it evolves. Using a solid object instead of a tube seems to work a bit better. Also added "AdjustScale" to zoom in and out. Not a fractal... :D #version 120 #info Funball. Benesi. #define providesInit const float pi=2.*1.570796326794897; const float pi2=2.*pi;
//#include "FeedBack.frag" #include "MathUtils.frag" // Change the raytracer if you don't have this one!!! // colors are set up for it though... //#include "Fast-Raytracer-with-Textures.frag" #include "Fast-Raytracer-with-Palette.frag"
float sr32=1.2247448713915890491; uniform float time; float dummy(vec3 p) { p*=time; return time; } const float sr13=sqrt(1./3.); const float sr23=sqrt (2./3.);
// Number of fractal iterations. uniform int Iterations; slider[0,5,100]
//uniform int ColorIterations; slider[0,8,100]
uniform float lengthC; slider[0,10,30] uniform float widthC;slider[-2,0,2] uniform float ScaleAdjust;slider[-2,1,2]
// NOTE: // going to add a polygon (not polyhedral!) to circle // transform later, for application at some iteration/iterations // it will hopefully... do neat stuff like it did in M3D // Benesi
//uniform int StellIter; slider[0,0,30] //uniform float starangle;slider[-3.1416,0.0,3.1416] //uniform float starangle2;slider[-3.1416,0.00,3.1416]
//set both sides to 3 for a tetra hedron, 4 for a cube, and that's it for the Platonics from this set //uniform float sides;slider[2.0,6.0,15.0] //uniform float sides2;slider[2.0,8.0,15.0] /* vec3 Stellate (inout vec3 z) { float rCyz=abs(atan(z.z,z.y)); float i=1.; while (rCyz>pi/sides && i<sides) {rCyz-=pi2/sides; i++;} rCyz=abs(rCyz); z.yz*=(cos(pi/sides*.5)*cos(rCyz-starangle))/cos(pi/(sides)*.5-starangle); float rCxyz; rCxyz= abs(atan(sqrt(z.y*z.y+z.z*z.z),z.x)); i=1.; while (rCxyz>pi/sides2 && i<sides2) {rCxyz-=pi2/sides2; i++;} rCxyz=abs(rCxyz); z*=(cos(pi/sides2*.5)*cos(rCxyz-starangle2))/cos(pi/(sides2)*.5-starangle2); rCyz= (z.y*z.y)/(z.z*z.z);
if (rCyz<1.) {rCyz=sqrt(rCyz+1.);} else {rCyz=sqrt(1./rCyz+1.);}
rCxyz= (z.y*z.y+z.z*z.z)/(z.x*z.x); if (rCxyz<1.) {rCxyz=sqrt(rCxyz+1.);} else {rCxyz=sqrt(1./rCxyz+1.);} z*=rCxyz; z.yz*=rCyz; return(z);
}
*/
//uniform vec3 RotVector; slider[(-1,-1,-1),(1,1,1),(1,1,1)] //uniform float RotAngle; slider[-360.00,0,360]
uniform float RotXYangle; slider[-360.00,0,360] uniform int RotIter;slider[0,1,99]
//mat3 rot; mat3 rotxy; //mat3 rotinv; void init() { rotxy = rotationMatrix3(vec3(1,0,0), RotXYangle); //rot = rotationMatrix3(normalize(RotVector), RotAngle); //rotinv= rotationMatrix3(normalize(RotVector), -RotAngle); }
uniform int Splits1; slider[1,4,33] uniform int splititer1; slider[0,1,20]
uniform int Splits2; slider[1,4,33] uniform int splititer2; slider[0,1,20]
uniform int Splits3; slider[1,4,33] uniform int splititer3; slider[0,1,20]
uniform int Splits4; slider[1,4,33] uniform int splititer4; slider[0,1,20]
int spliti2=splititer1+splititer2; int spliti3=spliti2+splititer3; int spliti4=spliti3+splititer4;
//increase the limits if you want too..... uniform float Splitrad1; slider[-20,1,80] uniform float Splitrad2; slider[-20,1,80] uniform float Splitrad3; slider[-20,1,80] uniform float Splitrad4; slider[-20,1,80]
float splits=Splits1; float splitrad=Splitrad1;
#group CarpetExtension
uniform float AccStart1y; slider[-20,-1,20] uniform float AccCycle1y; slider[0.1,.6,30.] uniform float AccEnd1y; slider[-50,-7,50] uniform int AccIter1y; slider[0,0,20] uniform int AccIter2y; slider[0,0,20] uniform float AccStartz; slider[-20,-1,20] uniform float AccCyclez; slider[0.1,.6,30.] uniform float AccEndz; slider[-50,-7,50] uniform bool AccZBool; checkbox[false] float AccStart; float AccCycle; float AccEnd;
float Accordion (inout float zx) { float cycle=abs(AccCycle); if (cycle<.06) {cycle=.06;} float i=0.0; //why did he use a float here? :p float cyclemod= mod(abs(AccEnd-AccStart),AccCycle); if ((cycle)>abs(AccEnd-AccStart)) {cycle=abs(AccEnd-AccStart);} if (AccEnd-AccStart<0.0) { cycle=-cycle; cyclemod=-cyclemod; if (zx>AccStart) { // do nothing } else if (zx<(AccStart+cycle) && zx>(AccEnd-cyclemod)){ zx=zx-AccStart; while (zx<(cycle) && i<3000.0) { zx-=cycle;i+=1.0; } if (zx<(cycle/2.)) { zx=cycle-zx+AccStart; } else {zx+=AccStart;} //done } else if (zx>AccStart+cycle && zx<AccStart) { zx=zx-AccStart; if (zx<cycle/2.) { zx=cycle-zx+AccStart; } else { zx=zx+AccStart; } } else if (zx<(AccEnd- cyclemod) && zx>AccEnd) { zx=AccEnd-zx; if (zx<cyclemod/2.0) { zx=cyclemod-zx+AccStart; } else { zx=zx+AccStart; } } else if (zx<AccEnd) { zx=zx-AccEnd+AccStart; } } else { cycle=abs(cycle); cyclemod=abs(cyclemod); if (zx<AccStart) { // do nothing } else if (zx>(AccStart+cycle) && zx<(AccEnd-cyclemod)){ zx=zx-AccStart; while (zx>(cycle) && i<3000.0) { zx-=cycle;i+=1.0; } if (zx>(cycle/2.)) { zx=cycle-zx+AccStart; } else {zx+=AccStart;} //done } else if (zx<AccStart+cycle && zx>AccStart) { zx=zx-AccStart; if (zx>cycle/2.) { zx=cycle-zx+AccStart; } else { zx=zx+AccStart; } } else if (zx>(AccEnd- cyclemod) && zx<AccEnd) { zx=AccEnd-zx; if (zx>cyclemod/2.0) { zx=cyclemod-zx+AccStart; } else { zx=zx+AccStart; } } else if (zx>AccEnd) { zx=zx-AccEnd+AccStart; } } return zx; }
uniform float AccStartSplit; slider[-20,-1,20] uniform float AccCycleSplit; slider[0.1,.6,10.] uniform float AccEndSplit; slider[-50,-7,50] uniform int AccIterSplit; slider[0,0,20] //uniform float AccStartSplit2; slider[-20,-1,20] //uniform float AccCycleSplit2; slider[0.1,.6,10.] //uniform float AccEndSplit2; slider[-50,-7,50] //uniform int AccIterSplit2; slider[0,0,20] vec3 split(inout vec3 z,inout vec4 ot,in int n) { //int split version!!!!!
float ryz; float ratrack=pi2-pi2/splits; float rotadjust=-pi/splits; float pintrack=pi/splits; float pi2splits=pi2/splits; float i=0.0; float omega=atan(z.z,z.y); if (omega<0.0) {omega+=pi2;}
while (omega>pi2splits && i<floor(splits+1.0)) { i+=1.0; rotadjust+=ratrack; pintrack+=pi2splits; omega-=pi2splits; } z.y-=cos(pintrack)*splitrad; z.z-=sin(pintrack)*splitrad; ot.xy=vec2(min(ot.x,z.y),min(ot.y,z.z)); ryz=sqrt(z.y*z.y+z.z*z.z); if (AccIterSplit==n) { AccStart=AccStartSplit; AccCycle=AccCycleSplit; AccEnd=AccEndSplit; Accordion(ryz); } /* else if (AccIterSplit2==n) { AccStart=AccStartSplit2; AccCycle=AccCycleSplit2; AccEnd=AccEndSplit2; Accordion(ryz); } */ omega=atan(z.z,z.y)+rotadjust; z.y=cos(omega)*ryz; z.z=sin(omega)*ryz; ot.zw=vec2(min(ot.z,z.y),min(ot.w,z.z)); return z; }
//uniform vec3 tester;slider[(-50,-2,-2),(0,0,0),(50,2,2)] //uniform bool testmorph;checkbox[true] //uniform int bailouttype;slider[0,0,10]
float DE(vec3 z) { //orbitTrap=vec4(10.0,10.0,10.0,10.0); int n = 1; int m=n; z*=rotxy; float splitscale=Splitrad1*splititer1+ Splitrad2*splititer2+ Splitrad3*splititer3+ Splitrad4*splititer4; z.yz*=splitscale*ScaleAdjust;
if (AccZBool) { AccStart=AccStartz; AccCycle=AccCyclez; AccEnd=AccEndz; Accordion(z.z);} while (n <= Iterations) { // if (n>=RotIter) {z*=rotxy;} if (n==AccIter1y || n== AccIter2y) { AccStart=AccStart1y; AccCycle=AccCycle1y; AccEnd=AccEnd1y; Accordion(z.y);}
if (m<=splititer1) {splits=Splits1;splitrad=Splitrad1; split(z,orbitTrap,n);} else if (m<spliti2) {splits=Splits2;splitrad=Splitrad2; split(z,orbitTrap,n);} else if (m<spliti3) {splits=Splits3; splitrad=Splitrad3;split(z,orbitTrap,n);} else if (m<spliti4) {splits=Splits4;splitrad=Splitrad4; split(z,orbitTrap,n);} else {split(z,orbitTrap,n);m=0;} m++; //orbitTrap = min(orbitTrap, vec4(abs(z),length(z))); n++; } //return length(z-vec3(widthC,0,widthC))-lengthC; //z=(z)/length(z)*max(length(z.xz)-widthC,abs(z.y)-lengthC); //return length(z); z=abs(z); return max(z.x-widthC,max(z.y-lengthC,z.z-lengthC)); //return max(length(z.xz)-widthC,abs(z.y)-lengthC); //yup, it's a cylinder //return max(length(tester.yz-z.xz)-tester.x,abs(z.y)-lengthC); } #preset Default FOV = 0.4 Eye = 3.290412,0.1255647,0.0502249 Target = 0.2943018,-0.0266986,0.0383124 Up = 0.0377611,-0.762804,0.2527415 DepthToAlpha = true depthMag = 1 ShowDepth = false AntiAlias = 1 Detail = -3 DetailAO = -0.5 FudgeFactor = 0.9 MaxRaySteps = 111 BoundingSphere = 2 Dither = 0.5 NormalBackStep = 1 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 Glow = 1,1,1,0 GlowMax = 20 Fog = 0 HardShadow = 0 ShadowSoft = 2 Reflection = 0 EnableFloor = false FloorNormal = 0,0,0 FloorHeight = 0 FloorColor = 1,1,1 BackgroundColor = 0.0627451,0.0627451,0.04313725 GradientBackground = 0.3 pBaseColor = 0,0,0 BaseStrength = 0.3 cSpeed = 3.478261 pOffset = 100 pIntensity = 2 color0 = 0,0.6941176,0.1372549 Sharp0to1 = false Dist0to1 = 1 color1 = 0.01960784,1,0.9372549 Sharp1to2 = false Dist1to2 = 1.060345 color2 = 0,0.01568627,1 Sharp2to3 = false Dist2to3 = 1 color3 = 0.01568627,0.4039216,0.1137255 Sharp3to0 = false Dist3to0 = 1 orbitStrengthXYZR = 0,0,1,0 Iterations = 30 lengthC = 30 widthC = 2 RotXYangle = 0 RotIter = 9 Splits1 = 3 splititer1 = 4 Splits2 = 3 splititer2 = 2 Splits3 = 5 splititer3 = 4 Splits4 = 4 splititer4 = 7 Splitrad1 = -4.615385 Splitrad2 = 24.23077 Splitrad3 = 26.15385 Splitrad4 = 17.5 AccStart1y = 3.225806 AccCycle1y = 7 AccEnd1y = -8.585858 AccIter1y = 2 AccIter2y = 4 AccStartz = -1 AccCyclez = 3.6 AccEndz = 6 AccZBool = false AccStartSplit = -4 AccCycleSplit = 4.993104 AccEndSplit = -1.648352 AccIterSplit = 0 bailouttype = 1 #endpreset
#preset PaletteSet BackgroundColor = 0.0627451,0.0627451,0.04313725 GradientBackground = 0.3 pBaseColor = 0,0,0 BaseStrength = 0.3 cSpeed = 13 pOffset = 40.60151 pIntensity = 1.395349 color0 = 0.6666667,0,0.9490196 Sharp0to1 = false Dist0to1 = 1 color1 = 0,0.06666667,1 Sharp1to2 = false Dist1to2 = 1.267241 color2 = 0,0.9921569,0.1647059 Sharp2to3 = true Dist2to3 = 1 color3 = 0,0.7843137,1 Sharp3to0 = true Dist3to0 = 1 orbitStrengthXYZR = 0,0,0.4,0.5 #endpreset
#preset KeyFrame.001 FOV = 0.4 Eye = -50,8.982328,-3.998503 FBTarget = 0,0,0 TargetDepthMult = 0.1 Target = -37.19853,6.505407,-2.703831 Up = 0.1347201,0.6621786,-0.0652287 #endpreset
#preset KeyFrame.002 FOV = 0.4 Eye = -50,8.982328,-3.998503 FBTarget = 0,0,0 TargetDepthMult = 0.1 Target = -37.19853,6.505407,-2.703831 Up = 0.1347201,0.6621786,-0.0652287 #endpreset
|