You can add a
Default Value node to your graph. This way, MyColor provides a default input value, while the user can also provide an alternate input value. If an alternate is provided, it is used. Otherwise, the default value is used.
Adding the default value nodes to the graph
-
Select
Settings > Toggle Advanced Mode from the ShaderFX menu bar to enable advanced mode. This mode provides a larger selection of nodes.
- Enter the group view, right-click the work area, and select
Graph Nodes > Code Control > Default Value to create a
Default Value node.
- Connect the nodes as follows:
- Connect the
RGB attribute of MyColor to the
Default attribute of
Default Value.
- Connect the
Alternate attribute of
Default Value to the group node. An
Alternate 0 port appears automatically.
- Connect the
Result attribute of
Default Value to the
Value attribute of
Multiply.
- (Optional) Create a second
Default Value node and connect it to MyMultiplier as follows:
- Connect the
float attribute of MyMultiplier to the
Default attribute of
Default Value.
- Connect the
Alternate attribute of
Default Value to the group node. An
Alternate 1 port appears automatically.
- Connect the
Result attribute of
Default Value to the
Value attribute of
Multiply.
Labeling the group node ports
- Select the group node. In the Attribute Editor, make sure that
Active socket 0 is selected, then add
Active socket label MyColor.
The first port of the group node is now renamed to MyColor 0.
- Repeat for the second port. Use
Active socket 1 with the
Active socket label MyMultiplier.
The second port of the group node is now renamed to MyMultiplier 1.
Supplying an alternate input value
- Exit the group view and create a
Color node (Hw Shader Nodes > Values > Color).
- Connect the
RGB attribute of the
Color node to the MyColor attribute of the group node.
- This alternate
Color node is used instead of the default value.
- (Optional) Repeat for the
Float multiplier. Create a
Float node (Hw Shader Nodes > Values > Float) and connect its
float attribute it to the MyMultiplier port of the group node.