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 (Window → 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 consists of a 2D Placement node, a File node, and a Lambert shader.

From the connections between the nodes, we can see that the 2D Placement is responsible for many of the attributes of the File. The single connection that connects the File to the Lambert shader represents 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 connection between the File and the Shader should say "file1.outColor" over the file and "lambert2.color" over the shader. 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, add a new Multiply Divide node to the Work Area by Middle-clicking it and dragging it where you want it. Delete the connection between the File and the shader. Middle-click the right side of the File and release on the Multiply Divide node. Select input1 from the resulting menu. Similarly, Middle-click the right side of the Multiply Divide node and release on the shader, selecting color from the options. If you want to make a unusual connection between nodes, select Other... from the menu.

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 besides the fact that your sphere got blurrier. This indicates that Default Quality Rendering is not up to the task. Enable Renderer → High Quality Rendering to get a better look at the shader.

In the Hypershade, double-click the Multiply Divide node. This should bring up the Attribute Editor. The values 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 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. 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.

If you have studied math at all it should be fairly clear that 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