PDA

View Full Version : Gouraud and phong shading model



debonair
10-22-2013, 01:13 PM
While using fixed functioning pipeline in lighting, how to specify which model to use, phong or gouraud like in glsl, we can have fragment shader to calculate light values in phong while we compute light values in vertex shader in gouraud?

Dark Photon
10-22-2013, 04:08 PM
While using fixed functioning pipeline in lighting, how to specify which model to use, phong or gouraud like in glsl, we can have fragment shader to calculate light values in phong while we compute light values in vertex shader in gouraud?

There's no phong lighting support in fixed-function. Vertex lighting only (ala gouraud). Or you can do glShadeModel( GL_FLAT ) to force flat shading.

GClements
10-23-2013, 01:17 PM
There's no phong lighting support in fixed-function.
The fixed-function pipeline doesn't support Phong shading (interpolating the vertex normals and performing the dot-products per fragment), which is presumably what was meant (given the reference to "Gouraud", which is the other common shading method).

The term "Phong lighting model" (where "lighting" may alternatively be "reflection" or "illumination") refers to the overall lighting model which is the basis of the lighting model used by the fixed-function pipeline. Wikipedia article (http://en.wikipedia.org/wiki/Phong_reflection_model).

Dark Photon
10-24-2013, 04:28 AM
Thanks for the correction. I recall hearing that now, but forgot when typing.