2016-08-09 23:51:40 +02:00
|
|
|
// Exclusive to bloom for now
|
2016-06-03 17:18:38 +02:00
|
|
|
#version 450
|
|
|
|
|
2018-08-30 15:42:25 +02:00
|
|
|
#include "compiled.inc"
|
2016-08-07 01:43:21 +02:00
|
|
|
|
2016-06-03 17:18:38 +02:00
|
|
|
uniform sampler2D tex;
|
|
|
|
uniform vec2 dir;
|
2017-11-16 08:52:42 +01:00
|
|
|
uniform vec2 screenSize;
|
2016-06-03 17:18:38 +02:00
|
|
|
|
2021-09-02 17:14:18 +02:00
|
|
|
#ifdef _CPostprocess
|
2020-03-04 17:45:19 +01:00
|
|
|
uniform vec3 PPComp11;
|
2021-09-02 17:14:18 +02:00
|
|
|
#endif
|
2020-03-04 17:45:19 +01:00
|
|
|
|
2016-06-03 17:18:38 +02:00
|
|
|
in vec2 texCoord;
|
2016-10-12 17:52:27 +02:00
|
|
|
out vec4 fragColor;
|
2016-06-03 17:18:38 +02:00
|
|
|
|
2017-11-16 08:52:42 +01:00
|
|
|
const float weight[10] = float[] (0.132572, 0.125472, 0.106373, 0.08078, 0.05495, 0.033482, 0.018275, 0.008934, 0.003912, 0.001535);
|
2016-06-03 17:18:38 +02:00
|
|
|
|
|
|
|
void main() {
|
2020-03-04 17:45:19 +01:00
|
|
|
#ifdef _CPostprocess
|
|
|
|
vec2 step = (dir / screenSize.xy) * PPComp11.y;
|
|
|
|
#else
|
|
|
|
vec2 step = (dir / screenSize.xy) * bloomRadius;
|
|
|
|
#endif
|
2018-12-06 15:23:08 +01:00
|
|
|
fragColor.rgb = textureLod(tex, texCoord, 0.0).rgb * weight[0];
|
2018-11-27 21:34:42 +01:00
|
|
|
for (int i = 1; i < 10; i++) {
|
|
|
|
vec2 s = step * (float(i) + 0.5);
|
2018-12-06 15:23:08 +01:00
|
|
|
fragColor.rgb += textureLod(tex, texCoord + s, 0.0).rgb * weight[i];
|
|
|
|
fragColor.rgb += textureLod(tex, texCoord - s, 0.0).rgb * weight[i];
|
2018-11-27 21:34:42 +01:00
|
|
|
}
|
|
|
|
|
2020-03-04 17:45:19 +01:00
|
|
|
#ifdef _CPostprocess
|
|
|
|
fragColor.rgb *= PPComp11.x / 5;
|
|
|
|
#else
|
|
|
|
fragColor.rgb *= bloomStrength / 5;
|
|
|
|
#endif
|
2019-03-13 15:49:19 +01:00
|
|
|
fragColor.rgb = min(fragColor.rgb, 64.0);
|
2016-06-03 17:18:38 +02:00
|
|
|
}
|