The Shader Graph team is excited to announce the release of the new Node Reference Samples, available now for 2021 LTS, 2022 LTS, and future releases.
Node Reference Samples is a collection of over 140 Shader Graph assets. Instead of using these graphs for materials in your project, you can use them as a reference to learn what each node does and how it works. Each graph represents a node that’s available in the node library. It also contains a description of the node, explains its functionality, and breaks down how the math works under the hood. To learn how to use a specific node, open its reference file to see descriptions, examples, and breakdowns of that node.
In the samples below, we’re using the Shader Graph tool to illustrate how you can use Node Reference Samples in your next project.
Let’s take a look at the Dot Product node:
There’s a lot going on here, so let’s break it down. At the top of the graph, we have the node and a basic description of what the dot product operation does.
On the left, we have the Under The Hood section, which breaks down the dot product operation into more basic math so you can see exactly what’s happening when you use the Dot Product node. Notice that there are helpful tips and descriptions of what’s happening and why.
This section shows you what you can do with the Dot Product node. We can see the node can be used to desaturate a color or as a handy method for texture channel selection and that the dot product is used as the basis for diffuse lighting calculations.
This is just one example. We’ve created over 140 similar graphs representing a large majority of the nodes available in Shader Graph, each containing descriptions, examples, illustrations, and helpful tips.
The sample assets are organized by category, just like in the node library. In Shader Graph, press the spacebar to summon the Create Node menu. From there, you’ll see the node categories available to add to your graph.
After downloading the samples, you’ll see corresponding folders.
For example, the Dot Product node is found under the Math category, and the reference asset is found in the Math folder.
We understand that for new users, Shader Graph can have a steep learning curve. The tool has hundreds of nodes and requires an understanding of their underlying math principles, plus some graphics knowledge. These new samples offer several benefits for new users.
Experienced users will gain a deeper understanding of specific nodes’ operations. They may need to know things like if the node’s output is normalized or saturated, and they may want to modify the operation of nodes to create their own variations. These new samples will benefit experienced users in the following ways:
Install the new sample assets using the Package Manager.
With these steps completed, the node reference assets will show up in your project under Assets/Samples/Shader Graph/<your version>/Node Reference.
This is a very deep and rich sample set. We hope you have fun exploring it and use it to learn more about how the nodes in Shader Graph work. We’d love to hear your thoughts and impressions on these samples. Feel free to tell us what you think in the Shader Graph forum.
This Node Reference sample set is just the first in a series. Over the next year or so, we’ll be releasing additional sample sets, each spaced a few months apart. These will help you learn Shader Graph more quickly, understand how to set up specific functionality, and create new shaders faster with premade subgraphs and templates. We hope you’ll enjoy using these new samples.
Looking for more on node samples? Connect with us in the forums in this dedicated thread. For more news on Editor advancements, stay tuned to Unite 2023 for announcements, and watch for new technical blogs from other Unity developers as part of the ongoing Tech from the Trenches series.