summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-12-08 20:54:26 -0800
committerKenneth Graunke <kenneth@whitecape.org>2010-12-08 20:54:26 -0800
commit470805dfbb21ba58b24a2bd59858127fd8d356cb (patch)
treeb3d03d3bd26d49480d4c826d9a063a6bdaa99b45
parentf9c7188af4cb3a2ab0994c4b9f89980284917781 (diff)
Fix up the lighting/environment combining - use mix().
-rwxr-xr-xsrc/phong.frag9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/phong.frag b/src/phong.frag
index c44ebf5..e816877 100755
--- a/src/phong.frag
+++ b/src/phong.frag
@@ -64,10 +64,7 @@ void main(void)
float F = schlick(n, l);
vec4 envir = textureCube(sampler, reflect(normalize(eye_direction_ws), normal_ws));
- gl_FragColor = (1 - F) * envir + F * vec4(spec);
- //gl_FragColor = step(0.0, dot(n, l)) * vec4(diff + vec3(spec), 1.0) + F * envir;
-}
+ vec4 light = step(0.0, dot(n, l)) * vec4(diff + vec3(spec), 1.0);
- //gl_FragColor = vec4((1 - F) * diff + F * vec3(spec), 1.0);
- //gl_FragColor = step(0.0, dot(n, l)) * vec4(diff + vec3(spec), 1.0);
- //gl_FragColor = textureCube(sampler, reflect(eye_direction_ws, normal_ws));
+ gl_FragColor = mix(light, envir, F);
+}