summary refs log tree commit diff stats
path: root/shaders
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
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')
-rw-r--r--shaders/bloom1.fragment11
-rw-r--r--shaders/bloom2.fragment26
-rw-r--r--shaders/fill.fragment4
-rw-r--r--shaders/final.fragment4
-rw-r--r--shaders/ntsc.fragment4
5 files changed, 26 insertions, 23 deletions
diff --git a/shaders/bloom1.fragment b/shaders/bloom1.fragment index 0a89ea1..ed9e10d 100644 --- a/shaders/bloom1.fragment +++ b/shaders/bloom1.fragment
@@ -2,15 +2,16 @@
2 2
3in vec2 UV; 3in vec2 UV;
4 4
5out vec3 color; 5out vec4 color;
6 6
7uniform vec2 offset; 7uniform vec2 offset;
8uniform sampler2D inTex; 8uniform sampler2D inTex;
9 9
10void main() 10void main()
11{ 11{
12 color = vec3(0.0); 12 vec3 mval = vec3(0.0);
13 color += (5.0/16.0) * texture(inTex, UV - offset).rgb; 13 mval += (5.0/16.0) * texture(inTex, UV - offset).rgb;
14 color += (6.0/16.0) * texture(inTex, UV).rgb; 14 mval += (6.0/16.0) * texture(inTex, UV).rgb;
15 color += (5.0/16.0) * texture(inTex, UV + offset).rgb; 15 mval += (5.0/16.0) * texture(inTex, UV + offset).rgb;
16 color = vec4(mval, 1.0);
16} 17}
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}
diff --git a/shaders/fill.fragment b/shaders/fill.fragment index ab7d9c9..81443c4 100644 --- a/shaders/fill.fragment +++ b/shaders/fill.fragment
@@ -1,10 +1,10 @@
1#version 330 core 1#version 330 core
2 2
3out vec3 color; 3out vec4 color;
4 4
5uniform vec3 vecColor; 5uniform vec3 vecColor;
6 6
7void main() 7void main()
8{ 8{
9 color = vecColor; 9 color = vec4(vecColor, 1.0);
10} 10}
diff --git a/shaders/final.fragment b/shaders/final.fragment index a3ee243..9a39597 100644 --- a/shaders/final.fragment +++ b/shaders/final.fragment
@@ -5,7 +5,7 @@ in vec3 normIn;
5in vec3 camDirIn; 5in vec3 camDirIn;
6in vec3 lightDirIn; 6in vec3 lightDirIn;
7 7
8out vec3 color; 8out vec4 color;
9 9
10uniform sampler2D rendertex; 10uniform sampler2D rendertex;
11uniform sampler2D scanlinestex; 11uniform sampler2D scanlinestex;
@@ -71,5 +71,5 @@ void main()
71 vec4 nearfinal = colorfres + colordiff + colorspec + emissive; 71 vec4 nearfinal = colorfres + colordiff + colorspec + emissive;
72 //vec4 final = nearfinal * mix(vec4(1,1,1,1), vec4(0,0,0, 0), Tuning_Dimming); 72 //vec4 final = nearfinal * mix(vec4(1,1,1,1), vec4(0,0,0, 0), Tuning_Dimming);
73 73
74 color = nearfinal.rgb; 74 color = nearfinal;
75} 75}
diff --git a/shaders/ntsc.fragment b/shaders/ntsc.fragment index 56fb1c4..d6ae904 100644 --- a/shaders/ntsc.fragment +++ b/shaders/ntsc.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 curFrameSampler; 7uniform sampler2D curFrameSampler;
8uniform sampler2D NTSCArtifactSampler; 8uniform sampler2D NTSCArtifactSampler;
@@ -61,5 +61,5 @@ void main()
61 Cur_Local = clamp(Cur_Local + (offset * Tuning_Sharp * mix(vec4(1,1,1,1), NTSCArtifact, Tuning_NTSC)), vec4(0,0,0,0), vec4(1,1,1,1)); 61 Cur_Local = clamp(Cur_Local + (offset * Tuning_Sharp * mix(vec4(1,1,1,1), NTSCArtifact, Tuning_NTSC)), vec4(0,0,0,0), vec4(1,1,1,1));
62 Cur_Local = clamp(max(Cur_Local, Tuning_Persistence * (1.0 / (1.0 + (2.0 * Tuning_Bleed))) * (Prev_Local + ((Prev_Left + Prev_Right) * Tuning_Bleed))), vec4(0,0,0,0), vec4(1,1,1,1)); 62 Cur_Local = clamp(max(Cur_Local, Tuning_Persistence * (1.0 / (1.0 + (2.0 * Tuning_Bleed))) * (Prev_Local + ((Prev_Left + Prev_Right) * Tuning_Bleed))), vec4(0,0,0,0), vec4(1,1,1,1));
63 63
64 color = Cur_Local.xyz; 64 color = vec4(Cur_Local.rgb, 1.0);
65} 65}