Sunday, April 27, 2008

Phong Shading

Silverback3D now officially has Phong shading (example here). The code actually isn't very different than the Gouraud shading code, since it is still interpolating values over the surface of polygons.

I might write up a more detailed post on this later, but for those of you who don't know: while Gouruad shading interpolates color across a polygon, Phong shading interpolates normals across a polygon and then calculates the color of each pixel individually. While this takes more processing power, it allows for much more advanced rendering. As you can see above, the Phong shading (right side) creates much more defined and realistic specular reflections than the Gouraud (left).

In addition to creating better looking specular highlights, Phong shading can be used for much more diverse things, like this simple toon shader that I threw together.

If you're interested in learning more, Wikipedia has a page on Phong shading with some good information.

No comments: