summary refs log tree commit diff stats
path: root/shaders/bloom2.fragment
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-05-17 15:55:37 -0400
committerGitHub <noreply@github.com>2018-05-17 15:55:37 -0400
commit90aadf3844386824140a20d7fbb847bc16009a94 (patch)
tree6f83fce90e71abb22b1a8f3e09c79963b2a34d5d /shaders/bloom2.fragment
parentbc63fa57ced1c7329f7fdcfd168eaf7e290158bc (diff)
parent86f0106d0523825549f1e74b835688c78a10cf6c (diff)
downloadtherapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.gz
therapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.bz2
therapy-90aadf3844386824140a20d7fbb847bc16009a94.zip
Merge pull request #7 from hatkirby/es-rewrite
The ECS rewrite exceeds the original branch in functionality, so it is time to merge it in.
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}