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. A light must be specified for the stylized highlight.
stylized_highlight requires subdivision with smooth_tangent enabled, otherwise, artifacts may be visible.
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).
Toon tutorials can be found here.
A toon example scene file of the Sophie asset can be downloaded here.
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)