Unity 2018.1 brings new levels of control and flexibility. One of the coolest features coming in 2018.1 is Shader Graph. Whether you’re a beginner or a pro, it helps you create a range of shaders; flowing lava, gooey slime mound, beautiful lakes, flashing LEDs, and more!
A Shader Graph enables you to build your shaders visually. Instead of hand writing code you create and connect nodes in a graph network. You can do things like:
The graph framework gives instant feedback on the changes, and it’s simple enough that new users can become involved in shader creation.
Shader Graph is designed to work with another Unity 2018.1 feature: Scriptable Render Pipeline (SRP). Therefore, you can’t use it with the Built-In Unity Renderer. It will come with support for:
You will also be able to extend the system to export shaders for any custom SRP you write.
In Unity 2018.1, a Shader Graph appears as a normal shader. To create a Shader Graph you click the Create menu, and select ‘Shader Graph’ from the dropdown. This will create a Shader Graph asset in the project. You can double click on the asset or select the Open Graph button to bring up the Shader Graph Edit window.
When you open the Shader Graph you start with the ‘Master Node’. You connect nodes into the Master Node to create the look of your surface. To learn more about the underlying material models check out the existing Unity Standard Shader documentation.
You can quickly edit your surface by changing the default values! But, you know what’s even more exciting? Adding textures and other complex interactions. To add a node simply right click and select ‘Create Node’.
Each included Shader Graph node has a number of inputs, we’ve included default values that you can customize however you like.
Adding in a texture (or other assets) is also really easy, just create a node of that asset type and connect it!
Your Shader Graph shader is just like a normal shader in Unity. Right click on any object in the Inspector and choose Create Material. You can create multiple materials from the same shader.
You can easily expose parameters in your shader so they can be overwritten in each material you create from your shader. In the Shader Graph, right lick on any variable node and select ‘Convert to Property’. These exposed parameters appear in the material inspector for each material you create from your shader.
We're hosting a live training session on the Shader Graph on March 7! Register for it on our Events page and follow our Twitter and YouTube for a recording of the session. If you’re going to GDC, you can look forward to a number of Shader Graph related talks, sign up here for updates.
We also highly recommend that you check out and learn from Andy Touch’s Shader Graph Example Library on GitHub!