0

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?

Aldan Creo
  • 686
  • 1
  • 5
  • 14

1 Answers1

-2

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.

Aldan Creo
  • 686
  • 1
  • 5
  • 14
  • 2
    This is not entirely true. If you assume fixed-function includes all of the extensions added to fixed-function fragment processing over the years, that would include `env_dot` and `env_crossbar`. With these, you can create a way to pass normals through to the shader and do dot-products with them to do some basic per-fragment lighting. However, you could consider this a primitive shading language, and pretty much any hardware that can do this can (and probably does) also implement ARB_shader_object/etc. – Nicol Bolas May 26 '21 at 17:17
  • @NicolBolas my idea was to exploit multi texturing similarly like bump mapping was done by texture combiners that would provide per pixel lighting ... just a multi pass render similar to deferred rendering. However it would be sloow as using just `glReadPixels` instead of render to texture require transfer between CPU and GPU... And most likely some passes would be CPU based to achieve this. But still no shaders required. – Spektre May 27 '21 at 06:30