Archived thread: please continue discussion here: Unity Engine - Unity Discussions
With Unity 2018.1, the graphics team is bringing you all new levels of control and flexibility. Whether you’re a beginner or a pro, we’re empowering you to create amazing projects that look fantastic!
One of the coolest features coming in 2018.1 is Shader Graph. Freeing you to create a range of shaders; flowing lava, gooey slime mound, beautiful lakes, flashing LEDs, and more!
Designed to work with the Scriptable Render Pipeline (SRP) out of the box, with support for:
- The HD Render Pipeline (Coming soon)
- The Lightweight Render Pipeline
- And the ability to extend the system to export shaders for any custom SRP you write
What is a Shader Graph?
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:
- Procedurally alter your surface appearance
- Warp and animate UVs
- Modify the look of your objects using familiar image adjustment operations
- Change your object’s surface based on useful information about it, its world location, normals, distance from camera, etc.
- Expose to the material inspector what you think is important to edit for your shader
- Share node networks between multiple graphs and users by creating subgraphs
- Create your own custom shader graph nodes through C# and HLSL
The graph framework gives instant feedback on the changes, and it’s simple enough that new users can become involved in shader creation.
How do you create Shader Graphs?
In Unity 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 create material to create a new material you can use on any object in your game. You can create multiple materials from the same shader.
You can expose parameters in your shader so they can be overwritten in each material you create from your shader. This is easy. In the shader graph right click on any variable node and select ‘Convert to property node’. These exposed parameters appear in the material inspector for each material you create from your shader.
To see your new shader graph changes affect your in game materials click the save button.
How do I get access to the Shader Graph?
In the next iterations of the beta, we will integrate these elements in a friendly user workflow for creating and using projects. But if you can’t wait to try them out, we made a simple sample that uses SRP, built on the Lightweight pipeline, and also includes the Shader Graph tool.
To get started, download the sample project, open it with Unity 2018.1 beta, and start exploring!
What are the requirements to try this out?
This is a feature for the new scriptable render pipeline, available in 2018.1. It will not work out of the box without a SRP.
We won’t be supporting this feature for the legacy renderer.
I want more tutorials!
More will be coming (including more examples!) over the coming months. We have an end to end shader creation video here as a starter point.
I have questions!
Excellent! We are happy to answer them. Please reply to this thread and we will try to help you out.
What is the current status?
We’re targeting shipping the Shader Graph for 2018.1. In the future it will be included in your project automatically when using an SRP. This is the first version of the Shader Graph and there are already future updates planned. Give the current iteration a spin and send us your feedback and info on any issues you run into. We want your help to make this feature as amazing as possible and are excited to be able to add awesome updates for future Unity releases based on the ideas you send us. We are so excited to be introducing this feature! (It is about time :))!
Give it a try and write your thoughts in this thread.