Add vertical blurring, and fix a bug where not all taps would be used.
[movit] / blur_effect.frag
1 // A simple unidirectional blur.
2
3 uniform vec2 PREFIX(pixel_offset);
4 uniform float PREFIX(weight)[15];
5
6 vec4 FUNCNAME(vec2 tc) {
7         vec4 x = LAST_INPUT(tc);
8         return
9                 vec4(PREFIX(weight)[ 0]) * LAST_INPUT(tc - 7.0 * PREFIX(pixel_offset)) +
10                 vec4(PREFIX(weight)[ 1]) * LAST_INPUT(tc - 6.0 * PREFIX(pixel_offset)) +
11                 vec4(PREFIX(weight)[ 2]) * LAST_INPUT(tc - 5.0 * PREFIX(pixel_offset)) +
12                 vec4(PREFIX(weight)[ 3]) * LAST_INPUT(tc - 4.0 * PREFIX(pixel_offset)) +
13                 vec4(PREFIX(weight)[ 4]) * LAST_INPUT(tc - 3.0 * PREFIX(pixel_offset)) +
14                 vec4(PREFIX(weight)[ 5]) * LAST_INPUT(tc - 2.0 * PREFIX(pixel_offset)) +
15                 vec4(PREFIX(weight)[ 6]) * LAST_INPUT(tc -       PREFIX(pixel_offset)) +
16                 vec4(PREFIX(weight)[ 7]) * LAST_INPUT(tc) +
17                 vec4(PREFIX(weight)[ 8]) * LAST_INPUT(tc +       PREFIX(pixel_offset)) +
18                 vec4(PREFIX(weight)[ 9]) * LAST_INPUT(tc + 2.0 * PREFIX(pixel_offset)) +
19                 vec4(PREFIX(weight)[10]) * LAST_INPUT(tc + 3.0 * PREFIX(pixel_offset)) +
20                 vec4(PREFIX(weight)[11]) * LAST_INPUT(tc + 4.0 * PREFIX(pixel_offset)) +
21                 vec4(PREFIX(weight)[12]) * LAST_INPUT(tc + 5.0 * PREFIX(pixel_offset)) +
22                 vec4(PREFIX(weight)[13]) * LAST_INPUT(tc + 6.0 * PREFIX(pixel_offset)) +
23                 vec4(PREFIX(weight)[14]) * LAST_INPUT(tc + 7.0 * PREFIX(pixel_offset));
24 }