summary refs log tree commit diff stats
path: root/shaders/bloom2.fragment
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-02-13 23:00:10 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-02-13 23:00:10 -0500
commit224645d1071c14b4829dbb3ae35870868fcff85a (patch)
treef84f540eee09315eb0a689c523946ffa03f4fea0 /shaders/bloom2.fragment
parent3df19e45e737a1b9395a9a258e3263e444ebedd7 (diff)
downloadtherapy-224645d1071c14b4829dbb3ae35870868fcff85a.tar.gz
therapy-224645d1071c14b4829dbb3ae35870868fcff85a.tar.bz2
therapy-224645d1071c14b4829dbb3ae35870868fcff85a.zip
Fixed inconsistent rendering failure
The issue appears to have been caused by blending with unset alpha channels.

Also included the re-ordered player character sprite image.

The CMake file has been updated to include linking against some Apple libraries that are usually already included in GLFW3.

refs #1
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}