Search code examples
opengl3dphong

Can the Phong shading model be implemented in fixed function pipeline OpenGL?


The Phong shading technique interpolates normals at vertices to achieve a smooth shading effect. It is usually combined with the Phong illumination model, and it can be implemented in modern OpenGL. However, does fixed-function pipeline OpenGL (legacy OpenGL) include support for it?


Solution

  • No, it can't. Modern OpenGL enables programmers to customise the rendering pipeline in many ways, which enables them to implement this technique. However, legacy OpenGL has no support for interpolation of vertex normals. The closest effect you can get is Gouraud shading, which interpolates colors at vertices.

    As stated in the OpenGL wiki:

    Hardware support for lighting only extended as far as the Blinn-Phong lighting model, computed per vertex and interpolated as a final light intensity.