diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2010-12-08 21:46:35 -0800 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2010-12-08 21:46:35 -0800 |
commit | 7a58261c8ff374925ee20728650a7a869bf3a989 (patch) | |
tree | b3792825a4a68e52f539e17baa3196326df3a975 | |
parent | 470805dfbb21ba58b24a2bd59858127fd8d356cb (diff) |
-rwxr-xr-x | src/phong.frag | 6 |
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); |