27 lines
553 B
GLSL
27 lines
553 B
GLSL
// blur fade from Spooktober
|
|
|
|
#define PI 3.14159265
|
|
|
|
void main()
|
|
{
|
|
vec2 coord = TexCoord;
|
|
vec2 tsiz = vec2(textureSize(InputTexture,0));
|
|
vec2 bof = vec2((tsiz.y/tsiz.x),1.)/256.;
|
|
vec4 res = texture(InputTexture,coord);
|
|
int rsamples, tstep = 1;
|
|
float bstep;
|
|
vec2 rcoord;
|
|
for ( int i=1; i<=3; i++ )
|
|
{
|
|
rsamples = i*3;
|
|
for ( int j=0; j<rsamples; j++ )
|
|
{
|
|
bstep = PI*2.0/rsamples;
|
|
rcoord = vec2(cos(j*bstep),sin(j*bstep))*i;
|
|
tstep++;
|
|
res += texture(InputTexture,coord+rcoord*bof*strength);
|
|
}
|
|
}
|
|
res /= tstep;
|
|
FragColor = res;
|
|
}
|