I received a recent query about cell-shading in WPF. Cell-shading is the technique of using just a few solid colors to imitate hand-drawn animation. The first idea that occurred to me was fiddling around with the Normals collection of a MeshGeometry3D by restricting it to just a few values. I derived from my TeapotMesh class (described here ) and reset all the items in the Normals collection to the closest vector among the group (1, 0, 0) , (–1, 0, 0) , (0, 0, 1) , and (0, 0, –1) . Then I aimed some directional light at (1, 0, –1) , and I rotated the teapot a bit relative to the light, and here's what it looked like: That result, although interesting in its own way, is only a very distant relative to this example shown in the Wikipedia article on cell shading : The problem, of course, is that the normals are vertex normals, and the surface of each pixel in each triangle in the mesh is shaded based on the averaqe of the shading at the triangle's vertices. (See Chapter
Read More...