Reptorian G'MIC Filters

For reference, starts here: G'MIC exercises - #177 by garagecoder.

@David_Tschumperle @afre Noted. I changed name in my user.gmic.

Ok, I am getting somewhere with the Lyapunov Fractal. Not so interesting IMO in terms of coloring.

image

image

Examples here look like you could have at least two opponent colours. Again, I want to point out that many of your filters could have an animated version (or at least allow frame exports).

Yes, I do realize that they could use animation. That would take a while to do. A long project.

That being said, I’m closer, but not quite there.

image

EDIT: New duotone output:

image

1 Like

Not really much news, but I added dx,dy into Thorn Fractal, and added useful and accessible variables to information of GUI Thorn Fractal. They were already accessible before.

One note:

altern is accessible, but not sure if anyone tested that, and I find it redundant when alternating formula allows you to use formulas based on altern.


EDIT: I managed to get double random gradients mode. I will add singular gradient mode next.


EDIT:

I had fixed some bugs on Random Gradient Bars.

More EDIT on Random Gradient Bars:

  1. The CLI command accepts percentage to define bar and width size. In addition, it also accepts hexadecimal representation of RGB color to define its color.

  2. The GUI command offers more control over bar and space size.

  3. Output is generally better now.

In addition:

I added two useful generic commands.

rep_hex2int8 and rep_int82hex enables to directly convert a command argument into a variable formatted as 8i representation or hex representation. An alternative to img2hex and hex2img. rep_hex2int8 will automatically convert capital letter into lower case, and that’s another way it makes things easier.

I added those two as these 2 would allow to make commands utilizing hexadecimal as color argument easier to make.

Here is a example:

> $ rep_hex2int8 20ecdf echo ${}
> 32,236,223

Guess what it is I’m making?

256,256,256,3,[x,y,z] #The RGB index# 
256,256,256,1,1 #Evaluates whether rgb color is available, 1 is yes, 0 is no#
4096,4096,1,3,-1 #The Target Image#

m "create_coordinate_reference: $_cpus,1,1,1,>\"begin(
 v_pixel_id=vectorw(-1);
);
new_id=round(u(0,16777215));
while(isin(new_id,v_pixel_id),
 new_id=round(u(0,16777215));
);
new_id;
\""

create_coordinate_reference #Generate a reference image to create a set of initial rgb#
create_coordinate_reference #Generate a second reference image to create a set of placement point#

int2rgb..

eval. :"
coordinate_index=i;
color_pixel=I(#-2);
ix=coordinate_index%4096;
iy=int(coordinate_index/4096);
I(#-3,ix,iy)=color_pixel;
i(#-4,color_pixel)=0;
"

Still no guess. Well, the answer is Rainbow Smoke algorithm.

I decided to put that on hold.

I added another coloring mode to the Lyapunov Fractal. Behold, the results:

image

Next up is allow the user to insert images as an argument for coloring.

1 Like

New Filter! - Weighted RGB To Grayscale

Output with efforts using the filter:

Based on MJW Black and White + PDN plugin, I have decided to make my own twist based on some of the principles found in that plugin. This is my own take on the ideas founded on that plugin.

I believe @iarga would like to use this now coming to think of it.

1 Like

Any reason why am I not getting what I want in here - https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.258.6666&rep=rep1&type=pdf

The most faithful code translation I did:

rep_popcorn_fractal_imaginary:
skip ${1=21},${2=5},${3=.05}

#$1 == iteration#
#$2 == density#
#$3 == h#

iw={w-1}
ih={h-1}

channels. 0 f. 0

{int(w*abs($2))},{int(h*abs($2))},1,3 

f. ":begin_t(
  const ww="$iw";
  const hh="$ih";
  const icx=ww/2;
  const icy=hh/2;
  const pts=$1;
  const H=$3;
  const cx=(w-1)/2;
  const cy=(h-1)/2;
  const ms=1124;
  real(a)=a[0];
  imag(a)=[a[1],0];
  g1(n)=sin(n);
  g2(n)=tan(n);
  flip(v)=[v[1],v[0]];
  a=[3,0];
  const ang=deg2rad(45);
 );
 ix=(x-cx)/cx;
 iy=(y-cy)/cy;
 zz=[ix,iy];
 repeat(pts,
  nx=[zz[0],0];
  ny=[zz[1],0];
  tx=nx;
  nx=nx-H*(g1(ny+g2(a*ny)))[0]-H*(g1(nx+g2(a*nx)))[1];
  ny=ny-H*(g1(tx+g2(a*tx)))[0]-H*(g1(ny+g2(a*ny)))[1];
  zz=nx+[0,ny[0]];
  nx=nx/norm(zz);
  ny=ny/norm(zz);
  zz=nx+[0,ny[0]];
  i(#-2,zz[0]*icx/2+icx,zz[1]*icy/2+icy)++;
  if(norm(zz)>=ms,break());
 );
 zz;
 "

And here’s the C++ code from the website

void main()
{
 double xmax=1.7,xmin=-1.7,ymax=1.7,ymin=-1.7,deltap,deltaq;
 int max_iterations=21;
 int max_size= 1124.0;
 fractal(xmax,xmin,ymax,ymin,max_iterations,max_size);
 getch();
 closegraph();
}

complex g1(complex x){return (sin(x));}

complex g2(complex x){return (tan(x));}

doublecabs(complex z){return sqrt (norm(z));}

complex flip(complex c){return complex(imag(c),real(c)); }

voidfractal(doublexmax,doublexmin,doubleymax,doubleymin,intmax_iterations,intmax_size)
{
 complex c,z;    
 complex x,y,px,a=complex(3,0);
 int color;
 float col=0,row;
 float dist;
 double deltap,deltaq;
 float h=.05;
 deltap=(xmax-xmin)/480;
 deltaq=(ymax-ymin)/480;
 while(!kbhit()&&col<480){ 
  col+=1;
  for(row=0;row<480;row+=1){
   z=c=complex(xmin+col*deltap,ymax-row*deltaq);
   color=0;
   while((color<max_iterations)&&(norm(z)<max_size)){
    x=real(z),y=imag(z);
    px=x;
    x=x-h*real(g1(y+g2(a*y)))-h*imag(g1(x+g2(a*x)));
    y=y-h*real(g1(px+g2(a*px)))-h*imag(g1(y+g2(a*y)));
    z=(x)+flip((y));
    x=x/complex(norm((z)),0.0),
    y=y/complex(norm((z)),0.0);
    z=(x)+flip((y));
    color++;
    floatangle=45.*3.14/180.;
    int x0=(real(z)*cos(angle)-imag(z)*sin(angle)-xmin)/deltap,y0=(ymax-real(z)*sin(angle)-imag(z)*cos(angle))/ deltaq;if(getpixel(x0+50,y0)<224)putpixel(x0+50,y0,getpixel(x0+50,y0)+1);
   }
  }
 }
}

EDIT:

I do not think I’ll be able to do the complex version of the Popcorn Fractal. All attempts have failed.

(irrelevant part of post deleted)

New Filter! Markus-Lyapunov Fractal!

2 Likes

The background looks like pavement slick with rain.

Now that you mentioned it, I see it too. Here’s another take I did with the new filter.

The foreground shapes remind me of

Now, I figured out how a youtuber extended Lyapunov Fractal to be allowed with c. It’s just another dimension per say.

Have a look:

Absolutely terrible. :confused: Ah well, I don’t want to do much more resolution or otherwise it will take long to render.


I had pushed adding one more dimension to Lyapunov Fractal. Now, the letter ‘C’ is an accepted character. For 3D image, every first three letters are mandatory. For 2D image, every first two letters are mandatory, but c is optional.

1 Like

I will be adding more predefined formulas to Thorn Fractal.

Any name for this one?

image

I was thinking of going with Chaotic Antique Attic .

To me, chaotic isn’t very descriptive and I don’t get any antique attic vibes. The pattern evokes a viscous liquid manipulated to make a pattern; e.g., what we do with chocolatey desserts or resins.

PS Your new display picture isn’t as eye catching as your previous two.

Noted on Chaotic not being descriptive. As for the attic, I was thinking of a really old attic with so many dust that form builds up. Hence, the attic name in it.

But, I did not came here to tell you that. I came to point out I made the anim version of Lyapunov Fractal (CLI Only). Faster than the regular version for animation purpose since it’s specifically made for animation, and the phantom image overlapping each frame bug is not in the new filter.

This was created with the new filter:

Which brings to a earlier comment made by @afre. It would appear that to make my filter suitable for animation, I would make a fork of my own filter, and apply anti-aliasing on z cross section only, and keep all of it frame.


New work in progress, Arnold’s Tongue.

image

What I want to achieve:

To pull this off, I need to know how to do this and apply it to the current arnold’s tongue code. Also, I need to know what it means:

It color-codes the (average) value for the smallest number of steps N for which the following holds true:

|θn+N - θn| < ε
for some small value of ε. The value used here is about ε=0.003, that is, roughly the size of one pixel. The actual value used for ε doesn’t much matter, the picture is always about the same. The color of black corresponds to recurrence times of about N<10, green to N≈125 and red for N>250. The Arnold tongues are the black regions, of course.

Arnold's Tongues Code
rep_arnold_tongue:
1000,2000,1,1,"begin(
 const maxiter=max(abs($1),1);
 const ww=w-1;
 const hh=h-1;
 const sd=max(ww,hh)/min(ww,hh);
 const sx=w>h?sd:1;
 const sy=w>h?1:sd;
 const dpi=pi*2;
 const qpi=pi*4;
 const pi_h=hh/dpi;
);
phi=x/ww*sx;
K=(hh-y)/pi_h*sy;
iter_phi=.5;
repeat(maxiter,
 iter_phi=iter_phi+phi-(K/dpi*sin(dpi*iter_phi));
);
f=(iter_phi-phi)/maxiter;
abs(f);
"

Which part of the quoted text do you want to know about? I see at least 3 potential questions. Please elaborate. PS Wikipedia has an entry on the Arnold tongue if you haven’t already read it.

I would like to know the meaning of the first part. And secondly, how to apply the second part into code. I went as far as looking for the email of author as I only found that source to be the only one to do that coloring. Blog is active, so I might get answers.

This is my interpretation.

The loop terminates once the current and previous result are virtually the same.

The purpose of N is harder to parse without further information. Seems to me that θn is the angle term (n is subscript) and N is the number of iterations. The reason that N is capitalized may be because it is a constant, at least for the break condition, for a particular pattern and colour. E.g., for black tongues, in general, on average, N<10.

From another forum, I got this interpretation:

Reptorian
 — 
Today at 4:00 PM
Looks like I will have to resort asking this since I have yet to find an answer. Hold on, gotta find it first.

 The next picture below shows the Poincaré recurrence time for the map. It color-codes the (average) value for the smallest number of steps N for which the following holds true:

|θn+N - θn| < ε
for some small value of ε. The value used here is about ε=0.003, that is, roughly the size of one pixel. The actual value used for ε doesn't much matter, the picture is always about the same. The color of black corresponds to recurrence times of about N<10, green to N≈125 and red for N>250. The Arnold tongues are the black regions, of course

From here: https://linas.org/art-gallery/circle-map/circle-map.html ; Does anyone know what this mean?
zephyrtronium
 — 
Today at 4:05 PM
theta_n is a sequence of angles; it's finding the smallest N such that the Nth angle in the sequence approximately revisits the start of the sequence, then using that N to choose the color to use at that pixel
in a sense, it's a straightforward way to do "escape time but for angles" since angles don't really escape
Reptorian
 — 
Today at 4:06 PM
So, like a clock?
I'm trying to code that in, but don't really understand the concept
zephyrtronium
 — 
Today at 4:06 PM
analog clocks tend to use angles, yes

Also, I would need to make a poincare recurrence plot. Right now, what I did was winding number which is not useful.