summaryrefslogtreecommitdiff
path: root/data/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'data/shaders')
-rw-r--r--data/shaders/phong-frag.glsl3
1 files changed, 2 insertions, 1 deletions
diff --git a/data/shaders/phong-frag.glsl b/data/shaders/phong-frag.glsl
index 9d8e40c..7cab3f8 100644
--- a/data/shaders/phong-frag.glsl
+++ b/data/shaders/phong-frag.glsl
@@ -174,7 +174,8 @@ void main() {
float diffuseFactor = posDot(lightDir, normal);
vec3 reflectDir = reflect(-lightDir, normal);
vec3 diffuseColor = baseDiffuseColor * diffuseFactor;
- float specularFactor = pow(posDot(viewDir, reflectDir), material.shininess);
+ vec3 halfVector = normalize(lightDir + viewDir);
+ float specularFactor = pow(posDot(halfVector, normal), material.shininess);
vec3 specularColor = baseSpecularColor * specularFactor;
color += (diffuseColor + specularColor) * radiance;
}