OVERVIEW:
This project was alot of fun from the beginning. I wanted to create a cel shader and then work on adding hatching and stippling to the cel shader for cool effects.
I first started looking at page 329- 331 on the "Advanced Renderman" book. There I needed to learn what a dot product was and how it works. Once I understood the cel shading code, I then worked on going further.
I wanted to create a shader that would best represent M.C. Escher. So, I started looking at references of his work. From this I realized I need three main things: lines that had variance to them based upon spec, shifts of color for depth, and finally different directions for the lines.
Next, I searched to see if anybody had done any research on toon shading and came upon a students code. In his code he created some things that I needed. With his code and the "Advance Renderman" book by my side, I was able to start formulating my own code.




What you see here is Cel Shading(top left), Hatching (top right), Cross Hatching (bottom left), and Stippling (bottom right)
PARAMETERS:
 |
inkwidth - stroke size of each line
lineFreq - number of lines in a seed
Jitter - noise in the stroke
U_Switch - 0 means "OFF" / 1 means "ON" (This turns on your strokes)
V_Switch - 0 means "OFF" / 1 means "ON" (This turns on your strokes)
U_Color - Color of Ink for U direction
V_Color - Color of Ink for V direction
Matte - basic color underneath ink
taperwidth - how much tapering based upon Spec Illumination
RotateU - Rotation for the U direction
RotateV - Rotation for the V direction
Ka - ambient
Ks - specular
Kd - diffuse
roughness - spec fall off
Dots - 0 means "OFF" / 1 means "ON" (AKA - Stippling)
SwtichOutLine - 0 means "OFF" / 1 means "ON" (This allows for the user to have a cel shading line on the shader)
outlinethickness - Thickness of outline
outlineColor - Color of outline ink |
MY STRUGGLES:
I first had difficulty getting the illumination to work with my tapering for the lines. I eventually learned that I needed to change my math to get it to work properly.
When I worked with illumination as a key attribute, I did not take into account that lines or the dots would move so differently. I want to eventally go back and change this effect to not look like tv noise.
Attached is a video to demonstrate my problem.
SOURCE CODE:
Toon Shading
SW- Escher Shader