Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Multiexcerpt
MultiExcerptNamesynopsis


Center

Gallery
columns14
includeLabeltitle
sortsize


The toon shader is part of a non-photorealistic rendering (NPR) solution that is provided in combination with the Contour Filter 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.

Center

Image rollover
0diagram-1.jpg
1diagram-2.jpg

Skydome lighting. Rollover image for directional lighting.

1. Edge (requires Contour Filter)

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.

Note

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.

2. Stylized Highlight

An arbitrary texture that can be used to create a highlight. A light must be specified for the stylized highlight.

Note

stylized_highlight requires subdivision with smooth_tangent enabled, otherwise, artifacts may be visible.

3. Specular/Base Tone Mapping

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.


Info
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).

Center


HTML Table
border0
classthinTable


Table Row (tr)


Table Cell (td)
colspan3


Center

 







Tip
Pixel Art Style

A pixel art style can be achieved by using negative Camera AA samples with the Toon shader.

Center

Toon with base and specular_tonemap (directional lighting)

Hatching

A cross hatching sketch style can be achieved by connecting an UberNoise.osl to toon.mask_color. 

Center

UberNoise.osl -> toon.mask_color



...

Multiexcerpt
MultiExcerptNameshader_difference

Detects the difference of shaders of neighboring samples. This is useful when multiple shaders are assigned to a single polymesh, for example.

Center

Gallery
includeLabelshader_difference
sortname
reversetrue


Note

Ensure that the angle_threshold is low enough, otherwise, you may not notice a difference.

...




uv_threshold


Multiexcerpt
MultiExcerptNameuv_threshold

If enabled, edge detection uses the difference of UVs from neighboring pixels.

Center

Gallery
includeLabeluv_threshold-alien

 




angle_threshold
Multiexcerpt
MultiExcerptNameangle_threshold

When less than 180, the edge detection uses the difference of the angle between neighboring pixels.

Center

Gallery
includeLabelangle_threshold_shape
sortsize


Angle_threshold keyframed from 180 to 10


...

Multiexcerpt
MultiExcerptNamespecular

The specular weight. Influences the brightness of the specular highlight. The base_weight is affected by the specular_weight. This is because the toon shader is not a physically based shader but is designed to conserve energy.

Center

Gallery
includeLabelspecular
sortname


Note

Note that the specular examples here all use tonemap.

...




specular_color


Multiexcerpt
MultiExcerptNamespecular_color

The color the specular reflection will be modulated with. Use this color to 'tint' the specular highlight. You should only use colored specular for certain metals, whereas non-metallic surfaces usually have a monochromatic specular color. Non-metallic surfaces normally do not have a colored specular.

Center

Gallery
includeLabelspecular_color2
sortname
reversetrue

 




specular_roughness


Multiexcerpt
MultiExcerptNamespecular_roughness

Controls the glossiness of the specular reflections. The lower the value, the sharper the reflection. In the limit, a value of 0 will give you a perfectly sharp mirror reflection, while 1.0 will create reflections that are close to a diffuse reflection. You should connect a map here to get variation in the specular highlight.

Center

Gallery
includeLabelspecular_roughness


Note

Note that Toon Edge will not appear in reflected surfaces unless Specular Roughness is 0.

Center

Gallery
includeLabelreflected-toon
sortname

Toon shader assigned to floor plane

 





specular_anisotropy


Multiexcerpt
MultiExcerptNamespecular_anisotropy

Anisotropy reflects and transmits light with a directional bias and causes materials to appear rougher or glossier in certain directions. The default value for Anisotropy is 0, which means 'isotropic.' As you move the control towards 1.0, the surface is made more anisotropic in the U axis.

Center

Gallery
includeLabelspecular_anisotropy
sortname

 




specular_rotation


Multiexcerpt
MultiExcerptNamespecular_rotation

The rotation value changes the orientation of the anisotropic reflectance in UV space. At 0.0, there is no rotation, while at 1.0 the effect is rotated by 180 degrees. For a surface with brushed metal, this controls the angle at which the material was brushed. For metallic surfaces, the anisotropic highlight should stretch out in a direction perpendicular to the brushing direction.

Center

Gallery
columns5
includeLabelspecular_rotation
sortname

...




specular_tonemap
Multiexcerpt
MultiExcerptNamespecular_tonemap

Connect a ramp node here to create a cell look (regarded as a tone map).

Center

Gallery
includeLabelspecular_tonemap_sven
sortname


Center


specular_tonemap with increasing specular_roughness


...

Multiexcerpt
MultiExcerptNametransmission

The transmission allows light to scatter through the surface, for materials such as glass or water.

Center

Gallery
includeLabeltransmission_weight
sortname


Note

Note that you must also disable Opaque for the mesh that has been assigned the Toon shader.


Info

If you can only see black where there should be transparency, you may not have a high enough refraction ray depth value (found in the Ray Depth section of the Render Settings). The default value is two.

 




transmission_color
Multiexcerpt
MultiExcerptNametransmission_color

Transmission_color multiplies the refracted result by a color.

Center

Gallery
includeLabeltransmission_color
sortname
reversetrue


...

Multiexcerpt
MultiExcerptNametoon_ior

The IOR parameter (Index of Refraction) defines the material's fresnel reflectivity and is by default the angular function used. Effectively the IOR will define the balance between reflections on surfaces facing the viewer and on surface edges. You can see the reflection intensity remains unchanged, but the reflection intensity on the front side changes a lot.

Center

Gallery
includeLabeltoon_ior
sortname


Info

The Edge parameter is also affected by IOR.

Center

Image rollover
0car-IOR-1.jpeg
1car-IOR-1.5.jpeg

IOR: 1. Rollover image to view 1.52 (default). Transmission: 1.

...





normal

Multiexcerpt include
MultiExcerptNamenormal
nopaneltrue
PageWithExcerptstandard_surface

...

Multiexcerpt
MultiExcerptNameindirect_diffuse

Multiexcerpt include
MultiExcerptNameindirect_diffuse
nopaneltrue
PageWithExcerptstandard_surface

Tip

Indirect_diffuse: 0 (default) creates a more two-dimensional looking toon shading effect.

Center

Gallery
includeLabelindirect_diffuse
sortname

...





indirect_specular

Multiexcerpt include
MultiExcerptNameindirect_specular
nopaneltrue
PageWithExcerptstandard_surface

...

Multiexcerpt
MultiExcerptNamebump_mode

Choose the component(s) affected by bump: diffusespecular, or both.

Center

Gallery
includeLabelbump_mode
sortname

 




energy_conserving


Multiexcerpt
MultiExcerptNameenergy_conserving

The toon shader is energy conserving by default. If this is disabled, the Toon shader simply adds base, specular, and transmission. Care should be taken when disabling this option as it will affect indirect illumination with the toon shader.

...

Multiexcerpt
MultiExcerptNameaov_prefix

An optional aov_prefix that will be prepended to the toon AOVs' names. For instance, if aov_prefix is "toon_", the toon diffuse AOV will be written out to "toon_diffuse". This can be used when you need to access both the toon AOVs and the core's LPE AOVs.

...





Pepe model by Daniel M. Lara (Pepeland). Mery model by Jose Manuel Garcia, www.meryproject.com. Cubebot by Christophe Desse.

...