Tuesday 19 July 2011

Cel-Shading

Cel-shading has been my favorite objective. It was the 3rd one I actually completed and I really like the way it looks. The method is fairly simple. Colours are flattened out into a set number of intensities based on the normal of the light hitting an object. This provides the impression of colouring objects in with a pencil crayon using flat shading (no gradients).
To get the black lines is a little trickier. A temporary image is first generated. This image colours each object with a flat shade of grey. Each object is given a different shade. Then, using the Sobel operator, a change in intensity is measured at each pixel. If the intensity of a colour changes, that means the edge of an object is at that pixel.
A giant grid of 1s and 0z is then produced. A 1 means there is no edge at the corresponding pixel and a 0 means there is an edge. When the actual image is rendered, each pixel colour is multiplied by it's corresponding grid in the cell. So, if there is an edge at a particular pixel, it will be multiplied by 0, resulting in the colour black, otherwise the calculated colour is used.
The following is a simple image rendered normally:


Here, we have the same image cel-shaded!

No comments:

Post a Comment