Bling-Phong model is extention of Phong Shading ( Basic shading) model.
Phong Shading ( Basic shading)is a great and very efficient approximation of lighting, but its specular reflections break down in certain conditions, specifically when the shininess property is low resulting in a large (rough) specular area.
out vec4 FragColor;
in vec3 fragPos;
in vec3 normal;
uniform vec3 lightPos;
uniform vec3 lightColor;
uniform vec3 objectColor;
uniform vec3 viewPos;
void main(){
// ambient
float ambientStrength = 0.1f;
vec3 ambient = ambientStrength * lightColor;
// diffuse
vec3 norm = normalize(normal);
vec3 lightDir = normalize(lightPos - fragPos);
vec3 diff = max(dot(lightDir,norm),0.0f);
vec3 diffuse = diff * lightColor;
// specular
float specularStrength = 0.5f;
vec3 viewDir = normalize(viewPos - fragPos);
// vec3 reflectDir = reflect(-lightDir,norm); this is for Phong lighting model for Bling_phon we use halfway Direction
vec3 halfwayDir = normalize(lightDir + viewDir);
vec3 spec = pow(max(dot(viewDir,halfwayDir),0.0f),32); // using halfwayDir instead of reflectDir for specular reflection.
vec3 specular = spec * specularStrength * lightColor;
vec3 result = (ambient + diffuse + specular) * objectColor;
FragColor = vec4(result,1.0f);
}