Week 1 – Toon shader / Curve Tool

Toon Shader

We’ve learnt how to use Toon Shader in Maya at classroom

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.

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. To view the Toon Edge, you must change the Filter Type (Sampling settings) to ContourNote 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. It requires a smooth tangent field. A light must be specified for the stylized highlight.

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.

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. 

Using the HalfTone OSL Shader with Toon

This short tutorial shows how it is possible to create a halftone shading effect using an OSL shader connected to the Toon shader. Thanks to Zap Andersson for this shader and for the help with this tutorial.

The Halftone OSL shader is available here.
  • Start off by downloading the Halftone shader from the above link.
  • Assign a Toon shader to your model.
  • Create an OSL shader and import/compile the Halftone OSL shader within it. Once it has compiled you should see the Halftone OSL attributes as values and sliders in the OSL shader.
  • Connect the OSL shader to the Base Tonemap attribute of the Toon shader.
  • You can control the halftone shading effect by connecting a black and white ramp to the input value of the Halftone OSL shader.
Without rampRamp -> Input Value of Halftone

That’s it! Have fun experimenting with different scale values and ramps to create different effects.

Curves / cable plugin

Cable It plugin for Maya by Wizix

We’ve learnt how to Draw NURBS curves in Maya.

You can draw a NURBS curve by placing control vertices (CV), placing edit points, or by drawing freehand. If you draw with CVs or edit points, the curve is automatically smoothed; if you draw freehand, the curve exactly follows the path of the tool tip.

Before starting to draw, you might want to review or set options for a tool by selecting the option box. For example, select Create > Curve Tools > CV Curve Tool >  to see the CV Curve Tool options.

To draw a NURBS curve by placing CVs

  1. Select Create > Curve Tools > CV Curve Tool.
  2. Click to place the CVs.
    • The first CV looks like a hollow box; subsequent CVs are dots. Hulls are drawn between the CVs as you place them.
    • For each CV after the third one you place, the shape of the curve is drawn.
    • To remove the last CV you placed, press Delete.
    • To switch to editing CVs, press Home or Insert. A manipulator appears on the last
    • CV. Use the manipulator to move the CV, press Delete to delete a segment, or click another CV to edit it. Press Home or Insert again to return to adding CVs.
  3. Press Enter to finish the curve.

To draw a NURBS curve by placing edit points

  1. Select Create > Curve Tools > EP Curve Tool.
  2. Click to place the edit points.
    • For each edit point after the first one you place, Maya draws the shape of the curve.
    • To switch to editing edit points, press Home or Insert. A manipulator appears on the last point. Use the manipulator to move the point, press Delete to delete a segment, or click another point to edit it. Press Home or Insert again to return to adding points.
  3. Press Enter to finish the curve.

To draw a NURBS curve freehand

  1. Select Create > Curve Tools > Pencil Curve Tool.
  2. Drag to sketch a curve. When you release the mouse button, the curve is drawn.
  3. The Pencil Curve tool creates a curve with a large number of data points. Use Curves > Rebuild to simplify the curve.
    • As you draw the curve, points are placed in the view if they are at least five screen pixels from the previous point.
    • If you sketch in an orthographic view (front, top, or side), the curve is placed on the view plane at the origin. If you sketch in the perspective view, the curve is placed on the grid plane.

Related topics

Share your thoughts