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: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. April 25, 2024, 10:37:13 AM


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   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 ABoxModKaliEiffie  (Read 10781 times)
0 Members and 1 Guest are viewing this topic.
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #15 on: November 25, 2016, 12:06:35 AM »

Here is a beta AboxModKaliEiffie   .frag

This image was using this formula and ASurf in MandelbulberV2
http://www.fractalforums.com/index.php?action=gallery;sa=view;id=19627


I have set it up as a standard Abox type with check boxes for enabling the two eiffie swizzles. This was constructed from the Mandlebox.frag.  Which is a good starting point for making these surf box types.

* AbMKE_Files.zip (10.02 KB - downloaded 164 times.)

* out-6.jpg (211.28 KB, 780x585 - viewed 313 times.)
Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #16 on: November 25, 2016, 01:55:17 AM »

BTW some of my sliders are not set uo properly but the spinboxes all work


So evaluating . frag progress so far


// Output generated from file: D:/fragmentarium/AboxModKaliEiffie6.frag
// Created: Fri Nov 25 00:29:01 2016
#info Mandelbox Distance Estimator (Rrrola's version).
#define providesInit
#include "DE-Raytracer.frag"
#include "MathUtils.frag"
#group AboxModKaliEiffie   this is the tab name that appears on the UI for the fractal parameters

/*
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/
*/
uniform bool swapXZ; checkbox[false]    enable eiffie's XZ swizzle
uniform bool swapXY; checkbox[false]    enable eiffie's XY swizzle

add another
uniform bool  foldB; checkbox[false]    original KaliBox fold

// Number of fractal iterations.  
uniform int Iterations;  slider[0,17,300]   hmmm ? 17 is too low . 60 should be safe
uniform float Bailout;  slider[0,100,1000]
uniform int ColorIterations;  slider[0,3,300]
uniform vec3 Offset1; slider[(-5.0,-5.0,-5.0),(1.0,1.0,1.0),(5.0,5.0,5.0)]    for the tglad fold

uniform float MinRad2;  slider[0,0.25,2.0]
uniform float Scale;  slider[-5.0,2.0,5.0]

vec4 scale = vec4(Scale, Scale, Scale, abs(Scale)) / MinRad2;  vec4!!  the internal DE calc is p.w  of p = vec4 (pos, DE) sort of thing
uniform vec3 c3Mul; slider[(-5.0,-5.0,-5.0),(1.0,1.0,1.0),(5.0,5.0,5.0)]  this is the scale factor applied to c (the original coordinates of the point being iterated, addCpixel)
uniform vec3 cJ; slider[(-5.0,-5.0,-5.0),(0.0,0.0,0.0),(5.0,5.0,5.0)]   julia constant or add_ an_offset.

// then we have a rotate about a vector by angle, (I will add a 3D matrix rotation)
uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
uniform float RotAngle; slider[0.00,0,180]
mat3 rot;

void init() {
    rot = rotationMatrix3(normalize(RotVector), RotAngle);
}

// this is part of the distance estimation, I have yet to evaluate this additional maths, but I think it may give a better render , hmmm?

float absScalem1 = abs(Scale - 1.0);
float AbsScaleRaisedTo1mIters = pow(abs(Scale), float(1-Iterations));

   float Dd = 1.0;   

That is the initial conditions , next the Iteration Loop smiley
Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #17 on: November 25, 2016, 04:34:02 AM »

This frag has two presets  Default preset is Abox

It is now can make a KaliBox, Abox & AboxModKaliEiffie.

* AboxModKaliEiffie9.frag (5.12 KB - downloaded 169 times.)
Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #18 on: November 25, 2016, 08:05:45 AM »

well all that vec4 stuff  hiding the DE calcs, made it a bit hard to figure out. So I stripped it back to a vec3 p3 and the internal  DE calc using float Dd.

float DE(vec3 pos) {
   float Dd = 1.0;   
   vec3 p3 = pos;
   vec3 c3 = pos;   
   float r2;   

   for (int i=0; i<Iterations; i++) {

      p3 *=rot;

      // fold options
      if (KaliBox) p3 = abs(p3) + KaliBoxV;
      if (TgladFold) p3 = abs(p3 + TgladFoldV) - abs(p3 - TgladFoldV) - p3;

   //   p = clamp(p, -1.0, 1.0) * 2.0 - p;  // min;max;mad // tglad fold, which is faster??
   //   p = clamp (p, -Offset, Offset) * 2.0 - p; // = Abox tglad fold Fold??
   //   p = clamp (p, -Limit, Limit) * Value - p; // = Mbox Fold ??
   
      // swizzle options, both enabled = aboxModKaliEiffie
      if (swapXZ)   p3.xz = p3.zx;
      if (swapXY)      if (p3.y > p3.x) p3.xy = p3.yx;            

      float r2 = dot(p3, p3); // radius squared

      if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(p3,r2)));

      // spherical fold
      p3 *= clamp(max(MinRad2/r2, MinRad2), 0.0, 1.0);  // dp3,div,max.sat,mul
      Dd *= clamp(max(MinRad2/r2, MinRad2), 0.0, 1.0);  // dp3,div,max.sat,mul

      p3 = (p3 * SdmR2) + cJulia + (c3 * c3Mul);
      Dd = (Dd *abs(SdmR2)) +1.0;
      //r2 = dot(p3, p3);

             if ( r2>Bailout) break;
      
   }
   //float r = sqrt(r2); // hmmm?? this don't work ??
      float r = length(p3);

   return (r - absScalem1) / Dd - AbsScaleRaisedTo1mIters;
}

* AboxModKaliEiffie11.frag (5.13 KB - downloaded 161 times.)
Logged
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #19 on: November 25, 2016, 09:43:28 AM »

Looked at code. Why reinvent KaliBox again?
Or you want make all-in-one constructor based on ABox?
Logged

Sabine
Fractal Fertilizer
*****
Posts: 373



WWW
« Reply #20 on: November 25, 2016, 09:56:36 AM »

@mclarekin Really great that you share your progress with it. Though that generates another job for my weekend: trying to dissect your code  grin
Already very cool to play with:


* AboxModKaliEiffie11_1a.jpg (113.03 KB, 801x450 - viewed 316 times.)
Logged

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



« Reply #21 on: November 25, 2016, 12:50:18 PM »

@ Crist. You can run both folds at the same time.  You can run  either fold with  one or both the swizzles.  Include stop & start iter conditions and it can become more manageable.
It is just one of the infinite possibilities.

BTW since then I have changed the KaliBox fold to another one and added  two more rotations. I will add in one more transform and call it finished. smiley
Logged
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #22 on: November 25, 2016, 01:26:20 PM »

mclarekin, I wish and I hope that you will come to Apollonian and Kleinian fractals  embarrass and implement your version to Frag  roll eyes
Inspired this gallery
Logged

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



« Reply #23 on: November 26, 2016, 07:47:38 AM »

I added in a second scale, and a manipulation of addCpixel.  Using my new knowledge of the sign() to keep it short, ( the new sign()  got rid of about 150 lines of code from MandelbulberV2  grin)

This transform  allows  c to become absolute value (or not), then applys the sign of the currentz, before it is added to currentz. This transform was coded  for use with  Msltoe's julia bulbs, but can work with some other fractals

Code:
if(absC_sym	)
{
if (absC_ZX) c3.x = abs(c3.x);
if (absC_ZY) c3.y = abs(c3.y);
if (absC_ZZ) c3.z = abs(c3.z);

c3.x = sign(p3.x) * c3.x;
c3.y = sign(p3.y) * c3.y;
c3.z = sign(p3.z) * c3.z;
}

I found Fragmentarium is not at all difficult to use. And  you dont actually have to understand or do coding, for loadExample_explore_render type fractal generation ( and it is soooo fast).
It is also a perfect program for learning how to  code fractals.

Now I better get back to finishing mixPinski and cross Menger code.

* AboxModKaliEiffie14.frag (15.7 KB - downloaded 174 times.)
Logged
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #24 on: November 26, 2016, 04:08:49 PM »

Thank you for sharing frag!
Played with KaliBox  Azn  added p.x=sin(p.x); after abs.




Logged

Sabine
Fractal Fertilizer
*****
Posts: 373



WWW
« Reply #25 on: November 26, 2016, 04:44:40 PM »

@mclarekin Finally got some time to have a look at your optimisations for 'my' aboxmodkali!

This is my original bit and below are your recommendations

if (rr < sqrt(MinR)) {m = Scale/sqrt(MinR); } else
         if (rr < 1) {m = Scale/rr;} else { m = Scale; };
      if (Julia) {z = z * m + Julia_C; } else {z = z * m;};

This we can rewrite

Initial Conditions:

float MinR2; slider
float Scale; slider
float m = Scale;
float  minF = m/MinR2

In The Loop
if (rr <MinR2)) {m = minF); }
else  if (rr < 1.0) {m = m/rr;}

//  else { m = Scale; }; not needed
z *= m;
if (Julia) {z +=  Julia_C; }

The part concerning the Julia-shortcut I actually understand! grin Now my challenge is to remember and apply in the future! :}

Above: The thing is: I cannot lose the Scale-variable, as m gets altered by every cycle. The only way (I think) I could do it your way is to put

m=Scale

at the start of the cycle and then go

if (rr < 1) {m/=rr;};

This gives a correctly working fractal. But maybe I did miss something?

Here's the whole thing now including your recommendations:

Code:
uniform int MI; slider[1,30,100]
uniform int ColorIterations;  slider[0,10,100]
uniform int bailout; slider[1,1024,1024]
uniform float Scale; slider[-5,1.5,5]
uniform float MinR; slider[0,0.6,3]
uniform vec3 xyzAdd; slider[(-5,-5,-5),(0.5,0.5,0.5),(5,5,5)]
uniform bool Julia;  checkbox[false]
uniform vec3 Julia_C; slider[(-5,-5,-5),(0,0,0),(5,5,5)]

float DE(vec3 p) {
vec3 z=vec3(p);
float m;
float mf=m/MinR;
float rr=0;
float Dd = 1.0f;
for(int i=0; i<MI && rr<bailout; i++){
m=Scale;
z = xyzAdd - abs(z);
rr = z.x*z.x + z.y*z.y + z.z*z.z;
if (rr < MinR) {m = mf; } else
if (rr < 1) {m/=rr;};
z*=m;
if (Julia) {z+=Julia_C; };
Dd = Dd * abs(m) + 1.0f;
if (i < ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(p,rr)));
}
float r = sqrt(rr);
return (r) / abs(Dd);
}
« Last Edit: November 26, 2016, 07:30:49 PM by Sabine » Logged

sabine62.deviantart.com
Sabine
Fractal Fertilizer
*****
Posts: 373



WWW
« Reply #26 on: November 26, 2016, 04:47:13 PM »

@Crist-JRoger: Beauties, both of them! I must test your trick;)
Logged

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



« Reply #27 on: November 26, 2016, 08:39:04 PM »

@ Sarbine. This is the spherical fold on its own i.e. no scale.  (with maxR2 also included)

float maxR2 slider default = 1
float minR2 slider default = 0.25
float mMR2 = maxR2 / minR2;


then in the loop :
// sphericalFold
if (Enable.z == 1)
{
   r2 = dot(z,z);   
   if (r2 < minR2)    {z *= mMR2; Dd *= mMR2;   }
   else if (r2 < maxR2)   {z *= maxR2 / r2; Dd *= maxR2 / r2; }
}
Logged
Sabine
Fractal Fertilizer
*****
Posts: 373



WWW
« Reply #28 on: November 26, 2016, 11:06:37 PM »

@mclarekin confused Now you lost me... I think! :}

You are now talking about something else right? I am embarrassed to say that I haven't really got a clue if the aboxmodkali is a spherical fold With scale... Is it?  embarrass This is ALL really very new to me... Basically I am juggling with building blocks to begin with  wink
As I understand it now I can use what you wrote as an alternative way of folding?

So, let me get this right (in the long version):

if(Enable.z) {                                                                    // uniform bool with checkbox for Enable.z
r2=z.x*z.x+z.y*z.y+z.z*z.z                                                 // is this what r2=dot(z,z) means?
if(r2<minr2) {z=z*mMR2; Dd=Dd*mMR2; } else                       // checks if r2 smaller than minR2 OR (bigger than minR2 AND smaller than maxR2), alters z and Dd to different values in either case.
  if (r2<maxR2) {z=z*maxR2/r2; Dd=Dd*maxR2/r2;}               
}

Built it into abmk as option and now I find bulbs  grin Thank you very much for your patience!

Another thing: I see you are really giving aboxmodkalieiffie a good spin, building in all kinds of transforms. So I was wondering: doing this kind of thing for every formula is a pain, especially when it is basically a bunch of standard routines (if I understand that correctly) that have to be coded into the formula in certain places. In Fragmentarium there is the wonderful #define option with which you can load extra options built into the raytracer you are using and the #include option with which you can include a raytracer, math-library and such. What if there were a possibility to enable transforms that live outside the formula and have them have their own tab on the variable editor? That would make a big difference to the amount of time needed to code something for Fragmentarium. But then that would mean a certain amount of standardizing and I am not sure (if it is at all feasable) if that would not mean a big change to the until now happy-go-lucky-oh-let's-try-this-fragmentarium-style approach... But is it at all possible? Or should i ask this question in a new thread (as I am already abusing this one enough as it is wink )



* SF1.jpg (72.98 KB, 800x450 - viewed 315 times.)
Logged

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



« Reply #29 on: November 27, 2016, 12:32:24 AM »

@ sarbine
Quote
r2=z.x*z.x+z.y*z.y+z.z*z.z                                                 // is this what r2=dot(z,z) means?
yep,  vec z.xyz * vec z.xyz

Quote
if(r2<minr2) {z=z*mMR2; Dd=Dd*mMR2; } else                       // checks if r2 smaller than minR2 OR (bigger than minR2 AND smaller than maxR2), alters z and Dd to different values in either case.
  if (r2<maxR2) {z=z*maxR2/r2; Dd=Dd*maxR2/r2;}               
It works like :-
check if(r2<minr2), if so then z=z*mMR2
if not, check if  (r2<maxR2), if so then z=z*maxR2/r2
if not, then z  remains unchanged.

Standard transforms can be set up as subroutines or macros and then called into a formula. This seems to me the optimum way.
 I cannot do this easily in Mandelbulber OpenCL without learning how to build and compile that version but we did have it implemented in V2.5 & V2.6. In current MandelbulberV2 I have yet to re-implement a similar  system, (too many other things to do). In MandebulberV2 we have nine formula slots so I can have nine seperate UI's loaded to work with. These can be formulas and /or transforms.

With my frag code I was just messing about learning about Fragmentarium, so I just added a few extra options until the UI became cluttered. Finding the optimum UI setup is a balancing act between "not enough options" and "looks complicated with too many options."

There may already be a Fragmentrarium thread dealing with possible enhancements, if not you could start one.  If 3dickulus had a team of programmers helping him, then Fragmentarium could have many added enhancements.
Logged
Pages: 1 [2] 3   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 2370 Last post May 14, 2015, 06:40:57 PM
by therror
Anyone thought of implementing Perturbation on Android? Smartphones / Mobile Devices simon.snake 0 2764 Last post August 29, 2015, 10:38:30 PM
by simon.snake
Implementing MixPinski Sierpinski Gasket « 1 2 ... 8 9 » mclarekin 124 20463 Last post January 14, 2017, 12:24:58 PM
by hgjf2
aBoxModKaliEiffie Mbox hybrid Mandelbulber Gallery mclarekin 0 1380 Last post November 22, 2016, 10:20:02 AM
by mclarekin

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.225 seconds with 26 queries. (Pretty URLs adds 0.017s, 2q)