# The Industry's Foundation for High Performance Graphics

1. ## Difference between Gouraud and Phong Shading

Hello, I'm trying to understand Gouraud and Phong Shading. I have consulted several sources but I still couldn't understand what they are and what is the difference between them. Can you explain them to me shortly please?
Thanks.

2. Flat shading computes lighting values for one vertex per polygon and uses the resulting color for the entire polygon,
resulting in a single flat color for every polygon. The individual polygons can be seen.

Gouraud shading computes lighting values per vertex and interpolates them over a polygon, i.e. for each fragment on
the polygon, the color values from the vertices are interpolated.

With gouraud shading, you will get visible specular highligts on vertices, but you won't see much of the specular
highlight if it should be on the inside of a triangle. Around the specular highlight, you will see noticable poolygon
edges. Specular highlights will appear to jump from vertex to vertex when moving the model, camera or light source.
The quality of your specular highlights depends on the number of vertices in your model.
See here for an example.

Phong shading interpolates the lighting parameters across the polygon and computes the lighting per fragment, not
per vertex. You get good looking, round, smooth specular highlights that move smoothly along the surface as the camera,
model or light moves. No visible artifacts from the polygon edges.
See here for an example

Phong shading is not to be confused with the Phong reflectance model, a mathematical model for computing illumination
at a point on a surface.

3. Gouraud Shading is effective for shading surfaces which reflect light diffusely. Specular reflections can be modelled using Gouraud Shading, but the shape of the specluar highlight produced is dependent on the relative positions of the underlying polygons. The advantage of Gouraud shading is that it is computationally the less expensive of the two model, only requring the evaluation of the intensity equation at the polygon vertices, and then bilinear interpolation of these values for each pixels.
Phong Shading produces highlights which are much less dependent on the underlying polygons. However, more calculation are required, involving the interpolation of the surface normal and the evaluation of the intensity function for each pixel.

4. So my question is - Which type of shading is used in state of the art OpenGL applications such as Grand Theft Auto? Are shaders used to do Phong shading? Is something even more sophisticated or compute-intensive than Phong used? Fixed pipeline GL uses either flat or Gouraud (as far as I know).

5. At this point, the terms are effectively defunct. Goroud shading could be interpreted to mean "compute lighting per-vertex, then interpolate the result across the triangle," while Phong shading would mean "interpolate normals per-vertex, then compute lighting per-fragment".

This distinction is irrelevant, as "state of the art" applications use some form of bump-mapping, which does rather more than merely interpolating normals. And many modern engines are moving to deferred rendering, where you don't even do lighting "per-fragment"; you write the lighting components per-fragment, then do lighting on the visible pixels only.

6. I'm familiar with bump-mapping from rendering codes such as Lightwave. Didn't know it was being used in real-time apps like games. Thanks for explaining 'deferred rendering'. Have seen the term thrown around on the forums, but didn't really know what it meant. Bump mapping and deferred rendering are much more compute intensive than Phong shading - correct?

7. The whole point of deferred rendering is to be less "compute intensive" than other things; at it's core, it is merely an optimization. But this means of rendering makes the Goroud/Phong distinction functionally irrelevant, since it's doing lighting computations per-visible-sample. And even how much of an optimization it is depends on the GPU, as many tile-based GPUs don't get faster with deferred rendering, since they can sort tiles per-sample. Then again, others do get faster.

Stop thinking of rendering techniques as some kind of ladder, where X>Y>Z. They're rendering techniques, and each one has its own performance profile and its own visual fidelity. Some things look really good and are cheap. Some things don't change how things look at all, but are cheaper than what was there before. Some are cheap on some hardware and more expensive on others.

8. Gouraud Shading is effective for shading surfaces which reflect light diffusely. Specular reflections can be modelled using Gouraud Shading, but the shape of the specluar highlight produced is dependent on the relative positions of the underlying polygons. The advantage of Gouraud shading is that it is computationally the less expensive of the two model, only requring the evaluation of the intensity equation at the polygon vertices, and then bilinear interpolation of these values for each pixels.
Phong Shading produces highlights which are much less dependent on the underlying polygons. However, more calculation are required, involving the interpolation of the surface normal and the evaluation of the intensity function for each pixel.

9. Originally Posted by kaufenpreis