Reptorian G'MIC Filters

Playing with the final blending modes and different options of the filter, I think it deserves to be published as a new filter.
I’ll doing that this afternoon.

Filter done. Available at Degradations / Blur [Multidirectional].
Some results below:




1 Like

Looks like someone has repressed anger. :smiling_imp:

Is popcorn fractal the same as in Apophysis flame fractal ?

I don’t use Apophysis, however I got the formula from here - Pickover Popcorn | Element90 Fractals

Okay, now I got new progress. However, I would like to be able to run a command to verify if window is on since I am running run(w[-1], and it is used to check on the progress of DLA.

Here’s a example involving new code.

image

You see that it’s growing around the text image? Let’s say I close the window. I should expect to end with that. I can always add a option to add boundary option to limit numbers of vector though.


EDIT:

Solved the mask issue. Also, I added a new option to erase mask after processing.

image

2 Likes

New Filter! - Diffusion Limited Aggregation

I’m finished with the filter. Finally, that was difficult to make.

Check by in a hour or two if it haven’t arrived after refresh.

1 Like

New Filter! - Pseudorandom Noise

There is a bug on the filter with double pixel axis mode, but single pixel axis looks better anyway, so I wouldn’t be so pressed about it. I will fix that bug when the time comes. It rarely shows up anyway.

New Filter! - Tiled Zoom


Non-Isometric Tiling Tool now has fill tool built-in to it. Read the instruction to use it. I thought it was going to be difficult, but highlighting lines with KDE Kate really makes it easy.

Reptorian, could you create this kind of organic generator

Not without code and without the name. I do not do request.

I don’t know what is called. It’s basically this you’ve already done only smoothed out and having soft transitions- Reptorian G'MIC Filters - #554 by Reptorian

You linked to this thread. The smoothening and transition part exists. Just not the structure. From a theoretical perspective, I can take a look at TR’s source code to one of his filter and do something like that.

I made a simple glitch filter to experiment with.

rgb2yiq8
f "begin(
 rv(v)=(
  rv=0;
  n=v;
  do(
  rv=int(rv)*10+n%10;
  n=int(n)/10;
  ,int(n)>0);
  int(rv);
 );
);
rv(i);
"
yiq82rgb

What this does is reverse digits. @Joan_Rake1 I’m sure you can do something interesting here.

A little modification leads me to this.

image

EDIT: I just had pushed the Reverse Digits glitch filter.

1 Like

Upgraded filter - Modulus Operation

At long last, I finally upgraded it. It took me a while to do so.

Oh boy, my desktop motherboard got fried. So, no new filters until next two weeks.

Gave up on multithreading and hoping for parallel_for function support for g’mic one day.

That being said, I had trimmed off 10 seconds without any fancy tricks. That means no pixel count to verify, and no progress report. I will update Popcorn Fractal soon.

Before: 26 s
Now: 14 s

My ideal: 5 s going off multithreaded version attempt

EDIT: I just pushed the optimized version. 12 s trimmed off. The GUI version will be fixed to account for this.

EDIT: Now, I think I found my solution, but it’s not going to look pretty. I will create a 3D image, and each x position represent iteration within ptn<pts loop. Then, transfer that to 2D. From my test, in theory, I should be able to have 4 s-6 s as opposed to pdn 10 s. If it works, I should be able to do this for chirikov-taylor filter.


EDIT as of 10/29/2020:

I got something here.

#@cli rep_pfrac : eq. to 'rep_popcorn_fractal' : (+)
rep_pfrac: rep_popcorn_fractal $*
#@cli rep_popcorn_fractal: _points>0,_density>0,_H,_K,_zoom,_rotation_angle,_origin_x,_origin_y,_mode,_f1={ 0=sin | 1=cos | 2=tan | 3=atan},...
#@cli : Generates Pickover Popcorn Fractal. Code was adapted from Paul Bourke's c code, and extended for more possibilities. Fractal is attributed to Clifford Pickover.\n
#@cli : _points defines the maximum number of points to be added on image based on pixel location.
#@cli : _density defines the frequency of points to be added along row and height of image. A value of one implies n points to be added per pixel.
#@cli : _H is the function multiplier used to subtract from the new found values from each iteration.
#@cli : _K is the inner multiplier for the inside function. See popcorn_x(a,b), and popcorn_y embedded within the code of rep_popcorn_fractal for more information.
#@cli : _zoom defines the magnification of image. A negative value will "shrink" the structure of generated fractal.
#@cli : _rotation_angle defines the function angle of fractal.
#@cli : _origin_x defines the position of fractal. Center of image row will be treated as zero, and the ranges for image row are treated as -1,1.
#@cli : _origin_y defines the position of fractal. Center of image column will be treated as zero, and the ranges for image column are treated as -1,1.
#@cli : _mode defines whether to use 4 trigonometric functions or 6 trigonometric functions. Each halves of functions are used on 2 functions used by different axis.
#@cli : _fn defines individual function used for the popcorn fractal.\n
#@cli : Author: Reptorian.\n
#@cli : Default values: '_points=50','density=1','H=.05','_K=3','_rotation_angle','_origin_x=0','_origin_y=0','_mode=0',...\n
#@cli : \ \ \ \ If _mode=0: ... = '_f1=_f3=0','_f2=_f4=2'
#@cli : \ \ \ \ If _mode=1: ... = '_f1=_f4=0','_f2=_f5=1','_f3=_f6=2'\n
rep_popcorn_fractal:
skip ${1=50},${2=1},${3=.05},${4=3},${5=1},${6=0},${7=0},${8=0},${9=0},${10=},${11=},${12=},${13=},${14=},${15=}
if ($6-360*floor($6/360))?1
 fvx=round(((rot_x(xnew,ynew)-osx)*cx_zoom+cxsx)/sx)
 fvy=round(((rot_y(xnew,ynew)-osy)*cy_zoom+cysy)/sy)
else
 fvx=round(((xnew-osx)*cx_zoom+cxsx)/sx)
 fvy=round(((ynew-osy)*cy_zoom+cysy)/sy)
fi
channels. 0 f. 0
ww={w-1}
hh={h-1}
sd={max(w,h)/min(w,h)}
sx={w>h?$sd:1}
sy={w>h?1:$sd}
cx={w/2}
cy={h/2}
density={1/abs($2)}
$1,{h/$density},{w/$density},2,"
begin(
 const ww="$ww";
 const hh="$hh";
 const sd="$sd";
 const sx="$sx";
 const sy="$sy";
 const cx="$cx";
 const cy="$cy";
 const zoom=1/$5;
 const origin_x=$7*-1*zoom;
 const origin_y=$8*zoom;
 const osx=origin_x*sx;
 const osy=origin_y*sy;
 const cx_zoom=cx/zoom;
 const cy_zoom=cy/zoom;
 const cxsx=cx*sx;
 const cysy=cy*sy;
 const zcxsx=zoom/cxsx;
 const zcysy=zoom/cysy;
 const ang=($6/180)*pi;
 const cos_ang=cos(ang);
 const sin_ang=sin(ang);
 rot_x(a,b)=a*cos_ang-b*sin_ang;
 rot_y(a,b)=a*sin_ang+b*cos_ang;
 const density="$density";
 const H=$3;
 const K=$4;
 if($9,
  if(narg($10),
   if(($10%4)==0,func_a(a)=sin(a);,
   if(($10%4)==1,func_a(a)=cos(a);,
   if(($10%4)==2,func_a(a)=tan(a);,
   if(($10%4)==3,func_a(a)=atan(a);
   );
   );
   );
   );,
  func_a(a)=sin(a);
  );
  if(narg($11),
   if(($11%4)==0,func_b(a)=sin(a);,
   if(($11%4)==1,func_b(a)=cos(a);,
   if(($11%4)==2,func_b(a)=tan(a);,
   if(($11%4)==3,func_b(a)=atan(a);
   );
   );
   );
   );,
  func_b(a)=cos(a);
  );
  if(narg($12),
   if(($12%4)==0,func_c(a)=sin(a);,
   if(($12%4)==1,func_c(a)=cos(a);,
   if(($12%4)==2,func_c(a)=tan(a);,
   if(($12%4)==3,func_c(a)=atan(a);
   );
   );
   );
   );,
  func_c(a)=tan(a);
  );
  if(!narg($13),
   if(narg($10),
    if(($10%4)==0,func_d(a)=sin(a);,
    if(($10%4)==1,func_d(a)=cos(a);,
    if(($10%4)==2,func_d(a)=tan(a);,
    if(($10%4)==3,func_d(a)=atan(a);
    );
    );
    );
    );,
   func_d(a)=sin(a);
   );,
  if(($13%4)==0,func_d(a)=sin(a);,
  if(($13%4)==1,func_d(a)=cos(a);,
  if(($13%4)==2,func_d(a)=tan(a);,
  if(($13%4)==3,func_d(a)=atan(a);
  );
  );
  );
  );
  );
  if(!narg($14),
   if(narg($11),
    if(($11%4)==0,func_e(a)=sin(a);,
    if(($11%4)==1,func_e(a)=cos(a);,
    if(($11%4)==2,func_e(a)=tan(a);,
    if(($11%4)==3,func_e(a)=atan(a);
    );
    );
    );
    );,
   func_e(a)=cos(a);
   );,
  if(($14%4)==0,func_e(a)=sin(a);,
  if(($14%4)==1,func_e(a)=cos(a);,
  if(($14%4)==2,func_e(a)=tan(a);,
  if(($14%4)==3,func_e(a)=atan(a);
  );
  );
  );
  );
  );
  if(!narg($15),
   if(narg($12),
    if(($12%4)==0,func_f(a)=sin(a);,
    if(($12%4)==1,func_f(a)=cos(a);,
    if(($12%4)==2,func_f(a)=tan(a);,
    if(($12%4)==3,func_f(a)=atan(a);
    );
    );
    );
    );,
   func_f(a)=tan(a);
   );,
  if(($15%4)==0,func_f(a)=sin(a);,
  if(($15%4)==1,func_f(a)=cos(a);,
  if(($15%4)==2,func_f(a)=tan(a);,
  if(($15%4)==3,func_f(a)=atan(a);
  );
  );
  );
  );
  );
  popcorn_x(a,b)=(kb=K*b;a-H*func_a(b+func_b(Kb+func_c(Kb))));
  popcorn_y(a,b)=(ka=K*a;b-H*func_d(a+func_e(Ka+func_f(Ka))));
 ,
  if(narg($10),
   if(($10%4)==0,func_a(a)=sin(a);,
   if(($10%4)==1,func_a(a)=cos(a);,
   if(($10%4)==2,func_a(a)=tan(a);,
   if(($10%4)==3,func_a(a)=atan(a);
   );
   );
   );
   );,
  func_a(a)=sin(a);
  );
  if(narg($11),
   if(($11%4)==0,func_b(a)=sin(a);,
   if(($11%4)==1,func_b(a)=cos(a);,
   if(($11%4)==2,func_b(a)=tan(a);,
   if(($11%4)==3,func_b(a)=atan(a);
   );
   );
   );
   );,
  func_b(a)=tan(a);
  );
  if(!narg($12),
   if(narg($10),
    if(($10%4)==0,func_c(a)=sin(a);,
    if(($10%4)==1,func_c(a)=cos(a);,
    if(($10%4)==2,func_c(a)=tan(a);,
    if(($10%4)==3,func_c(a)=atan(a);
    );
    );
    );
    );,
   func_c(a)=sin(a);
   );,
  if(($12%4)==0,func_c(a)=sin(a);,
  if(($12%4)==1,func_c(a)=cos(a);,
  if(($12%4)==2,func_c(a)=tan(a);,
  if(($12%4)==3,func_c(a)=atan(a);
  );
  );
  );
  );
  );
  if(!narg($13),
   if(narg($11),
    if(($11%4)==0,func_d(a)=sin(a);,
    if(($11%4)==1,func_d(a)=cos(a);,
    if(($11%4)==2,func_d(a)=tan(a);,
    if(($11%4)==3,func_d(a)=atan(a);
    );
    );
    );
    );,
   func_d(a)=tan(a);
   );,
  if(($13%4)==0,func_d(a)=sin(a);,
  if(($13%4)==1,func_d(a)=cos(a);,
  if(($13%4)==2,func_d(a)=tan(a);,
  if(($13%4)==3,func_d(a)=atan(a);
  );
  );
  );
  );
  );
  popcorn_x(a,b)=a-H*func_a(b+func_b(K*b));
  popcorn_y(a,b)=b-H*func_c(a+func_d(K*a));
 );
);
if(x==0,
 iy=density*y;
 ix=density*z;
 xx=(ix-cx)*zcxsx+origin_x;
 yy=(iy-cy)*zcysy+origin_y;
 xnew=popcorn_x(xx,yy);
 ynew=popcorn_y(xx,yy);
 coordinates=["$fvx","$fvy"];
 xx=xnew;
 yy=ynew;
 ,
 xnew=popcorn_x(xx,yy);
 ynew=popcorn_y(xx,yy);
 coordinates=["$fvx","$fvy"];
 xx=xnew;
 yy=ynew;
);
coordinates;
"
sh. 0
sh.. 1
eval ${-math_lib}"
begin(
 const width="$ww";
 const height="$hh";
);
for(px=0,px<d,px++,
for(py=0,py<h,py++,
for(pz=0,pz<w,pz++,
 cx=i(#-2,pz,py,px);
 cy=i(#-1,pz,py,px);
 if(inrange(cx,0,width,1)&&inrange(cy,0,height,1),i(#-4,cx,cy)++;);
);
);
);
"
rm[-3--1]

The output shows a heavily darkened version of the Popcorn Fractal. It should in theory worked, but I have no idea what went wrong here. But I do believe it may has to do with the wrong order of filling.

The good news. Less than 6 s. And that is acceptable given PDN version that I have made would do thiis in 10 s, and the current gmic version would do this in 15 s. The most ideal solution is to be able to use something akin to fill, but allowing users to increment values at dest(x,y,z,c), and eval is too slow for this.

Nice. Have a :fish: for your efforts.

2 Likes

Thanks. I hope to find an answer as to what went wrong. The older one use a traditional for x, for y, for n loop, and the new one use parallel processing via 3d where x is for n, and y is y and z is x and with 2 channels representing coordinates.

Another way I can do this. Add a helper image, and blank 3d image with 2 channels. Apply repeat loop and j[3D_Block] [helper],0,0,$> and fill 3d block. Then use eval to fill coordinates to the target image. Obviously, none of these workaround are ideal, but needed to get under 6 s.


EDIT: Ok, I did the “Another way” approach, and it is just as fast as PDN version., and it actually works. Now, what really bothers me is the eval for x,y,z part of command takes up 5 s of the time it takes to compute. Is there like a way I can optimize that without trying to do the earlier approach which did not work? I might attempt the earlier approach.


I forgotten to announce that I think the Popcorn Fractal issue is resolved or likely to be resolved. If someone ran into a issue, let me know as there is in theory a potential for undefined behavior as it is multithreaded and two threads might hit same coordinates. Now you know.

I will be resuming new filters for gmic in a few days. I was watching the US general election.


Okay, maybe not in a few day. I’m in the process of improving a few filters of mine. Right now, a slight change to rep_form_pixel is coming though with a bit of rewrite to improve performance and enable multithreading. Not much gain in performance, but maybe I’ll be surprised since I am stuck with this laptop. Only .1 s per image faster. I suppose that is better.

C:\WINDOWS\system32>gmic sp lena,cat tic new_rep_form_pixel 5,32,32 toc
[gmic]-0./ Start G'MIC interpreter.
[gmic]-1./ Input sample image 'lena' (1 image 512x512x1x3).
[gmic]-2./ Input sample image 'cat' (1 image 600x550x1x3).
[gmic]-2./ Initialize timer.
[gmic]-2./ Elapsed time: 1.096 s.
[gmic]-2./ Display images [0,1] = 'lena, cat'.
[0] = 'lena':
  size = (512,512,1,3) [3072 Kio of floats].
  data = (225.881,225.881,225.881,225.881,225.881,225.881,225.881,225.881,225.881,225.881,225.881,225.881,(...),81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322).
  min = 22.5919, max = 243.269, mean = 128.241, std = 52.3962, coords_min = (480,32,0,1), coords_max = (463,385,0,0).
[1] = 'cat':
  size = (608,576,1,3) [4104 Kio of floats].
  data = (211.003,211.003,211.003,211.003,211.003,211.003,211.003,211.003,211.003,211.003,211.003,211.003,(...),58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477).
  min = 4, max = 233.933, mean = 112.883, std = 60.041, coords_min = (335,1,0,0), coords_max = (367,225,0,0).
[gmic]-2./ End G'MIC interpreter.

C:\WINDOWS\system32>gmic sp lena,cat tic rep_form_pixel 5,32,32 toc
[gmic]-0./ Start G'MIC interpreter.
[gmic]-1./ Input sample image 'lena' (1 image 512x512x1x3).
[gmic]-2./ Input sample image 'cat' (1 image 600x550x1x3).
[gmic]-2./ Initialize timer.
[gmic]-2./ Elapsed time: 1.343 s.
[gmic]-2./ Display images [0,1] = 'lena, cat'.
[0] = 'lena':
  size = (512,512,1,3) [3072 Kio of floats].
  data = (225.881,225.881,225.881,225.881,225.881,225.881,225.881,225.881,225.881,225.881,225.881,225.881,(...),81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322,81.8322).
  min = 22.5919, max = 243.269, mean = 128.241, std = 52.3962, coords_min = (480,32,0,1), coords_max = (463,385,0,0).
[1] = 'cat':
  size = (608,576,1,3) [4104 Kio of floats].
  data = (211.003,211.003,211.003,211.003,211.003,211.003,211.003,211.003,211.003,211.003,211.003,211.003,(...),58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477,58.9477).
  min = 4, max = 233.933, mean = 112.883, std = 60.041, coords_min = (335,1,0,0), coords_max = (367,225,0,0).
[gmic]-2./ End G'MIC interpreter.

Edit: Now, I managed to get it under .5 s it seems. Will update Tiled Form by tonight.