2013-11-30 16:33:06 -05:00
|
|
|
uniform sampler2D tex;
|
|
|
|
uniform vec2 pixel;
|
|
|
|
|
2014-02-28 11:29:05 -05:00
|
|
|
#if __VERSION__ >= 130
|
2014-02-12 17:32:18 -05:00
|
|
|
in vec2 uv;
|
2014-01-19 13:31:00 -05:00
|
|
|
out vec4 FragColor;
|
2014-02-28 11:29:05 -05:00
|
|
|
#else
|
|
|
|
varying vec2 uv;
|
|
|
|
#define FragColor gl_FragColor
|
|
|
|
#endif
|
|
|
|
|
2014-01-19 13:31:00 -05:00
|
|
|
|
2013-11-30 16:33:06 -05:00
|
|
|
// Separated penumbra, vertical
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
float sum = 0.0;
|
|
|
|
vec4 tmp;
|
2014-02-12 17:32:18 -05:00
|
|
|
float X = uv.x;
|
|
|
|
float Y = uv.y;
|
2013-11-30 16:33:06 -05:00
|
|
|
float width = 0.0;
|
|
|
|
float zsum = 0.00001;
|
|
|
|
|
2014-01-19 12:53:35 -05:00
|
|
|
tmp = texture(tex, vec2(X, Y - 5.13333 * pixel.y));
|
2013-11-30 16:33:06 -05:00
|
|
|
sum += tmp.x * 0.00640869;
|
|
|
|
zsum += tmp.z;
|
|
|
|
width += tmp.y;
|
|
|
|
|
2014-01-19 12:53:35 -05:00
|
|
|
tmp = texture(tex, vec2(X, Y - 3.26667 * pixel.y));
|
2013-11-30 16:33:06 -05:00
|
|
|
sum += tmp.x * 0.083313;
|
|
|
|
zsum += tmp.z;
|
|
|
|
width += tmp.y;
|
|
|
|
|
2014-01-19 12:53:35 -05:00
|
|
|
tmp = texture(tex, vec2(X, Y - 1.4 * pixel.y));
|
2013-11-30 16:33:06 -05:00
|
|
|
sum += tmp.x * 0.305481;
|
|
|
|
zsum += tmp.z;
|
|
|
|
width += tmp.y;
|
|
|
|
|
2014-01-19 12:53:35 -05:00
|
|
|
tmp = texture(tex, vec2(X, Y));
|
2013-11-30 16:33:06 -05:00
|
|
|
sum += tmp.x * 0.209473;
|
|
|
|
zsum += tmp.z;
|
|
|
|
width += tmp.y;
|
|
|
|
|
2014-01-19 12:53:35 -05:00
|
|
|
tmp = texture(tex, vec2(X, Y + 1.4 * pixel.y));
|
2013-11-30 16:33:06 -05:00
|
|
|
sum += tmp.x * 0.305481;
|
|
|
|
zsum += tmp.z;
|
|
|
|
width += tmp.y;
|
|
|
|
|
2014-01-19 12:53:35 -05:00
|
|
|
tmp = texture(tex, vec2(X, Y + 3.26667 * pixel.y));
|
2013-11-30 16:33:06 -05:00
|
|
|
sum += tmp.x * 0.083313;
|
|
|
|
zsum += tmp.z;
|
|
|
|
width += tmp.y;
|
|
|
|
|
2014-01-19 12:53:35 -05:00
|
|
|
tmp = texture(tex, vec2(X, Y + 5.13333 * pixel.y));
|
2013-11-30 16:33:06 -05:00
|
|
|
sum += tmp.x * 0.00640869;
|
|
|
|
zsum += tmp.z;
|
|
|
|
width += tmp.y;
|
|
|
|
|
|
|
|
float hasz = step(0.7, zsum);
|
2014-01-19 13:31:00 -05:00
|
|
|
FragColor = vec4(sum, (width / zsum) * hasz, hasz, 1.0);
|
2013-11-30 16:33:06 -05:00
|
|
|
}
|