summary refs log tree commit diff stats
path: root/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'shaders')
-rw-r--r--shaders/final.fragment16
-rw-r--r--shaders/final.vertex8
2 files changed, 3 insertions, 21 deletions
diff --git a/shaders/final.fragment b/shaders/final.fragment index 4a51ad3..f9d8995 100644 --- a/shaders/final.fragment +++ b/shaders/final.fragment
@@ -4,7 +4,6 @@ in vec2 UV;
4in vec3 normIn; 4in vec3 normIn;
5in vec3 camDirIn; 5in vec3 camDirIn;
6in vec3 lightDirIn; 6in vec3 lightDirIn;
7//in vec3 vertPos;
8 7
9out vec3 color; 8out vec3 color;
10 9
@@ -53,7 +52,6 @@ void main()
53 vec3 norm = normalize(normIn); 52 vec3 norm = normalize(normIn);
54 vec3 camDir = normalize(camDirIn); 53 vec3 camDir = normalize(camDirIn);
55 vec3 lightDir = normalize(lightDirIn); 54 vec3 lightDir = normalize(lightDirIn);
56 //vec3 refl = reflect(camDir, normIn);
57 55
58 float diffuse = clamp(dot(norm, lightDir), 0.0f, 1.0f); 56 float diffuse = clamp(dot(norm, lightDir), 0.0f, 1.0f);
59 vec4 colordiff = vec4(0.175, 0.15, 0.2, 1) * diffuse * Tuning_Diff_Brightness; 57 vec4 colordiff = vec4(0.175, 0.15, 0.2, 1) * diffuse * Tuning_Diff_Brightness;
@@ -65,19 +63,7 @@ void main()
65 63
66 float fres = 1.0f - dot(camDir, norm); 64 float fres = 1.0f - dot(camDir, norm);
67 fres = (fres*fres) * Tuning_Fres_Brightness; 65 fres = (fres*fres) * Tuning_Fres_Brightness;
68 vec4 colorfres = vec4(0.45, 0.4, 0.5, 1) * fres;/* 66 vec4 colorfres = vec4(0.45, 0.4, 0.5, 1) * fres;
69
70 float lambertian = max(dot(camDirNorm,norm),0.0);
71 vec4 colorspec = vec4(0.0);
72 vec4 colorfres = vec4(0.0);
73 vec4 colordiff = vec4(0.175,0.15,0.2,1) * lambertian * Tuning_Diff_Brightness;
74 if (lambertian > 0.0)
75 {
76 vec3 viewDir = normalize(-vertPos);
77 vec3 halfDir = normalize(camDirNorm + viewDir);
78 float specAngle = max(dot(halfDir, normnorm), 0.0);
79 colorspec = vec4(0.25,0.25,0.25,1) * pow(specAngle, Tuning_Spec_Power) * Tuning_Spec_Brightness;
80 }*/
81 67
82 vec4 emissive = sampleCRT(UV); 68 vec4 emissive = sampleCRT(UV);
83 69
diff --git a/shaders/final.vertex b/shaders/final.vertex index 4c5b1d5..ed6079f 100644 --- a/shaders/final.vertex +++ b/shaders/final.vertex
@@ -8,12 +8,11 @@ out vec2 UV;
8out vec3 normIn; 8out vec3 normIn;
9out vec3 camDirIn; 9out vec3 camDirIn;
10out vec3 lightDirIn; 10out vec3 lightDirIn;
11//out vec3 vertPos;
12 11
13uniform mat4 MVP; 12uniform mat4 MVP;
14uniform mat4 worldMat; 13uniform mat4 worldMat;
15 14
16const vec3 Tuning_LightPos = vec3(1, 1, -1.0); 15const vec3 Tuning_LightPos = vec3(2, 1, -1);
17 16
18void main() 17void main()
19{ 18{
@@ -22,11 +21,8 @@ void main()
22 normIn = vertexNormal; 21 normIn = vertexNormal;
23 22
24 mat3 invWorldRot = transpose(mat3(worldMat[0].xyz, worldMat[1].xyz, worldMat[2].xyz)); 23 mat3 invWorldRot = transpose(mat3(worldMat[0].xyz, worldMat[1].xyz, worldMat[2].xyz));
25 //mat3 invWorldRot = mat3(1.0f);
26 vec3 worldPos = (worldMat * vec4(vertexPosition_modelspace,1)).xyz; 24 vec3 worldPos = (worldMat * vec4(vertexPosition_modelspace,1)).xyz;
25
27 camDirIn = invWorldRot * (vec3(2,0,0) - worldPos); 26 camDirIn = invWorldRot * (vec3(2,0,0) - worldPos);
28 //camDir = worldPos;
29 lightDirIn = invWorldRot * (Tuning_LightPos - worldPos); 27 lightDirIn = invWorldRot * (Tuning_LightPos - worldPos);
30 //vec4 vertPos4 = vec4(vertexPosition_modelspace,1);
31 //vertPos = vec3(vertPos4) / vertPos4.w;
32} 28}