Commit e2609149 authored by Christopher Tenter's avatar Christopher Tenter Committed by Max Lyon

Fix shading when Shininess is set to 0 refs #69

parent 635f2ee3
......@@ -33,7 +33,7 @@ vec3 LitPointLight(vec3 vPosition,
// specular
vec3 h = normalize(vLightDir - vec3(0,0,-1)); // half vector between light and view direction
float hdotn = max(dot(h, vNormal), 0.0);
float hdotn = max(dot(h, vNormal), 0.001); // small epsilon to avoid undefined pow(0, 0) if shininess is also 0
cLight += (pow(hdotn, SHININESS) * cLightSpecular) * g_cSpecular;
......@@ -60,7 +60,7 @@ vec3 LitDirLight(vec3 vPosition,
// specular
vec3 h = normalize(vLightDir - vec3(0,0,-1)); // half vector between light and view direction
float hdotn = max(dot(h, vNormal), 0.0);
float hdotn = max(dot(h, vNormal), 0.001); // small epsilon to avoid undefined pow(0, 0) if shininess is also 0
cLight += (pow(hdotn, SHININESS) * cLightSpecular) * g_cSpecular;
return cLight;
......@@ -93,7 +93,7 @@ vec3 LitSpotLight(vec3 vPosition,
// specular
vec3 h = normalize(vLightDir - vec3(0,0,-1)); // half vector between light and view direction
float hdotn = max(dot(h, vNormal), 0.0);
float hdotn = max(dot(h, vNormal), 0.001); // small epsilon to avoid undefined pow(0, 0) if shininess is also 0
cLight += (pow(hdotn, SHININESS) * cLightSpecular) * g_cSpecular;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment