Search Unity

New Shader Graph Node Reference Samples

November 15, 2023 in Engine & platform | 9 min. read
Hero image for “New Shader Graph Node Reference Samples”
Hero image for “New Shader Graph Node Reference Samples”
Share

Is this article helpful for you?

Thank you for your feedback!

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.

Examples of available samples

Let’s take a look at the Dot Product node:

The Dot Product Node Reference Asset

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.

The Dot Product Node Description

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.

The Math Performed by the Dot Product Node

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.

Example uses of the Dot Product Node

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.

DDX Node

The DDX Node Reference Asset

Normal Vector

The Normal Vector Node Reference Asset

Lerp Node

The Lerp Node Reference Asset

Normal Blend Node

The Normal Blend Node Reference Asset

Sample organization

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.

The Node Categories in the Create Node menu

After downloading the samples, you’ll see corresponding folders.

The matching categories in the Node Reference files

For example, the Dot Product node is found under the Math category, and the reference asset is found in the Math folder.

Finding the Dot Product Node’s sample asset in the Math folder

Benefits to new users

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.

  • Understand the math behind the nodes: Basic operations like Lerp, Dot Product, and Normalize are broken down into very basic math so it’s easier to understand what’s going on under the hood.
  • Show vs tell: Documentation describes what each node does, but these samples show what the nodes do visually and in context.
  • Provide inspiration: Each example can be used as a springboard for ideas and new ways of using Shader Graph.

Benefits to experienced 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:

  • Gain a clearer understanding of exactly what each node does.
  • Custom modifications: Copy and paste the “Under The Hood” portion of a sample into a subgraph to make your own version of Shader Graph node.
  • Use the samples as a springboard for creativity and inspiration.

How to install

Install the new sample assets using the Package Manager.

  1. In the Editor, open Package Manager.
The Window Menu showing the Package Manager option
  1. In the Package Manager window, select the Shader Graph package.
The Package Manager window with the Shader Graph package selected
  1. Select the Samples tab.
The details of the Shader Graph package in the Package Manager showing the button to Import the Node Reference Samples
  1. Finally, select the Node Reference Import button to bring the new Node Reference sample set into your project.

With these steps completed, the node reference assets will show up in your project under Assets/Samples/Shader Graph/<your version>/Node Reference.

The location of the Node Reference Samples in the Project window

Conclusion and future plans

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.

Additional resources

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.

November 15, 2023 in Engine & platform | 9 min. read

Is this article helpful for you?

Thank you for your feedback!

Related Posts