Intro to ShaderGraph - aefreedman/SP2018_IntermediateGameDev GitHub Wiki
Create your project
- Open Unity Hub
- Create a new project
- Select Unity 2018 beta
- Select Lightweight RP (Preview) template
- Disable Unity Analytics
- Go to Window > Lighting > Settings and disable Auto Generate for the lightmap
- Go to Window > Package Manager
- Click on
Render-pipelines.light
and update if an update is available - Click the All button and install the
Shadergraph
package
- Click on
- If the sample scene is still magenta, you need to update your
Render-pipelines.light
package (above) - Go to your Project window and create a new
PBR Graph
- Right Click > Create > Shader > PBR Graph
- If you don't see this option, install the
Shadergraph
package
- Double-click on your new
Graph
- If the sphere in your Graph window is magenta, you're using the wrong render pipeline or your render pipeline package is out of date (see above)
- You should see a single node called PBR Master and a grey sphere preview
Shadergraph basics
Unity's official documentation for Shadergraph is currently located on GitHub.
If you are looking at this outside of class, this Unity Forum post has multiple gifs covering basic graph creation.
The documentation covers everything in detail, but we will cover the following in class:
- Basic interface
- Nodes
- Node datatypes
- Dropdowns
- Preview
- Blackboard
- Zoom, Drag
- Nodes
- Connecting nodes
- Adding data to the Blackboard
- Creating common shader properties
- Color
- Textures & Normals
- Using multiple nodes to modify output
Using your Shadergraph shader
Using your Shadergraph shader is easy! Just create a new material and pick your shader from the graphs category.
Examples
Unity has a bunch of example projects for both 2D and 3D with examples of how to use Shadergraph to create interesting results.