This page may include unlocalized contents


Toon Material

by Benjamin Mikhaiel, model by Martin Trafas Models from polyhaven.com Robot model by Ian Robinson


The Toon Material is Redshift's non-photorealistic rendering shader. It allows for great flexibility and creative freedom in designing cel shaded and cartoon style looks. It is one of three shaders that make up Redshift's core offering of non-photorealistic tools. The Toon Material is used as the primary shading element to create stylized cel shaded looks, the Contour shader is used to create outlines around your objects, and the Tonemap Pattern texture adds a screen space pattern to your shading to mimic a halftone dot effect and others.

Toon Shader
Non-Photorealistic Rendering
Standard Material
Physically Based Rendering



Basic Toon Setup

A basic cel shaded Toon Material can be set up with the following main ingredients:

  1. A stepped ramp to drive base tone mapping for a cel shaded look.

  2. A ramp to drive reflection tone mapping so specular reflections can be stylized.

  3. A Contour shader connected to the "contour" port of a material output node for toon outlines.

Please see the next section, Tone Mapping and Lighting, for toon lighting tips and information on tone mapping and how it works — for even more stylish effects check out the Tonemap Pattern texture!

In Cinema 4D, a Toon material preset can quickly be created using the Create menu in the Material Manager:



Tone Mapping and Lighting

What is Tone Mapping?

Tone mapping is the most important element in defining the look of a Toon shader. It is the most powerful differentiator between non-photorealistic rendering (NPR) and traditional physically based rendering (PBR) as it allows an artist direct control over lighting and shading. The key to understanding how tone mapping works is to consider the starting point — the lighting in your scene. Tone mapping works by taking the scene lighting and remapping that with a user defined ramp. If you are familiar with remapping a black and white noise with a color ramp then you're already halfway there, as the same basic methodology applies to tone mapping. Let's start with a black and white noise texture, using a horizontal ramp, the left side of the ramp maps to the darkest parts of the texture, the middle area maps to the midtones found in the texture, and the right side maps to the brightest parts of the texture. In the example below, note how the color ramp at the bottom matches up with the black and white ramp and how that applies directly to the colors of the noise texture on the plane floating in the center.


Color remapping a noise texture


With tone mapping, instead of the color ramp being driven by a 2D texture, it is driven by the actual lights in the scene and all the different aspects that this brings with it like light intensity, light angle, and shadow softness. Using a horizontal ramp, the left side of the ramp maps to the darkest parts of the scene lighting, the middle area maps to the midtones, and the right side maps to the brightest parts of a scene. At the extremes, the leftmost part of the ramp (knot position 0) maps to the shadows while the rightmost part maps to the brightest highlights. In the example below, note how the horizontal color ramp at the bottom matches up with the black and white ramp and how that directly applies to the lighting on the toon shaded objects in the scene.


Tone mapping a Toon shader with an Area Light


Light Type

In the previous example, you'll notice that the lighting is very soft and the tone mapping perfectly replicates that softness. The green part of the ramp only appears in the areas where lighting is brightest but nothing quite reaches the dark purples found on the left side of the ramp. This is because a large area light was used which casts a very diffused shadow, to change this, the light type can be changed and then the tone map effect will follow.

In the example below the area light has been replaced with a infinite/distant light resulting in perfectly sharp shadows. Because of this, the scene lighting now encompasses the full range of the ramp used for tone mapping, we see inky blacks from the black and white ramp and dark purple in the color ramp, as well as every other color in between.


Tone mapping a Toon Shader with an Infinite Light


Now the shading is nice and sharp but it doesn't look cel shaded, this can be accomplished easily by changing how the colors in your ramp are interpolated. Using a stepped interpolation between color points transforms the shading into a more stylized appearance. You can use colored ramps for colorized tone mapping or a grayscale ramp that relies on the Base Color to provide the overall color and texture.


Tonemap: Stepped Color Ramp
Base Color: White
Stepped Grayscale Ramp
Color texture map


In general, it is recommended to primarily use Point Lights, Spot Lights, and Infinite/Distant Lights when using a Toon shader because the output always matches the ramp used as a tonemap. By comparison, when an area light is used, the size of an area light has a direct impact on how the tonemap ramp is applied — even if you use a stepped ramp the tonemap will be blurred depending on how large the area light is. The examples below compare changing the size of an area light vs using an infinite light and adjusting the shadow softness. Both examples use the same tonemap but the results are very different. The infinite light provides more direct control as you can get nice soft shadows and if you actually want soft tone mapping this should be changed directly in the ramp instead.


Light Type: Infinite Light
Changing Shadow Softness
Area Light
Changing Area Light Size


Light Intensity

Since tone mapping is based on scene lighting there is a direct connection between how your tonemap is applied and how bright the lighting is in your scene. In the left example below, the intensity of a point light is animated to showcase how light intensity affects toon shading. Note how tone mapping behaves differently depending on the shape of each object, when using a stepped ramp, the shading on rounded objects smoothly transitions across the surface where as flat objects can change abruptly as light intensity passes through the different areas of the tonemap ramp.

A light's shadow transparency also has different effects on toon shading and light intensity as seen in the right example below. For more information on how shadow opacity affects toon shading, please see the Tonemap Mode parameter descriptions.


Changing light intensity Changing a light's shadow transparency


If your toon shader doesn't look the way you want, consider changing the lighting in your scene before adjusting the shader or ramp parameters — you may just need to increase or decrease the light intensity. If that doesn't solve your problem, or the rest of the objects in your scene look great but one or two do not, then it may be worth directly tweaking your ramp. You can always move the color knots around the ramp and put them in exactly the right place but the ramp shader also has a built in exposure parameter that can be used to change how the ramp is applied to your object without changing your light intensity. In the example below, the tonemap controlling the shading on the body of the robot has its exposure animated up and down to change how the tone mapping is applied, note how no other tone mapping is affected since the lighting in the scene stays the same.


Changing ramp exposure


Connecting a Tonemap

Using a tonemap with a Toon shader is as easy as connecting a ramp node to one of the tonemap inputs.



Any ramp connected at any point along the path of a tonemap input is automatically applied according to the scene lighting.

For example, you could use a ramp as a mask to blend between two different textures with a color layer node, but you must remember that the ramp will automatically be applied as a tonemap. Effectively, this allows you to use ramps to apply any sort of effect you can think of based on scene lighting as long as it is part of a node network that goes into a tonemap input. Understanding this is the cornerstone to complex and stylized tone mapping, this is what allows the Tonemap Pattern texture node to scale the size of the pattern based on scene lighting. In the example below, a ramp is being used for the layer mask and the Color Layer node is being used to drive the Base Tonemap input, the ramp is automatically mapped to the scene lighting while the two tile textures are projected as usual.



Troubleshooting

If your shader is unexpectedly dark or completely black there are some things you can check. First check the lighting in your scene, make sure the lights are bright enough and try using a point or infinite light if area lights are being used. Try isolating each shading component by increasing or decreasing the base weight, reflection weight, and rim weights individually to help pinpoint the problem. Check your base and tonemap colors — if either are too dark this may stop any shading from appearing. Check your reflection settings, try reducing the Reflection Weight and setting the Energy Conservation Mode to None in the shader's Advanced section. Check the Reflection Tonemap Mode, if it's set to Stylized you must connect a light in the Reflection Light List otherwise you will get a completely black layer cast over your object.

If none of these work, consider building a new toon shader from scratch and work your way back up slowly.