home about gallery publications education links contact


..::cellshader::..

Note from the author: This article was written without any specific package in mind, yet the information contained can be introduced to 3ds max to produce an effective cell shader. It should also be noted that later versions of 3ds max (version 5) contains a built in cell shader.

Unfortunately, as they stand, some packages do not have a built in cell shader, but there are several good plug-ins on the market for a price which are obviously better, but this workaround gives you the ability to include toon and cg elements in your scene, whereas some do not allow you to do this mainly due to the entire rendering engine having to be changed to generate the cellshade’d effect.

The main difference between a normal shader and a cell shader is the use of falloff when it comes to hilights and diffuse shading, so the main task is to eliminate this gradient effect. There are two main ways to do this. The more painstaking method is to have a tree structure of falloff materials, which have the ability to amend the shadow and light colours (where the shaded slot contains only the colour and the lit slot the next falloff material), each with an adjusted mix curve to create the straight-edged transition through the gradient.

The positioning of each curve's points would have to adjusted for each falloff material down the tree to amend the size of each colour band in the end result. This isn't difficult, but carefully traversing up and down through the material’s tree and carefully adjusting each band of colour can be painstaking and annoying, and also has a tendency to vary in size from object to object.

Therefore, another way is to use a gradient type material (if the feature exists in your 3D package) with solid interpolation to create the block colours (hence no dithering between colour bands) and lighting as the gradient type, designed so the lightest colour always points to the hilight on the object. You then simply create your cell shade gradient from white (used very very sparely though, or an extremely light version of the diffuse colour), to a light version of the diffuse colour, the diffuse colour, a dark version of the diffuse colour, and finally to black (again, used very sparingly or not at all).

The final task, for both these methods, is to include the thin black line around the cellshade'd object. Use a Fresnel shader for this with the falloff tree / gradient in the front slot and a black colour in the side slot. Then simply amend the mix curve to create a sharp transition from black to white and adjust the positioning of the transition to adjust the width of the line.

These methods are pretty identical in result, though the falloff tree method gives greater flexibility with the ability to create small gradients to blend each colour band together, giving a difference in style, unless it is possible in your package to emulate this using gradients. Both end results are effective and work with casting and receiving shadows, even though you have to have self illumination set to 100% in both methods, but, unfortunately, due to it being only a workaround and not a complete system, they have problems with drawing the thin outer line (which can sometimes vary in size) on intersecting and straight-edged objects.

Enlarge ScreenshotDemonstrating the falloff tree applied to an object, it is also applied, using different colours and limits, to the ground plane object, therefore casting a cellshade shadow and completing the entire effect in the scene.
Enlarge ScreenshotBy simply amending the gradient blend type, cellshade styles can be quickly created and amended, even by using the same colour setup; the left object using a linear edge blend type, while the right using a standard dither.

Initially published: 3D World magazine, Issue 4, October 2000.

Copyright © Pete Draper, October 2000. Reproduction without permission prohibited.

www.xenomorphic.co.uk