Implement Blinn-Phong instead of Phong

This commit is contained in:
4VRDriver
2020-09-20 12:46:45 +02:00
parent 242b50e9ef
commit a5818dfd04
2 changed files with 3 additions and 3 deletions

View File

@@ -166,8 +166,8 @@ void computeShading(
float diffuseShading = max(dot(normal, lightDir), 0.0f);
// Specular shading
vec3 reflectDir = reflect(-lightDir, normal);
float specularShading = pow(max(dot(viewDir, reflectDir), 0.0f), u_material.shininess);
vec3 halfwayDir = normalize(lightDir + viewDir);
float specularShading = pow(max(dot(normal, halfwayDir), 0.0f), u_material.shininess);
vec4 diffuseTex = texture(u_material.texture_diffuse0, v_texCoord);
vec4 specularTex = texture(u_material.texture_specular0, v_texCoord);

View File

@@ -20,7 +20,7 @@ World::World(ShaderProgram *shaderProgram)
// This will be removed in future when gloss maps are implemented
shaderProgram->bind();
shaderProgram->setUniform("u_material.shininess", 32.0f);
shaderProgram->setUniform("u_material.shininess", 64.0f);
shaderProgram->unbind();
}