summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/phong.frag6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/phong.frag b/src/phong.frag
index e816877..2e773e1 100755
--- a/src/phong.frag
+++ b/src/phong.frag
@@ -14,7 +14,7 @@ const vec3 base_color = vec3(1.0, 0.0, 0.0);
*/
uniform float s;
-float schlick(vec3 n, vec3 l)
+float schlick(vec3 n, vec3 v)
{
// Material constants... 1.0 = air, 3.5 = sphere (arbitrary)
const float ratio = 1.0 / 3.5;
@@ -26,7 +26,7 @@ float schlick(vec3 n, vec3 l)
* the input "theta" to the Frensel function is the angle between the
* light and the normal vectors...so cos(theta) = dot(n, l).
*/
- return r0 + (1 - r0) * pow(1.0 - dot(n, l), 5.0);
+ return r0 + (1 - r0) * pow(1.0 - dot(n, v), 5.0);
}
/* Adapted from the Orange Book, 3rd edition, chapter 11. */
@@ -61,7 +61,7 @@ void main(void)
vec3 diff = base_color * dot(n, l);
float spec = pow(dot(n, h), s);
- float F = schlick(n, l);
+ float F = schlick(n, v);
vec4 envir = textureCube(sampler, reflect(normalize(eye_direction_ws), normal_ws));
vec4 light = step(0.0, dot(n, l)) * vec4(diff + vec3(spec), 1.0);