Nodal Shading

Historically in Modo, all material shading for a surface was defined through the Shader Tree exclusively, using a stack order paradigm. Layers higher in the list order obscured the lower layers unless a mask was applied or its blending mode was changed. This method of working is incredibly intuitive and flexible, however it did make certain types of setups difficult to manage, or certain effects impossible altogether. With the introduction of Nodal Shading, you can control nearly any surface attribute on a per sample basis, using a variety of driving influences, producing effects that were simply not possible in earlier versions.

Nodal Shading is named so because it uses a network of nodes, simple visual representations of a specific function. These functions could be representative of an item and its channels, a mathematical operation, or even some type of instruction to evaluate data a certain way. These various nodes are then linked together creating a network that defines the flow of information and controls how it is evaluated, the resulting network is called a graph.

Working in this way provides a sort of visual programming methodology for creating the shading instructions, where each node applies its contribution and then passes on the information to the next node. The flow of information through the network is left to right, where the left side link connections provide inputs for the information, which is evaluated and then returned to the right side connections to produce the output. Once a network is set up and assigned to a surface, the associated graph is evaluated at render time to produce the final shaded results.

Tip:  The Schematic viewport, used most often for rigging and particles, is the control interface where the shading graphs are defined. It is important to understand first that nodal shading is not a replacement for the Shader Tree, which is still a requirement to apply the shading to the actual surfaces for rendering. Each graph must contain at least one Shader Tree specific item. So a basic workflow when defining nodal shading is to add an item to the Shader Tree (placed into the appropriate target Material Group) and then that texture layer is added to the Schematic viewport for further network development.

Graph Building Basics

Working on a node graph is made more efficient by having multiple viewports available at once. You can easily navigate between the Shader Tree, the Schematic viewport and the Channels list within the default Render workspace layout. It is accessible in the menu bar under Layout > Layouts > Render (or simply the Render tab, in the tabbed workspace). The Schematic panel, not visible by default, is located in the tabbed viewport group directly under the Preview window, by selecting the Schematic specific tab.

Any network graph needs at least two nodes. Since it is necessary to have at least one Shader Tree specific item in a node network, it is often easiest to start any new shading graph by adding the initial item there. If you are not familiar with the Shader Tree, it is highly recommended to read Shader Tree. This explains the adding of items to the tree and setting Effects. Once the item is added (and if necessary, positioned appropriately in the hierarchy), it can be placed into the Schematic viewport. This is done a couple of ways, either by drag and drop or by simply selecting the item layer in the Shader Tree and using the Add Selected button found in the Schematic viewport.

Additional nodes can then be added directly in the Schematic viewport using its Add button. Left-clicking the button opens a menu containing all possible nodes, though you'll mostly be sticking to the Channel Modifiers, Shading Inputs, and Shader Nodes menu options when working with nodal shading. Selecting any item in the menu adds it to the Schematic viewport. The resulting node can be repositioned by left-clicking and dragging on the header of the node to the new location, and releasing the mouse button. It is easiest to see the flow of the data working left to right, so when adding nodes in the Schematic viewport, it is best to arrange them in this order, with the final destination node positioned on the furthest right-hand side of the viewport.

Newly added nodes come in with either common channels intact, or with no channels at all, depending on the item. Channels are the actual operators in the node graph, and which ones used is dependent on the desired outcome. When a specific channel is required, it can be added to a node by first selecting the target node in the Schematic, then selecting one or more of its related channels in the Channels viewport. Using the same drag-and-drop action or Add Selected method outlined above, adds the channel(s) to Schematic, attaching them to their associated item.

The final step in creating a node graph is the connecting of the channels. This represents the actual data flow between items. There are two types of basic connections, an input or an output. Some channels have only one or the other, and others have both. Channels are connected from the right side of the node, the output, into the left side of another node, the input. The channel connections are designated by the small circle on the sides of the node. Clicking and dragging creates a noodle, a line drawn in the viewport that visually represents the connection, and dragging the noodle from an output to an input (or vice versa) and releasing the mouse button defines the actual connection, fixing the line between the channels. Even if the node is moved, the noodles adjust, ensuring the connection representation is retained.

Node Graph Basics - Part 1:

Node Graph Basics - Part 2:

Warning:  This is the way a basic node graph is built, adding nodes, adding channels where necessary, and then making connections between those channels. There are also various rules governing the connections of different channel types that can be very helpful to understand when building up complex graphs. The full details of working with Items and Channels in the Schematic viewport are covered under Schematic Viewport.

Nodal Shading Basics

Knowing how to connect a graph is the easy part, but doesn't do much good if there is no knowledge of the underlying architecture. At its most basic level, Nodal Shading is all about driving values on a per-sample basis. To understand that better, let's break it up into its two parts:

Driving values - A value is simply a number, but what is being driven? Each item in the Shader Tree has a number of attributes, these are the settings that appear in the Properties panel for each item when selected. So, for a Material item, this would be things like the Diffuse Color or Reflection Amount controls. Each of these controls is actually a channel on the item, where a channel is simply any attribute that can be animated, or in the case of nodal shading, controlled.

In a schematic context, taking the RGB color output of one node and connecting it in to the RGB color input of another, say the Material's Diffuse Color channel, causes that incoming value to control, or drive, the channel it is connected to. The color defined in the Material setting itself no longer applies; its values are being overwritten by those of the incoming connection. So basically, any channel that is connected by its input is being driven by the incoming value. Driven channels are signified in the Channels viewport by the small gear icon with an arrow.

Per sample - What makes up a sample? When rendering an image, if we focus on just a single pixel for now, this one pixel is made up from many multiples of samples to arrive at the final value. For example, a single ray trace operation fires a ray from the camera out into the scene in a straight line. If the ray hits a surface, at that location in 3D space the hit surface is sampled to find out what it looks like. Answering questions like what is the surfaces color, is it shiny, reflective, is it in shadow? all of these different possibilities are individual samples. Nodal shading gives you access to the sample engine at this sub-pixel level.

Normally these samples are all derived directly from settings defined in the Shader Tree, but with nodal shading, things get really interesting because you can utilize the information from those samples directly, modify their results mid-stream, and then apply those results to different attributes altogether. The samples can be from a number of sources, and this is where the Shader Inputs come into play. Shader Inputs are information collecting nodes, outputting the results of the various samples taken. Each allows you to collect specific information about the scene and use what is collected to control something else.

For example, the Illuminate Node evaluates if light is shining on a surface and how much, the Raycast Node allows you to create sampling rays that collect information about surfaces the rays interact with. The Ray Type Node separates shading information based on the actual type of ray used to compute it, and the Shader Inputs provide the actual information about anything that is being shaded, whether it is a surface, a particle, a volumetric, or a texture.

Nodal shading doesn't have to be about complex graphs, rays, or samples. Sometimes simple operations are all that are required. In the Shader Tree alone, you are limited to the available Effect settings that can be assigned for each layer. If every possible permutation of effect were available, the resulting list would be impossible to manage. Much more control is available with nodal shading. It is easy to, for example, modulate a grids Line Width with a texture, or even with the surfaces angle of incidence, or amount of illumination. Driving values on a per sample basis is a fairly simple concept, but also incredibly powerful when used to its fullest potential.

Building a Procedural Texture:

You can also drive render outputs nodally through input channels for the color and value of each render output. For more information on how to do this, see Driving Render Outputs Nodally.