diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-17 15:55:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 15:55:37 -0400 |
commit | 90aadf3844386824140a20d7fbb847bc16009a94 (patch) | |
tree | 6f83fce90e71abb22b1a8f3e09c79963b2a34d5d /shaders | |
parent | bc63fa57ced1c7329f7fdcfd168eaf7e290158bc (diff) | |
parent | 86f0106d0523825549f1e74b835688c78a10cf6c (diff) | |
download | therapy-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')
-rw-r--r-- | shaders/bloom1.fragment | 11 | ||||
-rw-r--r-- | shaders/bloom2.fragment | 26 | ||||
-rw-r--r-- | shaders/fill.fragment | 4 | ||||
-rw-r--r-- | shaders/final.fragment | 8 | ||||
-rw-r--r-- | shaders/ntsc.fragment | 4 |
5 files changed, 28 insertions, 25 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 | ||
3 | in vec2 UV; | 3 | in vec2 UV; |
4 | 4 | ||
5 | out vec3 color; | 5 | out vec4 color; |
6 | 6 | ||
7 | uniform vec2 offset; | 7 | uniform vec2 offset; |
8 | uniform sampler2D inTex; | 8 | uniform sampler2D inTex; |
9 | 9 | ||
10 | void main() | 10 | void 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 | ||
3 | in vec2 UV; | 3 | in vec2 UV; |
4 | 4 | ||
5 | out vec3 color; | 5 | out vec4 color; |
6 | 6 | ||
7 | uniform sampler2D clearTex; | 7 | uniform sampler2D clearTex; |
8 | uniform sampler2D blurTex; | 8 | uniform sampler2D blurTex; |
@@ -15,19 +15,21 @@ float nrand(vec2 n) | |||
15 | 15 | ||
16 | void main() | 16 | void 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 | ||
3 | out vec3 color; | 3 | out vec4 color; |
4 | 4 | ||
5 | uniform vec3 vecColor; | 5 | uniform vec3 vecColor; |
6 | 6 | ||
7 | void main() | 7 | void 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..2e38f38 100644 --- a/shaders/final.fragment +++ b/shaders/final.fragment | |||
@@ -5,7 +5,7 @@ in vec3 normIn; | |||
5 | in vec3 camDirIn; | 5 | in vec3 camDirIn; |
6 | in vec3 lightDirIn; | 6 | in vec3 lightDirIn; |
7 | 7 | ||
8 | out vec3 color; | 8 | out vec4 color; |
9 | 9 | ||
10 | uniform sampler2D rendertex; | 10 | uniform sampler2D rendertex; |
11 | uniform sampler2D scanlinestex; | 11 | uniform sampler2D scanlinestex; |
@@ -15,8 +15,8 @@ const float Tuning_Dimming = 0.0; | |||
15 | const float Tuning_Satur = 1.13; | 15 | const float Tuning_Satur = 1.13; |
16 | const float Tuning_ReflScalar = 0.3; | 16 | const float Tuning_ReflScalar = 0.3; |
17 | const float Tuning_Barrel = 0;//0.12; | 17 | const float Tuning_Barrel = 0;//0.12; |
18 | const float Tuning_Scanline_Brightness = 0.5;//0.45; | 18 | const float Tuning_Scanline_Brightness = 0.55; |
19 | const float Tuning_Scanline_Opacity = 0.75;//0.55; | 19 | const float Tuning_Scanline_Opacity = 0.55; |
20 | const float Tuning_Diff_Brightness = 0.75; | 20 | const float Tuning_Diff_Brightness = 0.75; |
21 | const float Tuning_Spec_Brightness = 0.5;//0.35; | 21 | const float Tuning_Spec_Brightness = 0.5;//0.35; |
22 | const float Tuning_Spec_Power = 50.0; | 22 | const float Tuning_Spec_Power = 50.0; |
@@ -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 | ||
3 | in vec2 UV; | 3 | in vec2 UV; |
4 | 4 | ||
5 | out vec3 color; | 5 | out vec4 color; |
6 | 6 | ||
7 | uniform sampler2D curFrameSampler; | 7 | uniform sampler2D curFrameSampler; |
8 | uniform sampler2D NTSCArtifactSampler; | 8 | uniform 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 | } |