Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
877e552
update node thumbs thru constant
alindmanUnity May 13, 2020
c1192e9
update node thumbs through negate
alindmanUnity May 14, 2020
0c1c395
update more thumbs
alindmanUnity May 14, 2020
5637151
update last of the node thumbs
alindmanUnity May 18, 2020
6ed3475
rename main preview page
alindmanUnity May 21, 2020
3dfd632
initial docs update for master stacks
alindmanUnity May 21, 2020
dd51cd5
some more image updates
alindmanUnity May 21, 2020
7890122
Update Node-Library.md
alindmanUnity May 21, 2020
d915bfe
added initial docs and screenshots
sainarayan-cse May 20, 2020
16540fd
more work on docs
sainarayan-cse May 20, 2020
1f081ab
Finished docs work to update for Internal inspector
sainarayan-cse May 21, 2020
bb30bb3
Updated table of contents and internal inspector page
sainarayan-cse May 21, 2020
bf94c50
Finished internal inspector page
sainarayan-cse May 21, 2020
48c49ab
Minor updated to the getting started page
sainarayan-cse May 21, 2020
5592669
updatelog node image
alindmanUnity May 26, 2020
a5e4c08
update images with new inspector
alindmanUnity May 31, 2020
dc283a6
small docs updates for new inspector
alindmanUnity May 31, 2020
1cff02f
delete master node pages
alindmanUnity May 31, 2020
71c7565
add new stacks pages
alindmanUnity May 31, 2020
dfaf7d2
add new master stack images
alindmanUnity May 31, 2020
bf638de
add images to new docs pages
alindmanUnity May 31, 2020
629d1c7
last cleanup of docs
alindmanUnity May 31, 2020
f8df014
add upgrade guide
alindmanUnity Jun 3, 2020
878b95c
change upgrade guide version number in docs pages
alindmanUnity Jun 3, 2020
bed1252
rename upgrade guide file
alindmanUnity Jun 3, 2020
6a0a859
Merge branch 'sg/update-documentation' into 9.x.x/sg/update-documenta…
alindmanUnity Jun 3, 2020
6201457
Revert "rename upgrade guide file"
alindmanUnity Jun 5, 2020
6f3cd51
Revert "change upgrade guide version number in docs pages"
alindmanUnity Jun 5, 2020
6ba1542
minor docs edits
alindmanUnity Jun 12, 2020
4117e96
fix typo
alindmanUnity Jun 12, 2020
cd2ebc5
typo [Skip CI]
alindmanUnity Jun 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion com.unity.shadergraph/Documentation~/Blackboard.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Blackboard

## Description
The Blackboard lists [Properties](https://docs.unity3d.com/Manual/SL-Properties.html) and [Keywords](Keywords) available for use in the graph. Here, you can define a range of Property and Keyword types, and the corresponding names, attributes, and default values. You can also expose Properties and Keywords to Materials that use the shader.
The Blackboard lists [Properties](https://docs.unity3d.com/Manual/SL-Properties.html) and [Keywords](Keywords) available for use in the graph. Here, you can define a range of Property and Keyword types.

To change the path of a [Shader Graph Asset](Shader-Graph-Asset), click on its path field in the Blackboard, and enter the new path. The Unity Editor uses the Shader Graph path to list the corresponding Shader Graph Asset in the Material Inspector's **Shader** drop-down menu. Similarly, you can change the path field of a [Sub Graph](Sub-graph). The Editor uses the Sub Graph path to list the corresponding Sub Graph Asset in the [Create Node Menu](Create-Node-Menu).

Expand Down
34 changes: 34 additions & 0 deletions com.unity.shadergraph/Documentation~/Block-Node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Block Node

## Description

A Block is a specific type of Node for the Master Stack. A block represents a single piece of the fragment (or vertex) description data used in the final shader output. Some Block nodes are always available, while some may only be available with certain pipelines.

Certain blocks are only compatible with specific Graph Settings. Blocks may become Active or Inactive based on the graph settings.

Blocks cannot be cut, copied, or pasted.

## Adding and Removing Block Nodes

New Block nodes can be added to a Context in the Master Stack by hovering over empty space in the Context and pressing space bar or right clicking and selecting “Create Node”. This will bring up the Create Node menu.

This menu will contain only Block nodes valid for that context. Vertex blocks will not appear in the Create Node menu of the Fragment context.

Selecting a block node from this menu will add it to the context.
Comment thread
alindmanUnity marked this conversation as resolved.

Selecting a block node entry in the context and pressing “Delete” or right clicking and selecting “Delete” will remove the block from the context.

### Automatically Add or Remove Blocks

Blocks can also be added or removed from a context automatically based on the user’s Shader Graph Preferences. If `Automatically Add or Remove Blocks` is enabled, the required Block nodes for a certain Target or Material type will be added automatically. Any incompatible block nodes that have no connections and default values will be removed from the context automatically.

If `Automatically Add or Remove Blocks` is disabled, no block nodes will ever be automatically added or removed. All required Block nodes must be added manually by the user based on the selected target and material settings.

## Active and Inactive Blocks

Active block nodes are blocks that are being generated and contributing to the final shader.
Inactive block nodes are blocks that are present in the shader graph, but are not being generated or contributing to the final shader.

![image](images/Active-Inactive-Blocks.png)

Certain configurations of the graph settings may cause blocks to become active or inactive. This state will be displayed by greying-out the block nodes that are inactive, as well as any node stream that is _only_ connected to the inactive block node.
23 changes: 23 additions & 0 deletions com.unity.shadergraph/Documentation~/Built-In-Blocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Built In Blocks

## Vertex Blocks
| | Name | Type | Binding | Description |
|:-----------|:----------------|:---------|:----------------------|:------------|
| ![image](images/Blocks-Vertex-Position.png) | Position | Vector 3 | Object Space Position | Defines the absolute object space vertex position per vertex.|
| ![image](images/Blocks-Vertex-Normal.png) | Normal | Vector 3 | Object Space Normal | Defines the absolute object space vertex normal per vertex.|
| ![image](images/Blocks-Vertex-Tangent.png) | Tangent | Vector 3 | Object Space Tangent | Defines the absolute object space vertex tangent per vertex.|

## Fragment Blocks
| | Name | Type | Binding | Description |
|:-----------|:---------|:---------|:---------------------|:------------|
| ![image](images/Blocks-Fragment-Base-Color.png) | Base Color | Vector 3 | None | Defines material's base color value. Expected range 0 - 1. |
| ![image](images/Blocks-Fragment-NormalTS.png) | Normal (Tangent Space) | Vector 3 | Tangent Space Normal | Defines material's normal value in tangent space. |
| ![image](images/Blocks-Fragment-NormalOS.png) | Normal (Object Space) | Vector 3| Object Space Normal | Defines material's normal value in object space. |
| ![image](images/Blocks-Fragment-NormalWS.png) | Normal (World Space) | Vector 3 | World Space Normal | Defines material's normal value in world space. |
| ![image](images/Blocks-Fragment-Emission.png) | Emission | Vector 3 | None | Defines material's emission color value. Expects positive values. |
| ![image](images/Blocks-Fragment-Metallic.png) | Metallic | Vector 1 | None | Defines material's metallic value where 0 is non-metallic and 1 is metallic. |
| ![image](images/Blocks-Fragment-Specular.png) | Specular | Vector 3 | None | Defines material's specular color value. Expected range 0 - 1. |
| ![image](images/Blocks-Fragment-Smoothness.png) | Smoothness | Vector 1 | None | Defines material's smoothness value. Expected range 0 - 1. |
| ![image](images/Blocks-Fragment-Ambient-Occlusion.png) | Ambient Occlusion | Vector 1 | None | Defines material's ambient occlusion value. Expected range 0 - 1. |
| ![image](images/Blocks-Fragment-Alpha.png) | Alpha | Vector 1 | None | Defines material's alpha value. Used for transparency and/or alpha clip. Expected range 0 - 1. |
| ![image](images/Blocks-Fragment-Alpha-Clip-Threshold.png) | Alpha Clip Threshold | Vector 1 | None | Fragments with an alpha below this value will be discarded. Expected range 0 - 1. |
7 changes: 6 additions & 1 deletion com.unity.shadergraph/Documentation~/Create-Node-Menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ To add a node to the workspace, double-click it in the **Create Node Menu**.

A contextual **Create Node Menu** filters the available nodes, and only shows those that use the [Data Type](Data-Types.md) of a selected edge. It lists every available [Port](Port.md) on nodes that match that Data Type.

To open a contextual **Create Node Menu**, click and drag an [Edge](Edge.md) from a Port, and then release it in an empty area of the workspace.
To open a contextual **Create Node Menu**, click and drag an [Edge](Edge.md) from a Port, and then release it in an empty area of the workspace.

### Master Stack Create Node Menu
To add a new [Block Node]() to the [Master Stack](), either right click and select **Create Node** or press spacebar with the stack selected.

The **Create Node Menu** will display all available blocks for the master stack based on the render pipelines in your project. Any block can be added to the master stack via the **Create Node Menu**. If the block added is not compatible with the current Graph settings, the block will be disabled until the settings are configured to support it.
42 changes: 25 additions & 17 deletions com.unity.shadergraph/Documentation~/Create-Shader-Graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,38 @@

After you configure an SRP, you can create a new Shader Graph Asset. Right-click the Project window, locate **Create** > **Shader** in the context menu, then select your desired type of Shader Graph.

Unity currently supports the following graph types:
- PBR Graph
- Sub Graph
- Unlit Graph

If you're using HDRP in your project, the following HDRP-specific graph types are also available:
- Decal Graph
- Fabric Graph
- Hair Graph
- Lit Graph
- StackLit Graph
- Unlit Graph
The type of Shader Graph available is dependent on the render pipelines present in your project. Some options may or may not be present based on the render pipelines.

The following options are always available:

| | |
|:------------|:----------------|:------------|
| Blank Shader Graph | A completely blank shader graph. No target is selected and no blocks are added to the Master Stack. |
| Sub Graph | A blank sub graph asset. |

A sub menu for each installed render pipeline may be present containing template stacks for standard shading models ( Lit, Unlit, etc ).

For a full list of provided options, see the [Universal Render Pipeline]() and [High Definition Render Pipeline]() documentation.

For this example, Universal is installed so a Unversal Lit Shader Graph has been created.

Double-click your newly created Shader Graph Asset to open it in the Shader Graph window.

## Shader Graph window

The Shader Graph window consists of the Master Node, the Preview Window, and the Blackboard.
The Shader Graph window consists of the Master Stack, the Preview Window, the Blackboard, and the Graph Inspector.

![](images/ShaderGraphWindow.png)

### Master node
### Master Stack

The final connection that determines your shader output. See [Master Node](Master-Node) for more information.
The final connection that determines your shader output. See [Master Stack]() for more information.

![](images/MasterNode.png)
![]()

### Preview window

An area to preview the current shader output. Here, you can rotate the object, and zoom in and out. You can also change the basic mesh on which the shader is previewed. See [Master Preview](Master-Preview) for more information.
An area to preview the current shader output. Here, you can rotate the object, and zoom in and out. You can also change the basic mesh on which the shader is previewed. See [Main Preview](Master-Preview) for more information.

![img](images/MainPreview.png)

Expand All @@ -43,3 +45,9 @@ An area that contains all of the shader's properties in a single, collected view

After you've set up a project, and become familiar with the Shader Graph window, see [My first Shader Graph](First-Shader-Graph) for more information on how to get started.

### Internal Inspector

An area that contains information contextual to whatever the user is currently clicking on. It's a window that automatically is hidden by default and only appears when something is selected that can be edited by the user. Use the Internal Inspector to display and modify properties, node options, and the graph settings. See [Internal Inspector](Internal-Inspector.md) for more information.

![](images/Inspector.png)

4 changes: 2 additions & 2 deletions com.unity.shadergraph/Documentation~/Custom-Function-Node.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Custom Function node lets you inject your own custom HLSL code in Shader Gra
## How to Use
Use the [Create Node Menu](Create-Node-Menu.md) to create Custom Function nodes. By default, new Custom Function nodes don't have any input or output ports.

Use the gear icon in the top right corner of the node to open the [Custom Port Menu](Custom-Port-Menu.md) and Custom Function Menu.
Use the **Node Setttings** of the [Graph Inspector]() to open the [Custom Port Menu](Custom-Port-Menu.md) and the Custom Function menu.

![02](images/Custom-Function-Node-File.png) ![03](images/Custom-Function-Node-String.png)

Expand Down Expand Up @@ -61,4 +61,4 @@ The Custom Function node, on its own, is a single node instance. If you wish to

![11](images/Custom-Function-Node-Subgraph.png)

Create your custom function either directly in a Sub Graph, or right-click the existing Custom Function node and select `Convert to Sub Graph`. Add the appropriate input and output ports using the [Blackboard](Blackboard.md) and [Custom Port Menu](Custom-Port-Menu.md). After this, you can reuse your custom function as many times as needed, even within other Sub Graphs.
Create your custom function either directly in a Sub Graph, or right-click the existing Custom Function node and select `Convert to Sub Graph`. Add the appropriate input and output ports using the [Graph Inspector](Internal-Inspector.md) and [Custom Port Menu](Custom-Port-Menu.md). After this, you can reuse your custom function as many times as needed, even within other Sub Graphs.
4 changes: 2 additions & 2 deletions com.unity.shadergraph/Documentation~/Custom-Port-Menu.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Custom Port Menu

## Description
The Custom [Port](Port.md) Menu is available on the [Custom Function Node](Custom-Function-Node.md) and [Sub Graph](Sub-graph.md) output node. This menu allows you to add, remove, rename, reorder, and define the types of your custom input and output ports.
The Custom [Port](Port.md) Menu is displayed in the **Node Settings** tab of the [Graph Inspector](Internal-Inspector) by clicking on the [Custom Function Node](Custom-Function-Node.md) and [Sub Graph](Sub-graph.md) output node. This menu allows you to add, remove, rename, reorder, and define the types of your custom input and output ports.

## How to Use
Click the gear icon on the top right corner of the node to open the Custom Port Menu on top of the node. To close the menu, click the gear icon again. Using the gear icon to open the menu automatically deselects any current selections, and selects the current node attached to the menu.
Select the [Custom Function Node](Custom-Function-Node.md) or the [Sub Graph](Sub-graph.md) output node to view the Custom Port Menu in the Inspector. To close the menu, click anywhere in the graph or on another graph-element.

![01](images/Custom-Port-Menu-Empty.png)

Expand Down
21 changes: 16 additions & 5 deletions com.unity.shadergraph/Documentation~/First-Shader-Graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Before you begin, make sure that your project is set up properly, and the graphs are loading correctly. See [Getting started with Shader Graph](Getting-Started) for more information.

## Create a New Graph
Use the Project Browser to create a new [Shader Graph Asset](Shader-Graph-Asset.md) in your project. The **Create > Shaders** will display the various creation options.

A **Blank Shader Graph** will create a Shader Graph with no selected active [targets]() or [block nodes](Block-Node). You will need to select a target via the [Graph Settings Menu](Graph-Settings-Menu.md) to continue.

Certain integrations, like Render Pipelines, can also provide pre-configured options for Shader Graphs. For this example, a **Universal > Lit** Shader Graph has been created and opened.

## Create a new node

Use the **Create Node** menu to create new nodes. There are two ways to open the menu:
Expand All @@ -17,7 +24,7 @@ In the menu, you can type in the search bar to look for specific nodes, or brows

To build a graph, you need to connect nodes together. To do so, click the **Output Slot** of a node, and drag that connection into the **Input Slot** of another node.

Start by connecting the Color node to the **Albedo** slot of our master node.
Start by connecting the Color node to the **Base Color** [block]() of our [Fragment Stack]().

![](images/MyFirstShaderGraph_02.png)

Expand Down Expand Up @@ -60,18 +67,20 @@ To create a new property, use the **Add (+)** button on the top right corner of

![](images/MyFirstShaderGraph_07.png)

This adds a new property in the Blackboard with the following options.
This adds a new property in the Blackboard with the following options in the **Node Settings** tab of the [Graph Inspector]() when the property is selected.

![](images/MyFirstShaderGraph_08.png)

| **Option** | **Description** |
| ------------------- | ------------------------------------------------------------ |
| **Property button** | To change the name of the property, right-click the button, select **Rename**, then enter a new property name. To delete the property, right-click the button, and select **Delete**. |
| **Property button** | To change the name of the property, right-click the button in the Blackboard, select **Rename**, then enter a new property name. To delete the property, right-click the button, and select **Delete**. |
| **Exposed** | Enable this checkbox to make the property visible from the Material's Inspector. |
| **Reference** | The property's name that appears in C# scripts. To change the **Reference** name, enter a new string. |
| **Default** | The default value of the property. |
| **Mode** | The mode of the property. Each property has different modes. For **Color**, you can select either **Default** or **HDR**. |
| **Precision** | The default [precision](Precision-Modes) of the property. |
| **Precision** | The default [precision](Precision-Modes) of the property. |
| **Hybrid Instanced**| An experimental feature that enables this property to be instanced when using the Hybrid DOTS renderer. |


There are two ways to reference a property in your graph:

Expand All @@ -80,7 +89,7 @@ There are two ways to reference a property in your graph:

![](images/MyFirstShaderGraph_09.png)

Try connecting the property to the **Albedo** output slot. The object immediately changes to black.
Try connecting the property to the **Base Color** block. The object immediately changes to black.

![](images/MyFirstShaderGraph_10.png)

Expand All @@ -90,6 +99,8 @@ Save your graph, and return to the Material's Inspector. The property now appear

## More Tutorials

Older tutorials use an outdated format of Shader Graph with master nodes. When looking at older tutorials, reference the [Upgrade Guide]() for tips on how to convert the master node to a [Master Stack]().

To keep exploring how to use Shader Graph to author shaders, check out these blog posts:

- [Art That Moves: Creating Animated Materials with Shader Graph](https://blogs.unity3d.com/2018/10/05/art-that-moves-creating-animated-materials-with-shader-graph/)
Expand Down
18 changes: 18 additions & 0 deletions com.unity.shadergraph/Documentation~/Graph-Settings-Menu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Graph Settings Menu

## Description

Use the **Graph Settings** tab on [Graph Inspector](Internal-Inspector) to change settings that affect the Shader Graph as a whole. To open the **Graph Settings Menu**, click the **Graph Settings** tab of the Graph Inspector. If you do not see the Graph Inspector, press the **Graph Inspector** button on the [Shader Graph Title Bar](Shader-Graph-Window.md) to open it.

![](images/GraphSettings_Menu.png)

### Graph Settings Menu

| Menu Item | Description |
|:----------|:------------|
| Precision | A [Precision Types](Precision-Types.md) dropdown that sets the precision for the entire graph. |
| Targets | A drop down with the available [Targets](Graph-Target) to select for the graph. By default, Nothing and Everything will be available. |
| Reorder data | A reorderable list of the selected targets. Changes the order in which the final data appears in the generated shader file.|


Below the standard Settings Options, target-specific settings are displayed. These are dependent on the selected target.
11 changes: 11 additions & 0 deletions com.unity.shadergraph/Documentation~/Graph-Target.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Graph Target

A Target determines the end point compatibility of the generated shader from a Shader Graph. Targets are selected for each Shader Graph asset. Targets can be changed via the [Graph Settings Menu](Graph-Settings-Menu).

![image](images/GraphSettings_Menu.png)

The Target holds information regarding the required generation format and variables for compatibility with different render pipelines or integration features like Visual Effects Graph. You can select as many or as few active targets as desired for each Shader Graph asset. Some targets or nodes on the graph may not be compatible with other selected targets, in which case an error with an explanation will display.

Target Settings are specified by the selected target. Universal Target Settings and High Definition Target Settings may change.

Typically, each target selected will generate a valid subshader from the graph. For example, a Shader Graph with both Universal and High Definition render pipelines selected will generate two subshaders.
Loading