Adding Switches Using Advanced Mode Graph Nodes

When Toggle Advanced Mode is toggled on, a set of Graph Nodes is also available for creation.

Graph Nodes allow you to perform custom decision making in a graph. Essentially, you can create a switch as follows:

if true
    do A
else
    do B

Some examples of graph nodes are Bool AND and Path Direction.

The Bool Graph Nodes (Graph Nodes Code Control Bool AND, Graph Nodes Values Bool Value, and so forth) should not be confused with the Bool value nodes (Hw Shader Nodes Values Bool).

A Bool node supplies a True or False value to the shader code, while a Bool Graph Node acts as a switch and does not supply a value to the shader.

In this example, the BoolValue Graph Node is the switch that controls whether PathDir takes input A or input B. If Bool is connected to PathDir, input A is used. If Not Bool is connected to PathDir, input B is used. BoolValue does not directly supply any value to Diffuse Color.

The V symbol in the socket indicates that an input from a Graph Node (or an output to a Graph Node) is expected.

In this example, the Color value is multiplied by 1 or 0, depending on Bool. When Bool is set to True, Color is multiplied by 1 and Result is yellow. When Bool is set to false, Color is multiplied by 0 and Result is black. Therefore, Bool directly supplies a value to the shader.

An example application of using the Graph Nodes is to enable or disable opacity. Since it is more expensive to render a shader with opacity than it is without, an artist can add a switch to easily enable or disable this setting for faster preview rendering results.