In this example, we'll be looking at how to create shading networks with code. We'll be creating a simple toon shader, with a solid color in the interior and a different color at the edges of the object. There are a few different ways to do this, including by creating a rampShader, but we'll be doing it in the somewhat old-fashioned way using a samplerInfo node, as it provides a great example of a relatively simple yet somewhat novel shading network.
First off, let's have a look at what our shader will do and how it will do it. The key characteristic of a toon shader is that the object has an outline around its edges that changes as the object moves. So, the first thing we'll need is some way of knowing what the angle is between a given part of the model and the camera. Luckily, Maya provides a utility node that does just that in the form of samplerInfo. SamplerInfo nodes provide us with a facingRatio
attribute that ranges from 0 (when a surface is perpendicular...