fx_wind filter doesn't react to all angles

Filter name: fx_wind
Author: David Tschumperlé
Latest Update: 2011/13/07

Can I edit the source code for this 12 year old filter to react on all angles? 0-360 degrees?

Currently it only creates wind at approx 45 degree angles. No matter, what precise value I set in the angle input field: “299.16” or “339.12” the result remains the same.
Here is the image:
prayer_Beads_GIMP_red_streaks

I want all the runes to emit light in their proper directions, where they are facing: I don’t care, if I have to render 10 images for all the angles and photoshop it all together. But this plugin refuses to create wind in all angles.

Where is the source code for this filter?
I only found the GUI setup script in
“gmic_qt_filters.dat”

I want to edit the source code for this. How does this process work?

#@gui Wind : fx_wind, fx_wind_preview(0)
#@gui : Amplitude = int(20,0,500)
#@gui : Angle = float(0,0,360)
#@gui : Attenuation = float(0.7,0,1)
#@gui : Threshold = float(20,0,100)
#@gui : Mode = choice(1,"Darker","Brighter")
#@gui : sep = separator()
#@gui : Channel(s) = choice("All","RGBA [All]","RGB [All]","RGB [Red]","RGB [Green]","RGB [Blue]","RGBA [Alpha]",
#@gui : "Linear RGB [All]","Linear RGB [Red]","Linear RGB [Green]","Linear RGB [Blue]","YCbCr [Luminance]",
#@gui : "YCbCr [Blue-Red Chrominances]","YCbCr [Blue Chrominance]","YCbCr [Red Chrominance]",
#@gui : "YCbCr [Green Chrominance]","Lab [Lightness]","Lab [ab-Chrominances]","Lab [a-Chrominance]",
#@gui : "Lab [b-Chrominance]","Lch [ch-Chrominances]","Lch [c-Chrominance]","Lch [h-Chrominance]","HSV [Hue]",
#@gui : "HSV [Saturation]","HSV [Value]","HSI [Intensity]","HSL [Lightness]","CMYK [Cyan]","CMYK [Magenta]",
#@gui : "CMYK [Yellow]","CMYK [Key]","YIQ [Luma]","YIQ [Chromas]","RYB [All]","RYB [Red]","RYB [Yellow]","RYB [Blue]")
#@gui : Value Action = choice("None","Cut","Normalize")
#@gui : sep = separator()
#@gui : Preview Type = choice("Full","Forward Horizontal","Forward Vertical","Backward Horizontal",
#@gui : "Backward Vertical","Duplicate Top","Duplicate Left","Duplicate Bottom","Duplicate Right",
#@gui : "Duplicate Horizontal","Duplicate Vertical","Checkered","Checkered Inverse")
#@gui : Preview Split = point(50,50,0,0,200,200,200,0,10)_0
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>David Tschumperlé</i>.      Latest Update: <i>2011/13/07</i>.</small>")
fx_wind :
  if !$5 negate fi
  ac "wind ${1-4}",$6,$7
  if !$5 negate fi

fx_wind_preview :
  gui_split_preview "fx_wind $*",${-3--1}





#@cli wind : _amplitude>=0,_angle,0<=_attenuation<=1,_threshold
#@cli : Apply wind effect on selected images.
#@cli : Default values: 'amplitude=20', 'angle=0', 'attenuation=0.7' and 'threshold=20'.
#@cli : $ image.jpg +wind ,
wind : check "isint(${1=20}) && $1>=0 && ${3=0.7}>=0 && $3<=1" skip "${2=0},${4=20}"
  e[^-1] "Apply wind effect on image$?, with amplitude $1, angle "{round($2/45)*45}" deg., attenuation $3
          and threshold $4."
  if !$1 return fi
  dxdy=${-_wind{round($2/45)%8}}
  fact={(1-$3)^(1/$1)}
  foreach {
    +gradient_norm >=. $4%
    r. 100%,100%,1,.. *. ..
    repeat $1 {
      shift. $dxdy,0,0,0 max.. . *. $fact
      remove_pixels. {100/$1}%
    }
    rm.
  }

_wind0 : u 1,0
_wind1 : u 1,1
_wind2 : u 0,1
_wind3 : u -1,1
_wind4 : u -1,0
_wind5 : u -1,-1
_wind6 : u 0,-1
_wind7 : u 1,-1

1 Like

You are right.
I’ve made some changes to fix this.

Filters update is ready, so if you use G’MIC-Qt 3.2.0+, pressing the “Filter Update” button should correct your current filter version.

For information, here is the new code for command wind :

#@cli wind : _amplitude>=0,_angle,0<=_attenuation<=1,_threshold
#@cli : Apply wind effect on selected images.
#@cli : Default values: 'amplitude=20', 'angle=0', 'attenuation=0.7' and 'threshold=20'.
#@cli : $ image.jpg +wind ,
wind : check "isint(${1=20}) && $1>=0 && ${3=0.7}>=0 && $3<=1" skip "${2=0},${4=20}"
  e[^-1] "Apply wind effect on image$?, with amplitude $1, angle $2 deg., attenuation $3 and threshold $4."
  if !$1 return fi
  dx,dy,fact:=[cexp([0,$2°]),(1-$3)^(1/$1)]
  foreach {
    +gradient_norm >=. $4% M:=iM
    r. 100%,100%,1,.. *. ..
    repeat $1 { +shift. {round($>*[$dx,$dy])} max[0,-1] *. $fact remove_pixels. {100/$1}% }
    rm.
  }

Updated filter and thank you, its working beautifully!!!
I wanted only the magic runes to glow and here is the result! :hibiscus: :star2: :medal_military: :medal_sports:
Beads_Red_Only_ALPHA_DONE

2 Likes

So cool ! :star_struck: