Modular Material Design

Untangling the Creative Spaghetti

We’re looking at how to build material node graphs in a way that is clear to read, easy for artists to use, and easy to update across teams, cleaning up the creative spaghetti that often occurs. We’ll outline a few strategies in Unreal Engine’s Material Graph Editor and the Amplify Shader Editor plugin for Unity.

before
after

1. Use ‘Local Variables’

…a local variable is a variable that is given local scope.

Wikipedia

Material node graphs currently don’t offer much beyond direct parameter references. There are no outside ‘global’ references, so any ‘variable’ we declare in a node graph can only be local by the nature of the graph’s design. Technically speaking, the Unreal Engine’s Material Editor does not have local variable declarations, but rather a Named Reroute Node that can act as a variable although it simply hides the connecting node lines. And while the Unity Engine’s Shader Graph doesn’t have an equivalent, the Amplify Shader Editor (ASE) does utilize actual variable declarations, making it a powerful tool for advanced shader development.
So let’s look at how they can help clean up our graphs.

UE: Named Reroute Nodes

The most powerful tool to breaking up the node spaghetti – the Named Reroute Node.

Use them like Local Variables. Immediately offloading Parameter (and Function) Inputs to Named Reroute Nodes allows you to cleanly separate and block off an organized chunk of nodes. this makes it easier to layout the order of inputs for the Editor UI.

Adding a variable type prefix to your names will help you manage what kinds of variables you’re trying to match up further along your node graph. And it makes it easier to find when you search for them in the popup menu,

Being able to separate out blocks of your parameter inputs will make it much easier to edit your parameter categories and the Editor UI too.

Unity doesn’t have an equivalent in their Shader Graph, but the Amplify Shader Editor (ASE) plugin does, and with a more appropriate name.

ASE: Register Local Var