How do they work and what are the differences between them? In what scenario should you use which one?
1 Answer
Flat shading is the simplest shading model. Each rendered polygon has a single normal vector; shading for the entire polygon is constant across the surface of the polygon. With a small polygon count, this gives curved surfaces a faceted look.
Phong shading is the most sophisticated of the three methods you list. Each rendered polygon has one normal vector per vertex; shading is performed by interpolating the vectors across the surface and computing the color for each point of interest. Interpolating the normal vectors gives a reasonable approximation to a smoothly-curved surface while using a limited number of polygons.
Gourard shading is in between the two: like Phong shading, each polygon has one normal vector per vertex, but instead of interpolating the vectors, the color of each vertex is computed and then interpolated across the surface of the polygon.
On modern hardware, you should either use flat shading (if speed is everything) or Phong shading (if quality is important). Or you can use a programmable-pipeline shader and avoid the whole question.
-
$\begingroup$ On modern hardware, I'm unaware of hardware-based Phong modes. Also, incidentally, for programmable shaders, which by now are ubiquitous, people almost always use microfacet-based BRDFs. $\endgroup$ Commented Sep 2, 2015 at 2:14
-
$\begingroup$ My point is that the speed increase of Gourard over Phong isn't enough to justify the loss of quality -- modern computers can (or at least should) be able to do both in realtime. $\endgroup$– MarkCommented Sep 2, 2015 at 2:32
-
$\begingroup$ The way you phrased it, it sounded like there is fixed-function Phong functionality, while I don't believe there is. Separately, you say you should use Phong "if quality is important", but Phong is actually a poor quality BRDF model. By some measures, worse even than Blinn-Phong, which is what hardware Gouraud shading uses to shade vertices. $\endgroup$ Commented Sep 2, 2015 at 2:37