<<< Diffuse lighting in fragment shader     Index     Specular light shininess >>>

15. Specular light


  • Blinn-Phong shading model is based on lighting calculation per pixel, so it has to be implemented in the fragment shader.

  • The specular light is based on the half-vector.

  • According to the model, the intensity of specular light component is based on the cosine of the angle between the half vector and the normal.

  • The intensity of the specular light Is is

    • Is = ( N·H )shininess

    where H is the half-vector

  • In practice, GLSL formula becomes

    
      float Is = pow( max( dot( N, H ), 0.0), shininess );
    
    
  • specular light

  • Blinn-Phong light model is based on the half-vector:

  • L – the incoming light vector

  • N – the normal of the plane/pixel

  • E – the vector from the pixel to the camera

  • H – the half-vector: H = L + -E

     


<<< Diffuse lighting in fragment shader     Index     Specular light shininess >>>