Shading Examples shaderSphere1, 2, 3 & 4 of Chapter 6
2 Phong Reflection Model I = k d I d l · n + k s I s (v · r ) + k a I a I = k d I d l · n + k s I s (n · h ) + k a I a (modified)
Where to apply reflection model At CPU, no example At GPU (vertex processors), examples 1 (true normals) & 3 (approximation), apply modified Phong model to vertices to get colors for vertices, and let rasterizer figure out the colors for fragments. (Smooth/Gouraud shading) At GPU (fragment processors), examples 2 (true normals) & 4 (approximation), let rasterizer figure out the normal and position of each fragment, then apply modified Phong model to each fragment to get fragment color. (Phong shading)
Teapot Examples Applied at vertex processors Applied at fragment processors