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)
- Sheen (Toon)