Creating a Network Material’s Public Interface

When building a network material, shading node parameters can be flagged as important, creating a public interface that is then exposed inside any network materials that use the shading node. These parameters are then used when editing the material or when using it to create a new material.

The public interface of a parameter can be nested using a page name, defined at the node level, and/or a group name, defined when exposing the parameter. When building the public interface any group name is appended to the end of a page name and any periods (.) are interpreted as the start of a sub-group. For instance:

A page name of image with a group name of coords would place any parameters below imagecoords.

A page name of image. with a group name of coords would place any parameters below image > coords.

A page name of image. with a group name of coords.s would place any parameters below image > coords > s.

An empty page name with a group name of image.coords.s would place any parameters below image > coords > s.

Note:  To display the NetworkMaterial node's Material Interface parameters in the GafferThree object table's columns, see Using and Overriding Look Files with GafferThree Lights

Re-ordering the Parameters in the Network Material

The parameters with a public interface that are exposed in the network material’s Material Interface can be re-ordered. The ShadingNodeSubnet node provides a hint as to the preferred order but, ultimately, the order is decided by the network material. To re-order the interface of the network material in the Material Interface, middle-click and drag the parameter or group.

Using the NetworkMaterialInterfaceControls Node

Logic can be applied to the public interface of a network material to change the visibility or lock status of pages or parameters. You can test parameter values using the following operators:

contains

doesNotContain

greaterThan

greaterThanOrEqualTo

lessThan

lessThanOrEqualTo

numChildrenEqualTo

numChildrenGreaterThanOrEqualTo

equalTo

notEqualTo

regex

endsWith

in

notIn

These tests can be combined using and as well as or logical operators. The node evaluates the test, for instance checking if the samples parameter is equalTo 0, and uses the result of that test to hide or lock the target interface element.

To make use of the NetworkMaterialInterfaceControls node:

1.   Create a NetworkMaterialInterfaceControls node and add it to the recipe downstream of the NetworkMaterial node.
2.   Select the NetworkMaterialInterfaceControls node and press Alt+E.

The NetworkMaterialInterfaceControls node becomes editable within the Parameters tab.

3.   Add the network material’s scene graph location whose interface you want to control to the materialLocation parameter. For more on editing a scene graph location parameter, see Manipulating a Scene Graph Location Parameter.
4.   Select from the state parameter dropdown:

visibility - to have a page or parameter be visible based on the parameter test this node defines.

lock - to have a page or parameter locked based on the parameter test this node defines.

5.   Select the type of interface element this node influences from the targetType parameter:

page (also referred to as a group)

parameter

6.   In the targetName parameter, type the name of the network material’s public interface element this node influences.
7.   Select how the interface is controlled using the definitionStyle parameter dropdown. Selecting operator tree is assumed here as the conditional state expression option is beyond the scope of this document.
8.   Select the type of test in the op parameter (under operators > ops).
9.   Enter the name of the interface element in the path parameter to perform the test against.
10.   Enter the value for the test in the value parameter.
11.   Add any additional tests needed using the Add > ... menu.