Reptorian G'MIC Filters

The crack idea is great, and I intend to extend construction material even further with that. That being said, due to the crack idea being challenging. I decided to push the asmageddon tool converted into g’mic, and extended - Extended Paint.NET Asmageddon's Tools converted by Reptorian1125 · Pull Request #191 · dtschump/gmic-community · GitHub , and will only work on crack texture generation, and then add it into construction material.

Seem like plasma → thin edge → erode - > plasma trimming - > usage of distance transform (for transparency support as you could use the cracks for layering) would be the way to go for creating cracks. But, that’s only a theory, I do know that thin edge will probably lead into the answer.

2 Likes

Oh no, logarithmic distortion filter do crash. I’m not sure why it was working fine from my end until after the update.

#@cli rep_logpindis: (eq. to rep_logarithmic_pinching_distortion)
rep_logpindis: rep_logarithmic_pinching_distortion $*
#@cli rep_logarithmic_pinching_distortion: _distortion_main>=0,-1<=_preshift_x<=1,-1<=_preshift_y<=1,-1<=_effposition_x<=1,-1<=_effposition_y<=1,_prescale_x,_prescale_y,_afterscale_x,_afterscale_y,0<=_angle<=360,_mirror_placement= { 0=outside-in | 1=inside-out },_lx_axis= { 0=different axis | 1=same axis},_ly_axis= { 0=different axis | 1=same axis},ix_dir={ 0=negative | 1=positive },iy_dir={ 0=negative | 1=positive },_boundary= { 0=Periodic | 1=Mirror },1<=_interpolation<=5,_dimension_ref>0
rep_logarithmic_pinching_distortion:
skip ${2=0},${3=0},${4=0},${5=0},${6=1},${7=1},${8=1},${9=1},${10=0},${11=0},${12=1},${13=0},${14=1},${15=0},${16=0},${17=5},${18=1024}
if $6==0||$7==0||$8==0||$9==0 v + error "Scale cannot be 0!" v - fi
if $17<1 v + error "interpolation cannot be less than 1" v - fi

shift {50*$2}%,{50*$3}%,0,0,3,1
f "
sd=w/h;
ang=pi*($10/180);
ox=$4*-1;
oy=$5;
ox/=h>w?1/sd:1;
oy/=w>h?sd:1;
OX=ox*cos(ang)-oy*sin(ang);
OY=ox*sin(ang)+oy*cos(ang);
ox=OX;
oy=OY;
ix=((x/w)-.5)/(h>w?1/sd:1);
iy=((y/h)-.5)/(w>h?sd:1);
IX=ix*cos(ang)-iy*sin(ang);
IY=ix*sin(ang)+iy*cos(ang);
ix=IX;
iy=IY;
ix=abs(ix+ox/2)*$6;
iy=abs(iy+oy/2)*$7;
ed=int(abs($18));
ed/=2;
ix*=ed;
iy*=ed;
lx=ix==0||iy==0?log(10^-8)*$1:log($12?iy^2:ix*iy)*$1;
ly=iy==0||iy==0?log(10^-8)*$1:log($13?ix^2:ix*iy)*$1;
dx=($14?1:-1);
dy=($15?1:-1);
ix-=lx*dx;
iy-=ly*dy;
ix*=w/ed;
iy*=h/ed;
ix*=$8;
iy*=$9;
i(ix,iy,z,c,$17,($16?3:2));
"
if $11 shift 50%,50%,0,0,3,1 fi

Here’s the code. I don’t see div by 0 anywhere or inf anywhere.

@David_Tschumperle : Did I discovered a bug? @Joan_Rake1 didn’t find anything wrong. And it seem a programmer in Paint.NET forum didn’t find anything wrong either.

Just posting this here to try in the morning - http://www.bensecret.com/2011/08/04/a-better-way-to-saturate-film-colour-cracked-in-photoshop/

2 Likes

Try using mix_channels for that since it allows you to specify a matrix for mixing the channels together.

Early development at a crack texture. The speed is a big limiting issue. This result closely match actual road crack texture.

f 0 channels 0 turbulence 55,28,1.5,0,0 noise 12  b 2.5% fx_make_seamless 15 gradient_norm >= 25% thinning 1 n 0,255 f 255-i 

Test Case Below [Don’t mind the border on top, that’s just a copy and paste bug I’m having)

image

EDIT: Also, I might follow this tutorial and translate it to g’mic, I’ll check that out too - https://www.artstation.com/daniel_swing/blog/yDB9/micro-tutorial-1-concrete-and-cracks

EDIT: I found something I don’t think I get - Splatter Circular?

2 Likes

To my knowledge, thinning is very slow. You might want to use something like gradient_norm with a threshold afterwards, or you could exploit any bubble-like textures which might result from turbulence.

To understand why morphological thinning is slow, here is a description of the algorithm: https://homepages.inf.ed.ac.uk/rbf/HIPR2/thin.htm

Got news, it seem like my health is on decline as it has been for years due to a nose problem. At this point, I can’t effectively can’t do anything until I get resolved. I can still visit once in a while. So, I’ll have to hold back on this for a good while. Maybe a half a month.

2 Likes

Get well soon!

Sorry to hear that. All my wishes for recovery!

You’re among the best script writers here, hope to see you again soon.

Definitely the most prolific one. Can’t keep up.

I hope you recover well and quickly, your continuous stream of ideas will be sorely missed!

I decided to return here as I am in a way better state of being (My legs was in pain for about a week, but adapted and my overall fatigue is almost back to usual), but am not developing filters until after surgery as I am a bit more fatigued than usual. I was initially planning to make new filters after my surgery at this date and release it as a surprise of being back after initial recovery, but that got delayed as it going to be in in next month. So, I’m available here too.

2 Likes

Well, seem like I’m a little bit better. Leg was in pain, then comes a bad insomnia (1 hour of sleep at most for a week), and now that I recovered from that. I will be working on filters though a bit slowly since it’s a little too hard after suffering from all of that.

Maybe I shouldn’t really be doing this and take more rest. But, I’ll probably do anyway.

if 1 to_gray fi #One Channel#
3,3,1,1
f. "
ang=pi*(50/180);
ix=x-1;
iy=y-1;
IX=ix*cos(ang)-iy*sin(ang);
IY=ix*sin(ang)+iy*cos(ang);
ix=IX;
iy=IY;
sur=(atan2(abs(ix),iy)-pi/2)/(pi/2);
!((x==1)&&(y==1))?sur*2:0;
"
convolve.. .,1,1 k.. blur 5 n -1,1
if 1 + 1 * 127.5 fi #if 8bit, then 0#

Paste this to code filter to see what I’m working on. It’s a better version of emboss filter of my own as it applies to multiple channels at once. I’ll probably have to add something in the end for legacy support or something.

1 Like

Glad you are doing better. Should the if-statements contain variables? The result is a smooth and blurry emboss.

The blur and angle parameters will most likely involve command variables. Personally I would add contrast, amplitude and range-limiting parameters but I’m a bit busy.

Took a break from emboss to do something else. Reason being is that I haven’t figured out how to normalize range properly without using n x,y technique. That being said, I’m working on my own “Stitch” filter. Modulo is to ensure stitch stays repeating. Keep_Layer is going to be used for multi-angle stitching.

repeat $! l[$>]
Preserve_Size=1
Keep_Layer=0
Sublevel=1
Angle_Stitch=199
Thickness=1
Interpolation=3
Intensity=30
Boundary=1
Modulo_Factor=0
ang={pi*($Angle_Stitch/180)}
ang2={pi*(($Angle_Stitch+90)/180)}
iw={w}
ih={h}
r {($Sublevel+1)*100}%,{($Sublevel+1)*100}%,100%,100%,1
{w},{h},1,1,sur=x*cos($ang)+y*sin($ang);res=floor(sur/($Thickness*($Sublevel+1)));$Modulo_Factor?abs(res)%$Modulo_Factor:abs(res)
{max(1,round(iM,1,1))},1,1,1,u(256) map.. . rm. -. {iM/2} n. -1,1
repeat s#0 sh[0] $>
f. "sx="$Sublevel"*"$Intensity"*cos("$ang2")*i#1;sy="$Sublevel"*"$Intensity"*sin("$ang2")*i#1;sx+=x;sy+=y;i(sx,sy,z,c,"$Interpolation","$Boundary")" rm.
done
if !$Keep_Layer rm. fi
if $Preserve_Size r[0] {$iw},{$ih},100%,100%,{$Interpolation} fi
endl
done

Also, I believe this might be interesting for glitch purpose.

Could you be a little more specific? Give us a simple example.

(-1,-1,-1;1,1,1)
convolve.. .,1,1

If I do this, then [0] has normalized range. But the problem here is that I would like to normalize the layer using the min,max values and “color space min,max values”. I know the normalization formula. What if the result of convolve exceed expected range? The other way I can avoid doing this to stimulate emboss filter is to use rep_sdaxy and outputting 2 layers with distance of 1 pixel, and then averaging them together. That’s how I can emboss while ignoring values.


EDIT:

Also putting this here to work on the stitch filter at the hospital as I’m about to get surgery:

_stitch:
#intensity = $1#
#angle = $2#
#thickness = $3#
#modulo = $4#
#interpolation = $5#
#boundary = $6#
#sublevel = $7#
#preserve_size = $8#
#keep_layer = $9#
repeat $! l[$>]
skip ${3=1},${4=5},${5=3},${6=1},${7=1},${8=1},${9=0}
ang={pi*($2/180)}
ang2={pi*(($2+90)/180)}
iw={w}
ih={h}
r {($7+1)*100}%,{($7+1)*100}%,100%,100%,1
{w},{h},1,1,sur=x*cos($ang)+y*sin($ang);res=floor(sur/($3*($7+1)));$4?abs(res)%$4:abs(res)
{max(1,round(iM,1,1))},1,1,1,u(-1,1) map.. .
repeat s#0 sh[0] $>
f. "sx=$7*$1*cos("$ang2")*i#1;sy=$7*$1*sin("$ang2")*i#1;sx+=x;sy+=y;i(sx,sy,z,c,$5,$6)" rm.
done
if !$9 k[0] fi
if $8 r[0] {$iw},{$ih},100%,100%,$6 fi
endl done