# Shader Graph Integration

Advanced Dissolve effect cannot be created inside Unity's Shade Graph using just one or several nodes, however it can be integrated into HSLS shader file generated from the Shader Graph.&#x20;

{% hint style="info" %}
Steps describe below are valid for Unity 2020.3 and later versions.&#x20;

In the case of using Unity 2019.4, check [Unity 2019.4](https://amazing-assets.gitbook.io/advanced-dissolve/shader-graph-integration/unity-2019.4) subpage below.
{% endhint %}

{% hint style="info" %}
Shader Graph for Built-in render pipeline requires Unity 2021.3 or later version.
{% endhint %}

Here are all required steps for integrating dissolve effect inside ***.shadergraph*** file:

1. Inside Graph Settings of the selected ***.shadergraph*** make sure **Alpha Clip** checkbox is active. This will add **Alpha Clip Threshold** field to the master node:

<div align="left"><figure><img src="https://371873058-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDmmEjlCGzGOqRX7UsP6L%2Fuploads%2FDXFwylqnjJylntSqdiXW%2FShaderGraph_Alpha_Clip_Enabled.png?alt=media&#x26;token=6f54f41d-a9d4-48fe-b900-1a1cf3fd5e5a" alt="" width="273"><figcaption></figcaption></figure></div>

2. Add **Advanced Dissolve** node and connect its output to the **Alpha Clip Threshold** field:

<div align="left"><figure><img src="https://371873058-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDmmEjlCGzGOqRX7UsP6L%2Fuploads%2FVwXa1GNDWUx6ePmN2PIZ%2FShaderGraph_Advanced_Dissolve_Node.png?alt=media&#x26;token=ed9f16c6-a9c7-4c7f-b6ff-57e1c2b71ed0" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
**Advanced Dissolve** node is available from the create node context menu: **Amazing Assets** -> **Advanced Dissolve**.
{% endhint %}

Advanced Dissolve node itself does nothing here. Its output value is always 0. This node serves as a "*marker"* for the HLSL shader generator.

3. When shader is ready and Advanced Dissolve node has been added, save it.
4. Now select ***.shadergraph*** file inside Project window and from the context menu choose <mark style="color:blue;">**Amazing Assets**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">-></mark> <mark style="color:blue;"></mark><mark style="color:blue;">**Advanced Dissolve**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">-></mark> <mark style="color:blue;"></mark><mark style="color:blue;">**Generate Shader**</mark><mark style="color:blue;">:</mark>

<div align="left"><figure><img src="https://371873058-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDmmEjlCGzGOqRX7UsP6L%2Fuploads%2FeIRBkYXaR89pCNWccyEe%2Fmenu_generate.png?alt=media&#x26;token=f7631079-6120-4b27-b19c-ed7990f8ef96" alt=""><figcaption></figcaption></figure></div>

This will generate HLSL shader, exactly the same as the ***.shadergraph*** file, but with integrated Advanced Dissolve features. Shader is ready to be used in materials.

Keep original ***.shaderGraph*** file and if in the future some changes are required, just repeat steps 3 - 4.

{% hint style="danger" %}
Note, generated ***.shader*** file will have the same name as the source ***.shaderGraph*** file. If folder already contains file with such name, it will be overwritten.&#x20;
{% endhint %}

{% hint style="info" %}
**Generate Shader** context menu supports multiple  ***.shaderGraph*** files selection, in the case of updating/generating multiple shader files at once.&#x20;
{% endhint %}
