◀️ 🔼 🔽 ▶️

3D Game Shaders For Beginners

Blinn-Phong

Blinn-Phong

Blinn-Phong is a slight adjustment of the Phong model you saw in the lighting section. It provides more plausible or realistic specular reflections. You'll notice that Blinn-Phong produces elliptical or elongated specular reflections versus the spherical specular reflections produced by the Phong model. In certain cases, Blinn-Phong can be more efficient to calculate than Phong.

  // ...

  vec3 light   = normal(lightPosition.xyz - vertexPosition.xyz);
  vec3 eye     = normalize(-vertexPosition.xyz);
  vec3 halfway = normalize(light + eye);

  // ...

Instead of computing the reflection vector, compute the halfway or half angle vector. This vector is between the view/camera/eye and light direction vector.

Blinn-Phong vs Phong

    // ...

    float specularIntensity = dot(normal, halfway);

    // ...

The specular intensity is now the dot product of the normal and halfway vector. In the Phong model, it is the dot product of the reflection and view vector.

Full specular intensity.

The half angle vector (magenta arrow) will point in the same direction as the normal (green arrow) when the view vector (orange arrow) points in the same direction as the reflection vector (magenta arrow). In this case, both the Blinn-Phong and Phong specular intensity will be one.

Blinn-Phong vs Phong

In other cases, the specular intensity for Blinn-Phong will be greater than zero while the specular intensity for Phong will be zero.

Source

(C) 2020 David Lettier
lettier.com

◀️ 🔼 🔽 ▶️