The Toon shader is part of a non-photorealistic rendering (NPR) solution that is provided in combination with the Contour Filter.
There are some current limitations when using the Toon shader. These are as follows:
- Volumes, motion blur, DOF and the VR camera do not currently work with the Toon shader.
- Toon Edges can be jaggy if the pixel intensity is greater than 1.0 (for example, when incorrectly combining a Background shader with Skydome camera visibility). This can be fixed by clamping the Camera (AA) samples.
The diagram and accompanying text below describe the shading components that form the Toon shader. Note that the appearance of the Base Tonemap (using a ramp) appears very different with Skydome lighting (soft gradation) compared to that of say a directional light (hard gradation). Rollover the image below to view the effect of lighting on the Base Tonemap ramp.
Skydome lighting. Rollover image for directional lighting.
The Toon shader supports Line Color and Width Control. Both of these are useful for avoiding line clutter and changing the line stroke style. The Edge detection also uses id, mask color, and texture UV discontinuity. To view the Toon Edge, you must change the Filter Type (Sampling settings) to Contour. Note that increasing the Contour Filter Width (Sampling settings) value will increase render times.
An arbitrary texture that can be used to create a highlight. It requires a smooth tangent field. A light must be specified for the stylized highlight.
The Toon shader uses cell shading via ramp nodes for both Base and Specular. While it is recommended to connect ramp shaders to the Tonemap attributes, any shader can be connected.
4. Rim Lighting
Connect a ramp here to create a rim lighting effect. A light can be specified to create the rim lighting effect.
Toon Shader Visibility
The Toon shader is visible in Specular reflections (up to 3 bounces), Transmission, and also works with Displacement (ear uses Geometric Normal, Angle Threshold: 3).
Pixel Art Style
A pixel art style can be achieved by using negative Camera AA samples with the Toon shader.
Toon with Base and Specular Tonemap (directional lighting)
Toon tutorials can be found here.
|A Toon example scene file can be downloaded from the Learning Scenes page.|
Due to a large number of controls, the Toon shader is split up into several groups. The individual settings for each group are described in more detail in the pages below.
- Base (Toon)
- Specular (Toon)
- Stylized Highlight
- Rim Lighting
- Transmission (Toon)
- Emission (Toon)
- Geometry (Toon)
- AOVs (Toon)
- Advanced (Toon)