I'm was actually kind of mind blown by this lecture. In my favorite 3D graphics software Maya, there is this material called Phong that I often use for shiny stuff. In the Phong shader there is an attribute called "cosine power" that controls how big/small the highlight is. I've always used these features like Phong and cosine power but never wondered why they are called what they are called. Now I now that n*h = cos of the angle to the normal and that p, the power applied to this, controls how fast the highlight diminishes. THAT'S WHY ITS CALLED COSINE POWER. AAAAAUUUUUUGHGHGGHGHGH.
How would you actually combine the lighting? I'm confused whether you'd draw ambient, then diffuse, then specular like the painter's algorithm, or whether you'd combine colors from diffuse and specular, for example.
How does the color of the light source factor into this? It seems these equations are all under the assumption that the light is 100% in all color channels, but does specular or diffuse lighting change depending on the light source? Especially since it appears that specular lighting does not depend on the color of the object at all. I'm having a hard time visualizing this reflection model with different colored light sources.
@gavinmak, from the formula it's just addition, so order does not matter (addition is commutative). For example, a pixel in the final Phong reflection P(x,y)P(x,y)P(x,y), would have value La(x,y)+Ld(x,y)+Ls(x,y)L_a(x,y) + L_d(x,y) + L_s(x,y)La(x,y)+Ld(x,y)+Ls(x,y) [but of course this would be per channel and with a ceiling of pure white]. If it was like Painter's algorithm, then the shading would look weird where the diffuse lighting is weak and the ambient lighting is strong.
@brianlo1202 Is the Phong shader something like the "shading per pixel" model?
Phong shading usually refers to interpolating normals, then doing per-pixel shading. You can, however, apply the Phong reflection model to per-vertex shading.