CS 5610 Project - Fall 2007
Jeremiah Darais
Cel shading is a popular stylistic rendering method that involves shading objects using a small number of discreet colors.
There are implementations that involve using OpenGL's texture engine, but shader programming languages also lends themselves very well to achieving this effect.
In my program, the diffuse coefficient is calculated using the normal vector like in a normal lighting model, but then it is multiplied by the number of color levels, rounded up to the nearest integer, and is divided again by the total number of color levels, which yields a number of discreet factors between 0 and 1 equal to the number of total color levels.
For the specular component, if the specular coefficient is over a certain threshold, (in this case 0.25), the fragment color is simply the product of the light and material specular values.
Here is a comparison of OpenGL's builtin lighting model and the cel-shader program:
Cel-Shading with GLSL
The shader program also makes it easy to support an arbitrary number of colors by controlling it with a uniform variable
2 Colors
3 Colors
12 Colors
Future work:
Edge detection
Shadows