Theory
Toon a.k.a cel shading is a non photorealistic rendering technique
Makes the 3D models appears in a style of cartoon, comic, hand-drawing.
Stylized Specular Highlights
Plane white specular highlights with sharp boundaries
Compute the specular reflection term of the Phong shading model
and set a threshold. If greater than the threshold, set the
fragment color to the specular reflection color times the
(unattenuated) color of the light source.
Stylized Diffuse Illumination
The diffuse illumination is stylized, consists of very few colors
(depending on the number of cuts)
Set a threshold for the diffuse reflection term of the Phong
reflection model. For example, when threshold is
0, use the full diffuse color, no unlit color
1, use full unlit color, no diffuse color
0.5, half diffuse, half unlit
Anything in between = a combination of diffuse and unlit
Characteristic Outline
Has outlines of specific color (usually black) along the silhouettes of
the model
The outline is made from the model in question but scaled upwards,
rendered in a single color, and it always shows on top of everything
except the object it is outlining.
Standard shader vs Our toon shader
Shader Properties
First Pass of the Shader:
struct vertexInput/vertexOutput
First Pass of the Shader:
Vertex shader
First Pass of the Shader: fragment shader
Attenuation (directional light vs spotlight)
First Pass of the Shader: fragment shader
Set colors and return fragmentColor
Second Part of the Shader: Outline
Thank you for your attention!
Questions?