diff options
-rw-r--r-- | chickadee/render/phong.scm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/chickadee/render/phong.scm b/chickadee/render/phong.scm index a07f682..886e910 100644 --- a/chickadee/render/phong.scm +++ b/chickadee/render/phong.scm @@ -192,7 +192,10 @@ void main() { float diffuseFactor = max(dot(lightDir, fragNorm), 0.0); vec3 diffuseColor = diffuseFactor * baseDiffuseColor * material.diffuse; vec3 reflectDir = reflect(-lightDir, fragNorm); - float specularFactor = pow(max(dot(lightDir, reflectDir), 0.0), material.shininess); + float specularFactor = 0; + if(material.shininess > 0) { + specularFactor = pow(max(dot(lightDir, reflectDir), 0.0), material.shininess); + } vec3 specularColor = specularFactor * baseSpecularColor * material.specular; gl_FragColor = vec4(ambientColor + diffuseColor + specularColor, 1.0); } |