Logo by Fiery - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. March 28, 2024, 05:32:29 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: 1 [2] 3 4 ... 9   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Implementing MixPinski  (Read 18900 times)
0 Members and 1 Guest are viewing this topic.
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #15 on: November 16, 2016, 09:15:50 AM »

scale change to scaleM

Darkbeam wrote.
Quote
You must convert i to float btw

float Iter = i;  // in openCL I found I didnt need to.

return sqrt(r)*pow(ScaleM,-Iter);

and make sure you have removed the // from:
//uniform float bailout; slider[0,1024,1024
Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #16 on: November 16, 2016, 09:35:20 AM »

@ DarkBeam.  I have booted up Windows to do some openCL testing on the DE calculations, and there  appears to be some difference between the two functions.  I think there is more detail in   pow(scale,-1).  I will have a better look in the future

Code:
DE *= scaleM;
//float Iter = i;
if (r4 > 1024.0f)  // bailout check
{
r = sqrt(r4);// test both ways i.e. sqrt(r4 - (z4.w * z4.w));sqrt(r4);
if( swapDE == 1) // pseudo checkBox
{
dist = (r - tempD) / fabs(DE);  // reducing the effect of r
}
else
{
//float Iter = i;
dist = (r)*pow(scaleM,-i);
}
out.colourIndex = colourMin ;
break;
}

While in Windows I rendered mixPinski4  in  M3D and I am almost certain I am getting a similar but different fractal == mixPinski4_mod1. I think i have less symmetry so I will take another look smiley
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #17 on: November 16, 2016, 11:17:18 AM »

Whoa can you paste your code fully?
I love less symmetric versions kiss
Btw I splitted the topic as Mix is not a Menger and also I populated the empty section "Sierpinski" so now the IFS section is more readable  police A Beer Cup
Logged

No sweat, guardian of wisdom!
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #18 on: November 16, 2016, 11:42:29 AM »

@crist I am finding that the default max iterations  should be more like 50

@ DarkBeam.  I  am just finishing of  the openCL version at the moment,  ( this version is set up for my DE testing).
Logged
Sabine
Fractal Fertilizer
*****
Posts: 373



WWW
« Reply #19 on: November 16, 2016, 11:43:56 AM »


Still the int to float cast I am struggling with too!

When I tried to redeclare i as float as it says in the code (mclarekin also gave this tip) I get the same error, but now for this new line (i is not defined) :}
I have no idea how valuables behave in glsl, it's not like good old days with public and private ones:} Does it get lost on the way? Because i is defined in the for-loop as int, we shouldn't get this error? If i was still 'existing' we would get an error about faulty data type or when trying to convert, a conversion error?

Sorry, very new to this!
Logged

sabine62.deviantart.com
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #20 on: November 16, 2016, 11:45:48 AM »

Please return topic to Fragmentarium section
Logged

mclarekin
Fractal Senior
******
Posts: 1739



« Reply #21 on: November 16, 2016, 01:10:28 PM »

here is the current openCL version of MixPinski4D_mod1,  which is very similar to ,frag.    fabs = abs,  float4 = vect4. 

There are some stop/start iteration controls included. And a temporary 3D Rotation

My recent exploring indicates that the pow(scale,-i)  is actually inferior to   r/DE but it might be location & settings specific.

Mandelbulber V1.21OpenCL  has one file for  Initial Conditions  and another for what goes inside of the  Iteration Loop.

Code:
// This file has all commands which are executed once before iteration loop.
// It can be used to initialize all variables and do some preliminary calculations
// all available variables are defined in mandelbulber_cl_data.h
// MixPinski4D_mod1
// INITIAL CONDITIONS
// DarkBeam & Knighty maths fractalforums.com
// 16/11/16

// TODO reorientate

// DE testing
int swapDE = consts->fractal.mandelbox.fixedRadius;// strange names because I am using some
float offsetD = consts->fractal.mandelbox.minRadius; // some existing parameters boxed


float scaleM = consts->fractal.mandelbox.scale; // default 2.0

int startO = consts->fractal.custom[0]; //start default 0
int stopO = consts->fractal.custom[1];  // stop default 250
float4 offsetM = (float4){consts->fractal.custom[2], consts->fractal.custom[3], consts->fractal.custom[4], consts->fractal.custom[5] };
 // default 0,0,0,0
int startS = consts->fractal.custom[6];
int stopS = consts->fractal.custom[7];
float4 scaleC = (float4){consts->fractal.custom[8], consts->fractal.custom[9], consts->fractal.custom[10], consts->fractal.custom[11] };
// Defaults (1,1,0.5,0.5);
int startR = consts->fractal.custom[12];
int stopR = consts->fractal.custom[13];

float w = consts->fractal.custom[14];
float4 z4 = (float4)(z.x, z.y, z.z, w); //make the vector4

float temp = 0.0f;

//this variable is used to calculate surface colour
colourMin = 0.0f;

// initial condition for DE
float DE = 1.0f;

Code:
// MixPinski4D_mod1   beta beta beta
// ITERATION LOOP
// DarkBeam & Knighty maths fractalforums.com
// 16/11/16
if( startS <= i && i <  stopS)
{

if(z4.x+z4.y<0.0) z4.xy = -z4.yx;

if(z4.x+z4.z<0.0) z4.xz = -z4.zx;

if(z4.y+z4.z<0.0) z4.zy = -z4.yz;

if(z4.x+z4.w<0.0) z4.xw = -z4.wx;

if(z4.y+z4.w<0.0) z4.yw = -z4.wy;

if(z4.z+z4.w<0.0) z4.zw = -z4.wz;
}
if( startO <= i && i <  stopO)
{

z4+=offsetM;

}       
if( startR <= i && i <  stopR)
{
//tempoary 3D rotation
float3 z3 = (float3)( z4.x, z4.y, z4.z );
z3 = Matrix33MulFloat3(consts->fractal.mandelbox.mainRot, z3);
z4 = (float4)( z3, z4.w);
}

// 4D menger sponge
z4.x = scaleM * z4.x-scaleC.x *( scaleM - 1);

z4.y = scaleM * z4.y-scaleC.y *( scaleM - 1);

z4.w = scaleM * z4.w-scaleC.w *( scaleM - 1);

z4.z -= 0.5*scaleC.z*( scaleM - 1)/ scaleM ;

z4.z = -fabs(-z4.z);// abs in frag   
z4.z += 0.5*scaleC.z*( scaleM - 1)/ scaleM ;

z4.z = scaleM *z4.z;

float r4 = z4.x*z4.x + z4.y*z4.y + z4.z*z4.z + z4.w*z4.w;

if (r4 > colourMin) colourMin = r4;

DE *= scaleM;
if (r4 > 1024.0f)  // bailout check
{
r = sqrt(r4);// test both ways i.e. sqrt(r4 - (z4.w * z4.w));sqrt(r4);
if( swapDE == 1) // pseudo checkBox
{
dist = (r - offsetD) / fabs(DE);
}
else
{
//float Iter = i;
dist = (r)*pow(scaleM,-i);
}
out.colourIndex = colourMin ;
break;
}

Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #22 on: November 16, 2016, 01:49:46 PM »

@Sarbine62.  Sorry but I do not know enough about that stuff, but hopefully we will have a working .frag soon.


These images have on the left, the  pow(scale,-i)  DE looking finer detailed.  But when I later zoomed in, I was in a location where the r/DE  function was excellent and the  pow function terrible.  So maybe having more than one DE option available to choose from could be a good idea.  More research required. smiley


* mixPinski pow_r-0 1000.jpg (217.35 KB, 1000x443 - viewed 324 times.)
Logged
Sabine
Fractal Fertilizer
*****
Posts: 373



WWW
« Reply #23 on: November 16, 2016, 05:02:09 PM »

@mclarekin Thanks a lot! I cant for the life of me imagine why this won't work. Maybe Crist-JRoger can solve it...

And DE-options: the more the merrier;)
Logged

sabine62.deviantart.com
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #24 on: November 16, 2016, 06:03:17 PM »

This don't works.
Code:
#include "DE-Raytracer.frag"

uniform float scaleM; slider[0,.2,.2]
uniform vec4 scaleC; slider[(-5,-5,-5,-5),(1.,1.,.5,.5),(5.,5.,5.,5.)]
uniform vec4 offsetM; slider[(-5,-5,-5,-5),(0.,0.,0.,0.),(5.,5.,5.,5.)]
uniform float w; slider[0,0,5.]
uniform int MI; slider[0,10,250]
uniform float bailout; slider[0,1024,1024]

float DE(vec3 p)
{
vec4 z=vec4(p,w);
float r=0.;
//float r=(z.x*z.x+z.y*z.y+z.z*z.z);
//float r=z.x*z.x+z.y*z.y+z.z*z.z+z.w*z.w;
for(int i=0; i<MI && r<bailout; i++){
//for(int i=0; i<MI; i++){
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.zy = -z.yz;
    if(z.x+z.w<0.0) z.xw = -z.wx;
    if(z.y+z.w<0.0) z.yw = -z.wy;
    if(z.z+z.w<0.0) z.zw = -z.wz;

z+=offsetM;

z.x= scaleM *z.x-scaleC.x*( scaleM -1.);
    z.y= scaleM *z.y-scaleC.y*( scaleM -1.);
    z.w= scaleM *z.w-scaleC.w*( scaleM -1.);
    z.z-=0.5*scaleC.z*( scaleM -1.)/ scaleM ;
    z.z=-abs(-z.z);
    z.z+=0.5*scaleC.z*( scaleM -1.)/ scaleM ;
    z.z= scaleM *z.z;

r=z.x*z.x+z.y*z.y+z.z*z.z+z.w*z.w;

}
//float Iter = i;
//return sqrt(r);
return sqrt(r)*pow(scaleM,-50.);
//return r;
}

Why? Because I'm not a programmer  grin
Logged

Sabine
Fractal Fertilizer
*****
Posts: 373



WWW
« Reply #25 on: November 16, 2016, 06:48:40 PM »

YesYes it does work
Code:
#include "DE-Raytracer.frag"

uniform float scaleM; slider[-2,0,2]
uniform vec4 scaleC; slider[(-5,-5,-5,-5),(0,0,0,0),(5.,5.,5.,5.)]
uniform vec4 offsetM; slider[(-5,-5,-5,-5),(0.,0.,0.,0.),(5.,5.,5.,5.)]
uniform float w; slider[0,1,5]
uniform int MI; slider[0,10,250]
uniform float bailout; slider[0,16,1024]

float DE(vec3 p)
{
vec4 z=vec4(p,w);
float r=0.;
//float r=(z.x*z.x+z.y*z.y+z.z*z.z);
//float r=z.x*z.x+z.y*z.y+z.z*z.z+z.w*z.w;
for(int i=0; i<MI && r<bailout; i++){
//for(int i=0; i<MI; i++){
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.zy = -z.yz;
    if(z.x+z.w<0.0) z.xw = -z.wx;
    if(z.y+z.w<0.0) z.yw = -z.wy;
    if(z.z+z.w<0.0) z.zw = -z.wz;

z+=offsetM;

z.x= scaleM *z.x-scaleC.x*( scaleM -1.);
    z.y= scaleM *z.y-scaleC.y*( scaleM -1.);
    z.w= scaleM *z.w-scaleC.w*( scaleM -1.);
    z.z-=0.5*scaleC.z*( scaleM -1.)/ scaleM ;
    z.z=-abs(-z.z);
    z.z+=0.5*scaleC.z*( scaleM -1.)/ scaleM ;
    z.z= scaleM *z.z;

r=z.x*z.x+z.y*z.y+z.z*z.z+z.w*z.w;

}
//float Iter = i;
//return sqrt(r);
return sqrt(r)*pow(scaleM,-50.);
//return r;
}



#preset default
FOV = 0.4
Eye = 0,0,-8
Target = -1e-07,0,2
Up = -0.7512803,0.6599832,0
EquiRectangular = false
AutoFocus = false
FocalPlane = 1
Aperture = 0
Gamma = 2
ToneMapping = 4
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
DepthToAlpha = false
ShowDepth = false
DepthMagnitude = 1
Detail = -2.3
DetailAO = -0.5
FudgeFactor = 1
MaxDistance = 1000
MaxRaySteps = 56
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.7
Specular = 0.4
SpecularExp = 16
SpecularMax = 10
SpotLight = 1,0.09019608,0.02745098,0.4
SpotLightDir = 0.1,0.1
CamLight = 1,0.04313725,0.01176471,1
CamLightMin = 0
Glow = 1,1,1,0
GlowMax = 20
Fog = 0
HardShadow = 0
ShadowSoft = 2
QualityShadows = false
Reflection = 0
DebugSun = false
BaseColor = 1,1,1
OrbitStrength = 0
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 = 1.1
EnableFloor = false
FloorNormal = 0,0,1
FloorHeight = 0
FloorColor = 1,1,1
scaleC = -0.2559727,1,0.5,0.5
offsetM = 0,0,0,0
w = 0
MI = 10
bailout = 1024
scaleM = 1.066059
#endpreset

And then you get this  rolling on floor laughing
Sorry, just had to post, it was the first thing that appeared on my screen after I got an image and 'slid a slider'!

(PS I can't get it to work 'really' either, no programmer  grin)



* 1.jpg (6.43 KB, 609x341 - viewed 298 times.)
Logged

sabine62.deviantart.com
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #26 on: November 16, 2016, 06:56:36 PM »

Just what is needed!
And the code is simple  laugh

upd.:
Okay, think ir's really work. Remove z.w*z.w from r=z.x*z.x+z.y*z.y+z.z*z.z; and replace
return to
Code:
float Iter = MI;
return sqrt(r)*pow(scaleM,-Iter);

Preset
Code:
FOV = 0.4
Eye = -31.7535,62.7664,-16.2701
Target = -27.2308,54.1588,-13.9345
Up = 0.357063,-0.0647625,-0.93009
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 2
ToneMapping = 4
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
DepthToAlpha = false
ShowDepth = false
DepthMagnitude = 1
Detail = -3
DetailAO = -0.5
FudgeFactor = 0.3
MaxDistance = 1000
MaxRaySteps = 739
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.7
Specular = 0.4
SpecularExp = 16
SpecularMax = 10
SpotLight = 1,0.631373,0.482353,1
SpotLightDir = -0.36842,0.1
CamLight = 0.709804,0.866667,1,0.65626
CamLightMin = 0.30769
Glow = 1,1,1,0
GlowMax = 20
Fog = 0
HardShadow = 1 NotLocked
ShadowSoft = 20
QualityShadows = false
Reflection = 0
DebugSun = false
BaseColor = 1,1,1
OrbitStrength = 0
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 = 1.1
EnableFloor = false
FloorNormal = 0,0,1
FloorHeight = 0
FloorColor = 1,1,1
scaleC = -2.5728,-5,-5,-4.2233
offsetM = -0.8763,-1.1856,2.6289,3.7629
w = 0
MI = 59
bailout = 24371.2
scaleM = 1.04684


So, what shape should get?  roll eyes


* 111.jpg (59.26 KB, 477x415 - viewed 340 times.)
« Last Edit: November 16, 2016, 07:20:45 PM by Crist-JRoger » Logged

Sabine
Fractal Fertilizer
*****
Posts: 373



WWW
« Reply #27 on: November 16, 2016, 07:28:32 PM »

I got this (best shot with same code)
Will try yours asap!


* 3.jpg (22.42 KB, 600x337 - viewed 299 times.)
« Last Edit: November 16, 2016, 07:43:12 PM by Sabine62 » Logged

sabine62.deviantart.com
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #28 on: November 16, 2016, 08:14:09 PM »

@ crist   Did you change default MI. I guessed at 10 for default but now that I have tested it 50 was better. I think in  most cases bailout terminates the loop, so in Mandebulber the general default for all fractals is 250.l

My latest posted images is what I get at default setting. (But Mandelbulber V1.21 has the  z axis upside down, so you need to mentally flip it vertically)

I was using a DE step (fudge factor) of 0.5. 

Logged
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #29 on: November 16, 2016, 08:21:58 PM »

mclarekin, run Fragmentarium and test )
Me and Sabine posted preset settings. Fragment not optimized (FudgeDactor<0.3 ... 0.2) maybe not adapted for DE-raytracer, maybe need different math. Somebody who programmed for Frag can answer.
Logged

Pages: 1 [2] 3 4 ... 9   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Help about implementing the perturbation theory Programming « 1 2 » CFJH 23 2125 Last post May 14, 2015, 06:40:57 PM
by therror
mixPinski 1600 Mandelbulber Gallery mclarekin 3 865 Last post November 19, 2016, 02:54:00 AM
by paigan0
mixPinski sphFold Mandelbulber Gallery mclarekin 0 1117 Last post November 19, 2016, 10:27:57 AM
by mclarekin
Implementing ABoxModKaliEiffie Amazing Box, Amazing Surf and variations « 1 2 3 » mclarekin 30 10422 Last post November 27, 2016, 11:52:55 AM
by Sabine
Implementing Menger Sponge 45 rot Sierpinski Gasket mclarekin 9 3388 Last post December 04, 2016, 10:49:35 PM
by DarkBeam

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.427 seconds with 25 queries. (Pretty URLs adds 0.063s, 2q)