light_world.lua/lib/shaders/postshaders/radialblur.glsl
Tim Anema 7fe549a01a optimizations to say the least
-cut out complicated light angle calulations and instead put in a arc
stencil
-stenciled the range of each light to optimize the shader drawing
-refactors postshaders to user proper love variables
-minimized amount of canvases
-added better functionality to my canvas util
-refactored blurring to be in one place
2014-12-19 22:54:29 -05:00

21 lines
430 B
GLSL

#define nsamples 5
extern number blurstart = 1.0; // 0 to 1
extern number blurwidth = -0.02; // -1 to 1
vec4 effect(vec4 vcolor, Image texture, vec2 texture_coords, vec2 pixel_coords)
{
vec4 c = vec4(0.0, 0.0, 0.0, 1.0);
int i;
for (i = 0; i < nsamples; i++)
{
number scale = blurstart + blurwidth * (i / float(nsamples-1));
c.rgb += Texel(texture, texture_coords * scale).rgb;
}
c.rgb /= nsamples;
return c;
}