Shader Graph in Unity for Beginners

Learn how to create your first shader with Unity’s Shader Graph. By Wilmer Lin.

Leave a rating/review
Download materials
Save for later
Share
You are currently viewing page 4 of 4 of this article. Click here to view the first page.

Adding Glow Size and Glow Color properties

Now you’re going to expose other types of properties on the Blackboard as well. For example, it would be useful to allow the user to adjust the Fresnel Effect Power value.

Click the + icon in the Blackboard and create a Vector1 property. This represents a single float parameter.

Rename it GlowSize.

You can limit what values can be entered in this property by converting it to a slider. Switch the Mode to Slider, then set a Min of 0.05 and a Max of 6 to define the range. Set the Default value to 5.

Glow Size Property

Drag the GlowSize property into the workspace area. Plug the output port into the Fresnel Effect Power input.

Finally, allow the user to set the glow color through a property as well. Instead of creating the property from the Blackboard, you’ll convert an existing node in your graph.

Glow Color Property

Select the Color node, then right-click and select Convert to Property.

The Color node converts into a color property on the Blackboard that is no longer editable directly in the graph. Rename this property to GlowColor.

Final Shader Graph

Click Save Asset, and return to the main Editor window.

Material Preview

Select the Glow_Mat material in the Project window. You should see a GlowSize slider and a GlowColor color chip available in the Inspector.

Material Preview

Edit your material values to your liking. Finally, enter Play mode to test your work.

Final Game

You now have a customizable highlight that you can tweak to your heart’s content!

Where to Go From Here

Congratulations! You can now create your very own shaders with Shader Graph!

With some creativity, you might surprise yourself with what else you can create. Want to make a cool, sci-fi laser beam or forcefield? You could adapt what you’ve done here into just the right shader.

Though there are literally hundreds of nodes to explore, this tutorial should have helped you to get started using Shader Graph.

If you have an questions or comments, please join the forum discussion below.