Reptillian

Reptorian's G'MIC Code Workshop

Recommended Posts

Added projects to my own g'mic community fork. Also, my g'mic community fork has been updated.

 

https://github.com/Reptorian1125/gmic-community/projects

 

These are the list of projects to do.

Recreate all of MadJik plugins with extension - Permission has been given by MadJik to reverse-engineer those plugins. Ask MadJik if you want confirmation.

Create g'mic gossamer - Create my own version of gossamer. No reverse engineering has been done.

Update modular_formula - N/A

Update Pseudo-ECB script - See Joan Rake's G'MIC Pseudo-ECB. I am upgrading that.

 

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

Minor update, 2 of my projects has been closed. I completed modf, and I have managed to make rep_tfrac more maintainable. modf calculates the result the fastest way I can get it to.

 

For Projects reference:

 

1.Add support for custom palette for Autofill Coloring Book
2.Upgrade Construction Material Texture
3.Recreate all of MadJik plugins with extension - Permission has been given by MadJik to reverse-engineer those plugins. Ask MadJik if you want confirmation.
4.Create g'mic gossamer
5.Create my own version of gossamer. No reverse engineering has been done. - See Joan Rake's G'MIC Pseudo-ECB. I am upgrading that.

 

Note - modf is basically the g'mic version of Image Modulo Toolkit I have made for Paint.NET.

 

Pull Request Link -

https://github.com/dtschump/gmic-community/pull/239

Edited by Reptillian

Share this post


Link to post
Share on other sites

Here's some new changes.

 

Some of my filters have been moved to Distortions and Rendering. Nebulous is under Rendering now. The only fixes that would be needed to them are cosmetic fixes basically as in better description/grammar and forgotten credits (distortions part needs attribution which I will do even if I mentioned who did the original version @Asmageddon Prince before). They don't have bugs otherwise.

 

Thorn Fractal has been upgraded. Now, you can insert custom alternating formula. 

 

EDIT: Definitely here. Refresh filters.

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

I have made a new filter named Majority. Yes, it operates on the very same principles as the one MadJik has made, but extended. It has arrived by the way.

Edited by Reptillian

Share this post


Link to post
Share on other sites

It been a while since I have been into this thread, but now I got something thanks to @Creed31 that indirectly gave me the idea.

 

New Filter - Rectangle-Square Fill

 

I will be finishing up the image mapping version of tomorrow or two, and immediately push it by then.

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

Taken a break from that for a while. So, here's what I did: I have pushed rep_primelist cli and rep_prime_surface (The algorithm is slow, but miles faster than the earlier one), better version of Grouped Pixels Shift filter, some undeveloped cli only pushed there for development purpose and backup. The rectangular fill surface isn't really finished yet, but there is some new clis related to it, so that I can get to working when I'm really back with g'mic development.

 

Also, the algorithm for the Grouped Pixels Shift filter is literally fast, and I believe it can be introduced very easily in context of PDN and C#. So, I will share the code here with a explanation.

 

Is multiple surfaces possible in Paint.NET plugin? @Ego Eram Reputo This code uses 4 different surfaces. If not, I'll delete this since it can't be translated.

#@cli rep_sptbwgp: (eq. to rep_shift_pixel_to_boundary_with_group_pixels)
rep_sptbwgp: rep_shift_pixel_to_boundary_with_group_pixels $*
#@cli rep_shift_pixel_to_boundary_with_group_pixels: -1<=_position<=1, _axis={ 0=Horizontal | 1=Vertical }, 0<=_influence_factor<=1, _threshold>=0,_channel_mode
#@cli : Shifts pixels to boundary by percentage using grouped pixels. position less than .5 means shift will be negative, and position greater than .5 means shift will be positive.
#@cli : Assign an argument to _channel_mode if you want to disable restricting effect on alpha channel or avoid manipulating 4 channels image in case of CMYKA image. Only use in rare cases!
#@cli : Default values: '_position=-1','_axis=1','_influence_factor=1','_threshold=0','_channel_mode='
rep_shift_pixel_to_boundary_with_group_pixels:
skip ${1=-1},${2=1},${3=.5},${4=0},${5=}

any_channels=0 #In context of PDN, you can ignore this#
tcr=3          #In context of PDN, you can ignore this#
influence_factor={min(abs($3),1)} #Determines the amount of effect to be applied#
position={(($1+1)/2)}             #Position shift of rows/column#
if   $position<0 position=0 #In context of PDN, you can ignore this#
elif $position>1 position=1 #In context of PDN, you can ignore this#
fi

if narg($5) #In context of PDN, you can ignore this#
    if $5>=0 
        tcr+=1
    else
        any_channels=1
    fi
fi #In context of PDN, you can ignore this#

if $influence_factor #Effect will apply if and only if influence factor is greater than 0#
repeat $! l[$>]
if (s==2||s>$tcr)||$any_channels #Ignore this#
ss={s-1}
sh $ss f. "i>$4?i:0" rm.                          #If alpha value is less than threshold, then alpha value is 0#
{w},{h},1,1,i(#-1,x,y,0,$ss)?1                    #Create new surface with alpha value#
if $2 {w},1,1,1,sum(crop(#-1,x,0,0,0,1,h#-1,1,1)) #Create horizontal vector if axis direction is vertical. Value of vector is equal to the sum of columns in the newly created surface prior to this one.#
else  1,{h},1,1,sum(crop(#-1,0,y,0,0,w#-1,1,1,1)) #Create vertical vector if axis direction is horizontal. Value of vector is equal to the sum of rows in the newly created surface prior to this one.#
fi
{w#-2},{h#-2},1,{$ss+1}                           #Create processing surface#

eval ${-math_lib}"
influence_factor="$influence_factor"; #Used for weighted average calculation#
invert_factor=1-influence_factor;     #Used for weighted average calculation#
position="$position";                 #Defines where the pixel will go#
if($2,                                #If pixel will shift vertically, then...#
    for(xx=0,xx<w#-1,xx++,            #Loop per pixel#
        nyy=h#-1-1;
        if(i(#-2,xx,0),
            N=i(#-2,xx,0);            #Use horizontal vector to find sum of column#
            tyy=h#-1-N;               #To make sure that shift do not go overbound#
            nyy-=tyy*position;        #This is what defines the position of pixels#
            for(yy=h#-1-1,yy>-1,yy--, #Loop per pixel#
                if(N,                 #If N is greater than 0, then...#
                    if(i(#-3,xx,yy),  #If there is an alpha value greater than 0 in surface number 2.#
                        N--;
                        tnyy=influence_factor*nyy+invert_factor*yy;          #Used weighted average to calculate final result#
                        if(position==1,I(#-1,xx,ceil(tnyy))=I(#-4,xx,yy);    #I had to use ceil or floor to avoid bugs#
                                      ,I(#-1,xx,floor(tnyy))=I(#-4,xx,yy);   #I had to use ceil or floor to avoid bugs#
                        );
                        nyy--;                                               #Used to place pixels with alpha greater than 0 on the edge of final image#
                    );
                ,break(); #Escape xx loop when N is 0#
                );
            );
        );
    );
,
    for(yy=0,yy<h#-1,yy++,
        nxx=0;
        if(i(#-2,0,yy),
            N=i(#-2,0,yy);
            txx=w#-1-N;
            nxx+=txx*position;
            for(xx=0,xx<w#-1,xx++,
                if(N,
                    if(i(#-3,xx,yy),
                        N--;
                        tnxx=influence_factor*nxx+invert_factor*xx;
                        if(position==1,I(#-1,floor(tnxx),yy)=I(#-4,xx,yy);
                                      ,I(#-1,ceil(tnxx),yy)=I(#-4,xx,yy);
                        );
                        nxx++;
                    );
                ,break();
                );
            );
        );
    );
);
"
k. #end result#
fi
endl done
fi

 

Edited by Reptillian

Share this post


Link to post
Share on other sites
42 minutes ago, Ego Eram Reputo said:

I've never heard of four surfaces being used. I'm sure it could be done. I'm just as sure there must be a less cumbersome way to do it.

I had to use G'MIC internal codes, hence 4 surface. That being said...

 

In context of C# and PDN: I think you only need two surfaces. The N value can be found by looping through current row/column and checking if alpha value is greater than 0, and if it is, N++. Then perform the shift found in codes deeper than N value code. Perhaps, it wasn't as straight forward even if it use the general for x,y codes. I may attempt to convert this as an alternative plugin to MadJik Gravity as this version has float-based influence and float-based position factors.

Edited by Reptillian

Share this post


Link to post
Share on other sites

Fragment Blur has been moved from Testing to Degradation. Furthermore, I changed it so that half-hypotenuse is used instead because result don't change all that much, and you have higher degree of precision.

Share this post


Link to post
Share on other sites

Object Size Filtering has been upgraded. It's a bit harder to use now, but also far more flexible.

 

Other details:

1. I fixed descriptor for Nebulous

2. I have added credits to @Asmageddon Prince in Logarithmic Distortion series.

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

2 New Filters

1. Point Warp

2. Prime Surface

 

This picture below is made with prime surface+gmic smooth[anistropic]. I applied heavy JPEG compression as the idea is important.

 

prime_anistropic.jpg.a2277c6c981dba4e70c4879150c07c7c.jpg

Share this post


Link to post
Share on other sites

Looks like I'm bringing new filters at a faster rate again.

 

I'm making a new filter now. Paste this to code filters inside gmic-qt and see what you get. Yes, it's a better variant of one of MadJik's Donut Distort with new modes, and there's the option to wrap around the image with different boundary condition.

 

Obligatory note: Permission been granted to use his code.

#$1=_torus_circu_min_dimension_percent_1#
#$2=_torus_circu_min_dimension_percent_2#
#$3=_mode_1#
#$4=_mode_2#
#$5=_mode_percent_comb#
#$6=_offset#
#$7=_offset_duplicates#
#$8=_interpolation#
#$9=_boundary#
#$10=_eff_mix#

{w*2},{h*2},1,1,"
    begin(
    ww=w-1;
    hh=h-1;
    sd=max(w,h)/min(w,h);
    sx=w>h?sd:1;
    sy=w>h?1:sd;
    torus_val_1=.85;
    torus_val_2=.5;
    new_min=min(torus_val_1,torus_val_2);
    new_max=max(torus_val_1,torus_val_2);
    old_max=max(1,0);
    old_min=min(1,0);
    nm(v)=((old_max-old_min)/(new_max-new_min))*(v-new_max)+new_max;
    oldcut(v)=v>old_max?old_max:(v<old_min?old_min:v);
    bndcut(v)=v>old_max||v<old_min?0:1;
);
xx=(x/ww-.5)*2*sx;
yy=(y/hh-.5)*2*sy;
radial_gradient=sqrt(xx^2+yy^2);
[oldcut(nm(radial_gradient)),bndcut(nm(radial_gradient))];
"

r2dx. 50%,3
r. 100%,100%,100%,2

f. "begin(
    dist=min(w,h)/2;
    sd=max(w,h)/min(w,h);
    sx=w>h?sd:1;
    sy=w>h?1:sd;
    ww=w-1;
    hh=h-1;
    max_ang=40;
    max_ang*=-1;
    ang2rad(v)=pi*(v/180);
    rot_x(a,b,c)=a*cos(ang2rad(c))-b*sin(ang2rad(c));
    rot_y(a,b,c)=a*sin(ang2rad(c))+b*cos(ang2rad(c));
    softmode(v)=(cos(v*(2*pi)-pi)+1)/2;
    midmode(v)=abs(cos(v*pi+pi/2));
    hardmode(v)=sqrt(1-(abs(v-.5)*2)^2);
    distroymode(v)=cos(v*pi)*i1;
    invdistroymode(v)=(cos(v*pi)*-1)*i1;
    quadextrudemode(v)=1-abs(v-.5)*2;
    hexextrudemode(v)=(r=(1-abs(v-.5)*2)*2;r>1?1:r);
);
z_depth=quadextrudemode(i0)*max_ang;
xx=(x/ww-.5)*2*sx;
yy=(y/hh-.5)*2*sy;
XX=rot_x(xx,yy,z_depth);
YY=rot_y(xx,yy,z_depth);
XX/=2*sx;
YY/=2*sy;
XX+=.5;
YY+=.5;
XX*=ww;
YY*=hh;
[x-XX,y-YY]
"

shift. 0%,0%,0,0,2,1

f[^-1] "i(x-i(#-1,x,y,z,0),y-i(#-1,x,y,z,1),z,c,1,3)"
rm.

 

Edited by Reptillian
  • Upvote 1

Share this post


Link to post
Share on other sites

Minor update: I have added new color space for G'MIC. Xerox's YES. Those options are available for Nebulous and Color Modulo Texture. I might add some more color space like TSL, and Kodak series. Kodak series of color space and YES are obscure, but they are found within a blog.

Edited by Reptillian

Share this post


Link to post
Share on other sites

1. Glass Vignette received the color space conversion support.

2. I have converted TechnoRobbo's Strange Attractor with success. There's some differences though such as negative value support as well as exponential value support. There's no color mapping support. I believe exponential value is enough as Paint.NET and other programs already have ways to enable users to color map, and all exponential value would do is to enable one to alter the midpoint. That inherently enables more way to color map.

3. I have also added a new filter called Trigonometric Mapping. This filter maps trigonometric functions into image.

Edited by Reptillian
  • Like 2

Share this post


Link to post
Share on other sites

After much time, I finally figured out how to get symmetry mode into the new interactive filter. For proof:

 

NOTE: Not available on G'MIC-QT yet. I'm still working on adding more features before pushing.

 

hrnPoeI.png

Edited by Reptillian

Share this post


Link to post
Share on other sites

Non-Isometric RPG Tiler(Interactive) has been updated to version 2. It now supports symmetrical editing, and better window message. I believe it's easier to work with. You can also replace, cut with version 2 filter.

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

It seems that version 3 of rpg tiler is coming nicely. Version 3 will contain a new editing mode, and it will be about manipulating rows and columns. There may be version 4 which will allow you to import tile position data, and use another tileset. So, you can replace tiles placed with another tiles from another tileset.

 

Now, I got a question for @lynxster4 or anyone else - Should there be a separate option for exporting the final tile or make the placed tile fit the canvas instead? This is a workaround to out-of-bound placed tiles in context of Paint.NET.

Edited by Reptillian

Share this post


Link to post
Share on other sites
44 minutes ago, Reptillian said:

make the placed tile fit the canvas instead

 

This option sounds nice.  Can both options be implemented?

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.