Skip to content

Instantly share code, notes, and snippets.

@flamendless
Created March 8, 2019 14:45
Show Gist options
  • Save flamendless/4fa8d8dad6338ce2f000f0bf30734a24 to your computer and use it in GitHub Desktop.
Save flamendless/4fa8d8dad6338ce2f000f0bf30734a24 to your computer and use it in GitHub Desktop.
from steveroll over @ discord
extern number minRadius = 0.05;
extern number maxRadius = 0.1;
extern number mul = 0.01;
extern vec2 center = vec2(0.5,0.5);
number dist(vec2 a, vec2 b){
return sqrt(pow(b.x-a.x,2)+pow(b.y-a.y,2));
}
vec4 effect(vec4 color, Image tex, vec2 tc, vec2 sc){
number d = dist(tc,center);
if(d >= minRadius && d <= maxRadius){
number td = 1-abs((d-minRadius)/(maxRadius-minRadius)-0.5)*2;
tc.y += td*mul;
}
return Texel(tex, tc) * color;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment