Help end child hunger

Toon Shading

 
Prev: Flatten Shader Next: Toon - Version I
 

Toon shading is probably the simplest non-photorealistic shader we can write. It uses very few colors, usually tones, hence it changes abruptly from tone to tone, yet it provides a sense of 3D to the model. The following image shows what we’re trying to achieve.

The tones in the teapot above are selected based on the angle, actually on the cosine of the angle, between a virtual light’s direction and the normal of the surface.

So if we have a normal that is close to the light’s direction, then we’ll use the brightest tone. As the angle between the normal and the light’s direction increases darker tones will be used. In other words, the cosine of the angle provides an intensity for the tone.

In this tutorial we’ll start with a version that computes the intensity per vertex. Then we will move this computation to the fragment shader. It will also be shown how to access OpenGL light’s position.

 

Prev: Flatten Shader Next: Toon - Version I
 

  One Response to “Toon Shading”

  1. Thanks ,very useful

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: