Shading Networks Exercise

If you have done the Basic Shading exercise, you should be familiar with creating render nodes and mapping them into specific attributes. This process is basically a "ground level" view of creating a shading network. While useful for simple networks, sometimes it is better to take a higher level view of the shading network. Let's create a simple shader and see what the network looks like.

Create a new sphere and assign a Lambert shader to it. Map the this texture into the Color. To view the shading network, open the Hypershade (Windows → Rendering Editors → Hypershade). You should see your new shader among the default shaders. Right-click it and select Graph Network from the radial menu. This will display the simple shading network in the Work Area below where the materials are listed. The shading network should consist of a 2D Placement node, a File node, a Lambert shader, and the Lambert Shading Group.

The orange connector represents multiple connections, allowing us to conclude that the 2D Placement is responsible for many of the attributes of the File. The green connector represents a single connection, in this case the mapping of the File into the Color of the shader. You can view what each connection represents by hovering over the connection with your mouse. For example, the green connection between the File and the Shader should say "file1.outColor" over the file and "lambert2.color" over the shader, while the connection between 2D Placement and File should list many attribute connections. To view all individual connections between nodes rather than a single orange connector, click the "show connected attributes on selected nodes" button () on the shelf above the Work Area. To break a connection, simply select a connection and hit Delete.

A shading network is made up of a set of nodes that "talk" to each other through connections, similar to the way that channels can control other channels in rigging. The language that these nodes speak is mostly one of numbers. This may seem a bit strange to you, since the File is sending a color to the shader. However, you should be very familiar with the Color Picker by now, which asks for a set of numbers to generate a color.

Computers typically represent a color with three numbers to form a RGB triplet. RGB stands for the Red, Green, and Blue values of the color. These values typically vary from 0 to 1 and when combined in various strengths, can form every imaginable color.

To illustrate the different color channels, we're going to experiment with a Multiply Divide node. This utility node can be found in the list which resides on left of the Hypershade. If the node is not present, highlight "Maya" in the other list to show the default set of shaders and utility nodes. You can also start typing the node name into the search bar found above these lists for quicker results. Once it is found, add a new Multiply Divide node to the Work Area by Middle-clicking it and dragging it to where you want it, or just left-clicking (it will appear in the middle of the Work Area).

Delete the connection between the File and the shader. To insert the Multiply Divide node between them, left-click the green circle on the right side of the File node (the Out Color) and drag it to the upper green circle on the left side of the Multiply Divide node (Input 1). Connect the Output (green circle) on the right side of the Multiply Divide node with the Color (red circle) of the shader in the same way. You should end up with something like this:

You now have a Multiply Divide node that receives a color from the File, manipulates it in some way, and then passes that color on to the shader. At the moment, you should notice no change in the shader.

In the Hypershade, click the Multiply Divide node. In the Attribute Editor, the value fields of Input 1 should be yellow, indicating a value is connected to them, and they should be mapped to the shader, as indicated by the arrow to the right of the values. The Input 2 values should be (1, 1, 1) by default. Try changing Input 2 to (1, 0, 0). This should turn your shader red. This is because the Multiply Divide node takes in every RGB color that the File gives it and then multiplies it by (1, 0, 0), which effectively drops the green and blue components of the color. Try various values for Input 2 and see how the shader is affected.

Most of the other shading nodes work in a similar manner. They take a number, manipulate it, and then pass it on. The Plus Minus Average node (labeled in Maya as +|- Average) provides a lot of functionality in one node. Map the color from the File into input3D[0] and map its output into the shader's color the same way you did with the Multiply Divide node. In the Attribute Editor of the Plus Minus Average node, click Add New Item for Input 3D. Set the values for Input 3D[1] to (0.5, 0.5, 0.5). Notice that the shader becomes brighter.

This node now transforms (R, G, B) colors into (R + 0.5, G + 0.5, B + 0.5) colors. This means you can create RGB colors that lie outside the range of 0 to 1. However, this typically won't do you any good since the colors are eventually clamped back into the 0 to 1 range. Any color greater than (1, 1, 1) will go to white and any color less than (0, 0, 0) will go to black.

There are many, many other types of render nodes. We will briefly describe some of them here, but you will probably want to experiment with them on your own.

Back to Exercises