summary refs log tree commit diff stats
path: root/shaders
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-02-19 20:10:11 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-02-19 20:10:11 -0500
commitcd48894563052baeddff64f6bbc13ccc7fa6e081 (patch)
treec7ab2a9b4cbb7ac0d921cf486aef00c5b5623144 /shaders
parentc1b1558256997df22678f6405ea320ae454ad5b4 (diff)
downloadtherapy-cd48894563052baeddff64f6bbc13ccc7fa6e081.tar.gz
therapy-cd48894563052baeddff64f6bbc13ccc7fa6e081.tar.bz2
therapy-cd48894563052baeddff64f6bbc13ccc7fa6e081.zip
Added CRT mesh!
Also a character sprite, changed up the map file format, fixed some shader bugs
Diffstat (limited to 'shaders')
-rw-r--r--shaders/bloom2.fragment3
-rw-r--r--shaders/final.fragment12
-rw-r--r--shaders/final.vertex7
-rw-r--r--shaders/ntsc.fragment7
4 files changed, 16 insertions, 13 deletions
diff --git a/shaders/bloom2.fragment b/shaders/bloom2.fragment index ac18124..aa69f0f 100644 --- a/shaders/bloom2.fragment +++ b/shaders/bloom2.fragment
@@ -51,9 +51,10 @@ void main()
51 } 51 }
52 52
53 vec3 bloom_c = (sum / vec4(NUM_TAPS)).rgb; 53 vec3 bloom_c = (sum / vec4(NUM_TAPS)).rgb;
54 bloom_c *= bloom_c;
54 //bloom_c = vec3(bloom_c.r*bloom_c.r, bloom_c.g*bloom_c.g, bloom_c.b*bloom_c.b); 55 //bloom_c = vec3(bloom_c.r*bloom_c.r, bloom_c.g*bloom_c.g, bloom_c.b*bloom_c.b);
55 //bloom_c = vec3(bloom_c.r*bloom_c.r, bloom_c.g*bloom_c.g, bloom_c.b*bloom_c.b); 56 //bloom_c = vec3(bloom_c.r*bloom_c.r, bloom_c.g*bloom_c.g, bloom_c.b*bloom_c.b);
56 bloom_c = max(bloom_c - 0.25, vec3(0,0,0)); 57 //bloom_c = max(bloom_c - 0.25, vec3(0,0,0));
57 58
58 color = texture(screenTex, UV).rgb + bloom_c; 59 color = texture(screenTex, UV).rgb + bloom_c;
59} 60}
diff --git a/shaders/final.fragment b/shaders/final.fragment index 5feccb9..7eeb78e 100644 --- a/shaders/final.fragment +++ b/shaders/final.fragment
@@ -15,14 +15,14 @@ const vec2 UVScalar = vec2(1.0, 1.0);
15const vec2 UVOffset = vec2(0.0, 0.0); 15const vec2 UVOffset = vec2(0.0, 0.0);
16const vec2 CRTMask_Scale = vec2(85.0, 153.6)*4.0; 16const vec2 CRTMask_Scale = vec2(85.0, 153.6)*4.0;
17const vec2 CRTMask_Offset = vec2(0.0, 0.0); 17const vec2 CRTMask_Offset = vec2(0.0, 0.0);
18const float Tuning_Overscan = 1.0; 18const float Tuning_Overscan = 1.08;
19const float Tuning_Dimming = 0.0; 19const float Tuning_Dimming = 0.0;
20const float Tuning_Satur = 1.35; 20const float Tuning_Satur = 1.0;
21const float Tuning_ReflScalar = 0.3; 21const float Tuning_ReflScalar = 0.3;
22const float Tuning_Barrel = 0; //0.12; 22const float Tuning_Barrel = 0; //0.12;
23const float Tuning_Scanline_Brightness = 0.5; 23const float Tuning_Scanline_Brightness = 0.45;
24const float Tuning_Scanline_Opacity = 0.5; 24const float Tuning_Scanline_Opacity = 0.5;
25const float Tuning_Diff_Brightness = 0.5; 25const float Tuning_Diff_Brightness = 0.75;
26const float Tuning_Spec_Brightness = 0.35; 26const float Tuning_Spec_Brightness = 0.35;
27const float Tuning_Spec_Power = 50.0; 27const float Tuning_Spec_Power = 50.0;
28const float Tuning_Fres_Brightness = 1.0; 28const float Tuning_Fres_Brightness = 1.0;
@@ -86,7 +86,7 @@ void main()
86 vec4 emissive = sampleCRT(UV); 86 vec4 emissive = sampleCRT(UV);
87 87
88 vec4 nearfinal = colorfres + colordiff + colorspec + emissive; 88 vec4 nearfinal = colorfres + colordiff + colorspec + emissive;
89 vec4 final = nearfinal * mix(vec4(1,1,1,1), vec4(0,0,0,0), Tuning_Dimming); 89 //vec4 final = nearfinal * mix(vec4(1,1,1,1), vec4(0,0,0, 0), Tuning_Dimming);
90 90
91 color = final.rgb; 91 color = nearfinal.rgb;
92} 92}
diff --git a/shaders/final.vertex b/shaders/final.vertex index dda8626..4c5b1d5 100644 --- a/shaders/final.vertex +++ b/shaders/final.vertex
@@ -2,6 +2,7 @@
2 2
3layout(location = 0) in vec3 vertexPosition_modelspace; 3layout(location = 0) in vec3 vertexPosition_modelspace;
4layout(location = 1) in vec3 vertexNormal; 4layout(location = 1) in vec3 vertexNormal;
5layout(location = 2) in vec2 vertexUV;
5 6
6out vec2 UV; 7out vec2 UV;
7out vec3 normIn; 8out vec3 normIn;
@@ -12,18 +13,18 @@ out vec3 lightDirIn;
12uniform mat4 MVP; 13uniform mat4 MVP;
13uniform mat4 worldMat; 14uniform mat4 worldMat;
14 15
15const vec3 Tuning_LightPos = vec3(1, 1, 1.0); 16const vec3 Tuning_LightPos = vec3(1, 1, -1.0);
16 17
17void main() 18void main()
18{ 19{
19 gl_Position = MVP * vec4(vertexPosition_modelspace,1); 20 gl_Position = MVP * vec4(vertexPosition_modelspace,1);
20 UV = (vertexPosition_modelspace.xy+vec2(1,1))/2.0; 21 UV = vertexUV;
21 normIn = vertexNormal; 22 normIn = vertexNormal;
22 23
23 mat3 invWorldRot = transpose(mat3(worldMat[0].xyz, worldMat[1].xyz, worldMat[2].xyz)); 24 mat3 invWorldRot = transpose(mat3(worldMat[0].xyz, worldMat[1].xyz, worldMat[2].xyz));
24 //mat3 invWorldRot = mat3(1.0f); 25 //mat3 invWorldRot = mat3(1.0f);
25 vec3 worldPos = (worldMat * vec4(vertexPosition_modelspace,1)).xyz; 26 vec3 worldPos = (worldMat * vec4(vertexPosition_modelspace,1)).xyz;
26 camDirIn = invWorldRot * (vec3(0,0,1) - worldPos); 27 camDirIn = invWorldRot * (vec3(2,0,0) - worldPos);
27 //camDir = worldPos; 28 //camDir = worldPos;
28 lightDirIn = invWorldRot * (Tuning_LightPos - worldPos); 29 lightDirIn = invWorldRot * (Tuning_LightPos - worldPos);
29 //vec4 vertPos4 = vec4(vertexPosition_modelspace,1); 30 //vec4 vertPos4 = vec4(vertexPosition_modelspace,1);
diff --git a/shaders/ntsc.fragment b/shaders/ntsc.fragment index 12d6873..ceab64d 100644 --- a/shaders/ntsc.fragment +++ b/shaders/ntsc.fragment
@@ -8,8 +8,8 @@ uniform sampler2D curFrameSampler;
8uniform sampler2D NTSCArtifactSampler; 8uniform sampler2D NTSCArtifactSampler;
9uniform sampler2D prevFrameSampler; 9uniform sampler2D prevFrameSampler;
10 10
11const float Tuning_Sharp = 0.8; 11const float Tuning_Sharp = 0.25;
12const vec4 Tuning_Persistence = vec4(0.7,0.7,0.7,0.7); 12const vec4 Tuning_Persistence = vec4(1.0) * 0.5;
13const float Tuning_Bleed = 0.5; 13const float Tuning_Bleed = 0.5;
14const float Tuning_NTSC = 0.35; 14const float Tuning_NTSC = 0.35;
15uniform float NTSCLerp; 15uniform float NTSCLerp;
@@ -29,6 +29,7 @@ void main()
29 vec4 NTSCArtifact1 = texture(NTSCArtifactSampler, UV); 29 vec4 NTSCArtifact1 = texture(NTSCArtifactSampler, UV);
30 vec4 NTSCArtifact2 = texture(NTSCArtifactSampler, UV + RcpScrHeight); 30 vec4 NTSCArtifact2 = texture(NTSCArtifactSampler, UV + RcpScrHeight);
31 vec4 NTSCArtifact = mix(NTSCArtifact1, NTSCArtifact2, NTSCLerp); 31 vec4 NTSCArtifact = mix(NTSCArtifact1, NTSCArtifact2, NTSCLerp);
32 vec4 TunedNTSC = NTSCArtifact * Tuning_NTSC;
32 33
33 vec2 LeftUV = UV - RcpScrWidth; 34 vec2 LeftUV = UV - RcpScrWidth;
34 vec2 RightUV = UV + RcpScrWidth; 35 vec2 RightUV = UV + RcpScrWidth;
@@ -41,7 +42,7 @@ void main()
41 vec4 Prev_Local = texture(prevFrameSampler, UV); 42 vec4 Prev_Local = texture(prevFrameSampler, UV);
42 vec4 Prev_Right = texture(prevFrameSampler, RightUV); 43 vec4 Prev_Right = texture(prevFrameSampler, RightUV);
43 44
44 Cur_Local = clamp(Cur_Local + (((Cur_Left - Cur_Local) + (Cur_Right - Cur_Local)) * Tuning_NTSC), vec4(0,0,0,0), vec4(1,1,1,1)); 45 Cur_Local = clamp(Cur_Local + (((Cur_Left - Cur_Local) + (Cur_Right - Cur_Local)) * TunedNTSC), vec4(0,0,0,0), vec4(1,1,1,1));
45 46
46 float curBrt = Brightness(Cur_Local); 47 float curBrt = Brightness(Cur_Local);
47 float offset = 0; 48 float offset = 0;