$\begingroup$

OSL + Solidify (Irie's Technique)

Results:

Pros:

The toon shader has seven customizable parameters for creating many different looks

Edge strokes taper off with a natural look, like hand-drawn strokes

It renders quickly

It responds to lighting (can be lit with lamps)

Cons:

Some additional geometry must be generated to create the outlines

It won't look right if you make the outlines too thick in the modifier

The toon shader does not react to emitter meshes or other non-lamp light sources

Download here.

This technique I found demonstrated on BlendSwap by Shinsuke Irie is pretty clever. It uses OSL to get the shading, so make sure you have OSL enabled if you append this into your blends. Also you will need to make one edit to the "toon.osl" script because Blender's code has changed since this file was published: speculartoon() closure has been renamed to glossytoon() so just find and replace that text, then refresh the Script node.

The outlines are generated by a Solidify modifier that has its normals flipped (is back-facing). This part is kind of hackish, but looks good because the strokes taper off to a nice sharp point. You can adjust the edge thickness by adjusting the Solidify modifier's Thickness slider, but only a little, as changing this too drastically gives strange results. The object uses both a "Skin" and "Edge" material to achieve the end result. The outline color can be changed in the "Edge" material.

Of course you can decide to use Freestyle instead of the Solidify technique, if you prefer.

Note that with the Solidify technique edge thickness is local to the object, but it could be linked to camera distance via a driver so that strokes remain the same thickness even in close-up shots. (This is the case for Freestyle as well.)

A look at the customizable parameters in Irie's toon shader:

Conclusion:

This technique can produce very pleasing results! The way edge strokes are generated is a bit unconventional, but it's worth taking a few minutes of studying the .blend to understand how it works. At first I had apprehensions about using a technique that requires a Solidify modifier since extra geometry must be generated, and I wasn't sure if it would cause issues with the deformations of rigged meshes. But then I found this video demonstrating this technique used in production on an animated character and I am convinced this is the best way to do toon shading in Cycles at this time.