Search Unity

Introduction to Shader Graph: Build your shaders with a visual editor

, Февраль 27, 2018

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:

  • 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 Properties to the Material Inspector, so that you can quickly tweak a shader’s visuals in the context of a scene.
  • 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.

The Shader Graph is now available in beta! To get started, download the sample project, open it with Unity 2018.1 beta, and start exploring. You can also get Shader Graph via the Package Manager.

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:

  • The High-Definition Render Pipeline
  • The Lightweight Render Pipeline.

You will also be able to extend the system to export shaders for any custom SRP you write.

How do you create Shader Graphs?

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.

I want more tutorials!

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!

I have questions!

Excellent! We are happy to answer them. Please come talk to us on this forum thread, and we will help you out there.

Добавить комментарий

Вы можете использовать эти теги и атрибуты HTML: <a href=""> <b> <code> <pre>

  1. Correction. It works with sprites. You need to use AlphaClipThreshold.

  2. Will Shader Graph allow you to create shaders for sprites? The current beta doesn’t allow it, it seems.

    1. I was wrong. It can be used to create shader sprites.

  3. The Unity 2018.1 Beta 13 doesn’t have Shader Graph. Why?

    1. You have to install it along with the Lightweight Render Pipeline from the package manager.

  4. when is unity 2018 coming out its April

  5. Unity, please allow users to create and use Unreal asset at runtime.

    1. Sorry, I meant Unity assets at runtime. It would be really unreal and epic to have such a feature :).

  6. I love the new concepts introduced, but I can’t help but worry that this new split is going to create problems to the platform flexibility of Unity. It sounds like publishing everywhere from a single source won’t be the case anymore.

    At the same time, something that may or may not be Unity’s decision, the lack of native support for Substance sounds like a mistake. Many if not most modern High End projects depend heavily on Substance and the lack of a way to use these materials before the new release goes public is problematic for those starting a new project today with the latest Unity.

    Lack of concrete plans from Alegorithmic for the release of the new plugin for Unity and lack of information about how much production ready this will be, may push a lot of those people who had started thinking of giving Unity a try now that the HD pipeline was announced, to go with Unreal instead.

  7. I’m a 13 year old artist and want to get into making 3 dimensional video games. I want to know what software I can use to make the models and animate them. And (if possible) be able to have a good game people would want to play.

    1. you should start with «BLENDER» to make and animate models. its free to use.

  8. Can we already develop shader which deform vertex, like waves and other deformations?

  9. i love this app its…the best

  10. Hello Unity.
    Just want to ask — why do you just don’t buy Amplify Shader Editor instead of developing your own bicycle like Shader Graph?
    Peace.

  11. I want to share a short blog about my Experiments with Shader Graph. In my blog, I’ve drescribed step by step to set up Shader Graph and also include 2 graph version of my shader which may be useful for you guys.
    https://killertee.wordpress.com/2018/02/28/experiments-with-unity-shader-graph-and-scriptable-render-pipeline/

  12. Hi! Just wanted to share a compilation made of the readily available Shader Graphs, and I added a couple of my own:
    https://github.com/RubenCUR/ShaderGraph-Examples

  13. «Therefore, you can’t use it with the Built-In Unity Renderer»

    I guess there are sound reasons for this decision, but Shader Graph not working with Built-In Unity Renderer sounds like strange design decision. I don’t know much about scriptable render pipeline yet, but I guess many users will still be using Built-In Renderer…

  14. The HD pipeline doesn’t support the shader graph? When I install it I cannot find shader graph under create menu like I do in the lightweight

    1. At least in 0b12 it does. But the editor is a bit slow compared to creating a classic material or an HD pipeline material. Feels similar to how Unreal material editor is where for every change you need to wait a couple of seconds until the shader is built. It is in early stages yet so I suppose it will be optimized in the future.

  15. This is such great news! Really looking forward to it!

  16. Very cool new feature! Nodes and all the settings saving possibilities make working with Shaders and Materials very easy. Thanks a lot!

  17. That’s great! Native shader editor is one of the most desired feature in Unity 2018. Thank you!

  18. I’ve been using Shader Forge for years. It’s really great and easy to use and all but even its creator admits that the shaders it generates are not the most optimized, especially if they are going to be used on lower end hardware. Is this likely to be an issue with the Unity Shader Graph shaders as well?

  19. Awesome to see Tim! Didn’t you write the Strumpy Shader Editor back in the day? I’m glad to see you’re talents are being used in this area again. :)

  20. este modo sera compatible con los shaders de blender ?

  21. I am using beta 8, but i cannot get the shader graph via the package manager… should i download the sample project first, or this is not related ?

  22. Great! Particularly like: «Create your own custom shader graph nodes through C# and HLSL»

    Is that node graph zoomable?
    Might be useful to have a standard node graph for editor scripts to use for other things — a node graph GUI system.

    1. Yes, it is zoomable!

  23. Amazing! Please add surface shader style abstraction if possible?