aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rw-r--r--data/shaders/fill-light.frag2
-rw-r--r--data/shaders/lighting.frag11
2 files changed, 7 insertions, 6 deletions
diff --git a/data/shaders/fill-light.frag b/data/shaders/fill-light.frag
index 249c881..eb89c79 100644
--- a/data/shaders/fill-light.frag
+++ b/data/shaders/fill-light.frag
@@ -41,7 +41,7 @@ void main() {
norm = normalize(normal);
/* Ambient */
- ambi = col_ambi_diff * gl_LightModel.ambient.rgb;
+ ambi = min(1.0, col_ambi_diff * (gl_LightModel.ambient.rgb + vec3(0.5, 0.5, 0.5)));
/* Emission */
emit = col_emit;
diff --git a/data/shaders/lighting.frag b/data/shaders/lighting.frag
index e47108f..ab13e52 100644
--- a/data/shaders/lighting.frag
+++ b/data/shaders/lighting.frag
@@ -51,9 +51,6 @@ void main() {
norm += (texture2D(normalmap, gl_TexCoord[0].st).rgb - vec3(0.5, 0.5, 0.5)) / 2.0;
}
- /* Ambient */
- ambi = col_ambi_diff * gl_LightModel.ambient.rgb;
-
/* Emission */
emit = col_emit;
@@ -65,15 +62,19 @@ void main() {
spot = max(dot(normalize(-light0vc), gl_LightSource[0].spotDirection), 0.0);
spot = pow(spot, gl_LightSource[0].spotExponent);
+ /* Ambient */
+ ambi = col_ambi_diff * (gl_LightModel.ambient.rgb + gl_LightSource[0].ambient*spot*falloff);
+
+ /* Diffuse */
diff_fac = max(0.0, dot(normalize(light0vc).xyz, norm));
+ diff += col_ambi_diff * gl_LightSource[0].diffuse.rgb * spot * falloff * diff_fac;
+ /* Specular */
L = normalize(gl_LightSource[0].position.xyz - pos);
E = normalize(-pos);
R = normalize(-reflect(L, norm));
spec_fac = max(0.0, dot(R, E));
spec_fac = pow(spec_fac, shininess);
-
- diff += col_ambi_diff * gl_LightSource[0].diffuse.rgb * spot * falloff * diff_fac;
spec += vec3(1.0, 1.0, 1.0) * gl_LightSource[0].specular.rgb * spot * falloff * spec_fac;
/* Light 1: Diffuse background glow */