Premium
ShaderGraph: Add Node
Tutorial
Beginner
10 Mins
Overview
Overview
You have completed 0% of this Tutorial.
1.
Creating the ShaderGraph
2.
Finishing the SampleGraph
Summary
Within the Shader Graph, there is a Add node that allows you to define a math node that adds two inputs together. You’ll find yourself using this node often as you start to build your own custom Shaders.
Topics we'll cover
Language
English
Recommended Unity Versions
2018.1
Tutorial
ShaderGraph: Add Node
1.
Creating the ShaderGraph
To begin, let's create a Shader to use as an example.
  • Right-click in your project and select Create > Shader > PBR Graph.
  • Name the new Shader “SampleGraph.”
  • In the new window that opens, right-click and select Create Node.
  • Type in “Add” and click the result that matches.
You will now have an Add node sitting in your graph (Figure 01).
This node is known as an operation node because it takes in several inputs and does a calculation resulting in a single output. This node in particular takes two inputs, adds them together and returns the sum.
Inputs:
  • A: First input value
  • B: Second input value
Outputs:
  • Out: The output of the sum of the two inputs.
Let’s make use of this Add node by adding two colors together to get a different color.
  • Create two Color nodes.
  • Change one of the Color nodes to green and the other to blue.
  • Drag the green Out pin to the A input of the Add node.
  • Drag the blue Out pin to the B input of the Add node.
  • The resulting color should be a cyan/teal. Drag the Add node’s Out pin and plug it into the Albedo of the PBR Master node.
This will connect our work to the final node of the Shader Graph to be rendered out. The PBR Master node comes with a small preview at the bottom to show you the final result of the Shader.

2.
Finishing the SampleGraph
To show your Shader, save your Asset:
  • In the top-left corner of your PBRGraph, click the Save Asset button (Figure 03).
  • Create a new Material in your Project window by right-clicking to select Create > Material.
  • In the Material window, select the Shader dropdown and find the Shader you created. (Figure 04).
  • Apply the Material to an object in your Scene (Figure 05).
The Add node can do more than just add two colors together. It’s possible to create a combination of effects as you begin diving into the development of your own Shader. Now that you understand the basics of what this node does, try adding Gradients, Transparency Masks, or Panning Textures with a Color overlay.