summary refs log tree commit diff stats
path: root/shaders/bloom2.fragment
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/bloom2.fragment')
-rw-r--r--shaders/bloom2.fragment26
1 files changed, 14 insertions, 12 deletions
diff --git a/shaders/bloom2.fragment b/shaders/bloom2.fragment index 4c50e86..6723c2c 100644 --- a/shaders/bloom2.fragment +++ b/shaders/bloom2.fragment
@@ -2,7 +2,7 @@
2 2
3in vec2 UV; 3in vec2 UV;
4 4
5out vec3 color; 5out vec4 color;
6 6
7uniform sampler2D clearTex; 7uniform sampler2D clearTex;
8uniform sampler2D blurTex; 8uniform sampler2D blurTex;
@@ -15,19 +15,21 @@ float nrand(vec2 n)
15 15
16void main() 16void main()
17{ 17{
18 color = vec3(0.0); 18 vec3 mval = vec3(0.0);
19 color += texture(clearTex, UV).rgb / 2.0; 19 mval += texture(clearTex, UV).rgb / 2.0;
20 color += texture(blurTex, UV).rgb; 20 mval += texture(blurTex, UV).rgb;
21 color = max(vec3(0.0), color - 0.5); 21 mval = max(vec3(0.0), mval - 0.5);
22 color *= color; 22 mval *= mval;
23 23
24 float flicker = 0.5 + nrand(vec2(iGlobalTime)); 24 float flicker = 0.5 + nrand(vec2(iGlobalTime));
25 flicker *= (flicker); 25 flicker *= (flicker);
26 //flicker = sqrt(flicker); 26 //flicker = sqrt(flicker);
27 //flicker = pow(flicker, 1.0/8.0); 27 //flicker = pow(flicker, 1.0/8.0);
28 //color *= flicker; 28 //mval *= flicker;
29 color *= mix(vec3(0.0), color, flicker); 29 mval *= mix(vec3(0.0), mval, flicker);
30 30
31 color += texture(clearTex, UV).rgb; 31 mval += texture(clearTex, UV).rgb;
32 color = clamp(color, vec3(0.0), vec3(1.0)); 32 mval = clamp(mval, vec3(0.0), vec3(1.0));
33
34 color = vec4(mval, 1.0);
33} 35}