# Quick Start Tutorials

This chapter demonstrates usage of the **Dynamic Radial Masks** asset using simple step-by-step guides that are described as easy as possible to give an overall overview of the asset and how it works.

{% hint style="info" %}
Tutorial chapters below demonstrate DRM usage using **Shader Graph**.&#x20;

For [**Amplify Shader Editor**](https://assetstore.unity.com/packages/tools/visual-scripting/amplify-shader-editor-68570?aid=1011lvgVb) integration steps are exactly the same.&#x20;

Instructions for integrating DRM into hand-written shaders are described in the [Hand-written HLSL](https://amazing-assets.gitbook.io/dynamic-radial-masks/broken-reference) chapter.
{% endhint %}

{% hint style="success" %}
Package included example scenes demonstrating various features of the DRM asset are provided in the [Example Scenes](https://amazing-assets.gitbook.io/dynamic-radial-masks/example-scenes) chapter.&#x20;
{% endhint %}

{% stepper %}
{% step %}
Create a new empty scene.
{% endstep %}

{% step %}
Add Plane mesh to the scene.
{% endstep %}

{% step %}
Create a new **Shader Graph** file.
{% endstep %}

{% step %}
Create new material using this shader and assign it to the Plane mesh.
{% endstep %}
{% endstepper %}

Now it is time for integrating **DRM** into this new shader:

{% stepper %}
{% step %}
Open **Dynamic Radial Masks** editor window from the <mark style="color:blue;">**Unity Main Toolbar**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">→</mark> <mark style="color:blue;"></mark><mark style="color:blue;">**Window**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">→</mark> <mark style="color:blue;"></mark><mark style="color:blue;">**Amazing Assets**</mark> menu and make sure its settings are the same as on the image below:
{% endstep %}

{% step %}

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2Fvml7Fc5LwosFHlfy3H0r%2F1.png?alt=media&#x26;token=da9baba1-7f6c-4eed-9016-51e7de645c76" alt="" width="344"><figcaption></figcaption></figure>

{% hint style="info" %}
Editor window settings are described in [DRM Settings](https://amazing-assets.gitbook.io/dynamic-radial-masks/drm-settings-and-editor-window) chapter.
{% endhint %}
{% endstep %}

{% step %}
Click on the **Shader Graph** button <img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FsUDUkiD5QJrFEnXXATge%2F33.png?alt=media&#x26;token=bdee03f9-f398-4d67-b6f5-7b05275878d1" alt="" data-size="line"> at the bottom of the window. Based on the selected settings will be generated DRM node file and highlighted inside the **Project** window:

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FdibuNMzNrk6cyrR6Sja8%2F2.png?alt=media&#x26;token=7124bee9-e605-49c9-81f7-d20affce58d9" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
Pay attention that the generated DRM node's file name consists of DRM settings and clearly describes the mask type it calculates.
{% endhint %}
{% endstep %}

{% step %}
Drag and drop DRM node file from the **Project** window inside the shader editor and connect its output *<mark style="color:blue;">Mask</mark>* value to the **Base Color** block:

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FzxDsbaVuZWQxvkTvdYrL%2F3.png?alt=media&#x26;token=bbc3786c-6d38-450b-96db-977cb95aff65" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
That’s all. Now shader calculates **HeightField** type mask and renders it as the **Base Color**.&#x20;

But this mask will not be visible on the Plane mesh yet, because DRM nodes' properties currently are undefined, and they need to be updated using the controller script.
{% endstep %}

{% step %}
Create a new game object and add the **DRM Controller** script to it and set its **DRM Settings** to be the same as in the image below:

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FhbRgkxPAU7WfHl7Gx3wz%2F4.png?alt=media&#x26;token=148f6c93-a0c5-459b-8dc2-0733c55db776" alt="" width="299"><figcaption></figcaption></figure>

{% hint style="info" %}
Note, **DRM Settings** are exactly the same as the DRM nodes used inside the **Shader Graph**.
{% endhint %}
{% endstep %}

{% step %}
Drag and drop material used by the Plane mesh to the **Materials** array, inside **DRMController**.
{% endstep %}

{% step %}
Select **Pool** property to be the **Game Objects** and click on the **Create** button (on the right side of the **DRM Game Objects** array header). This will create a new **DRM Game Object** and add it to the pool.
{% endstep %}

{% step %}
That's all. Now changing **DRM Game Object**'s settings and moving it inside the scene will be visible to the Plane material:

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FEL1HcOd8Ta0Wl5f5Bnmw%2F5-(Photoshop).gif?alt=media&#x26;token=a0c57781-3d51-4bf2-9203-a1e6026621bf" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If spherical wire gizmo of the **DRM Game Object** is not visible, toggle scene gizmos visibility:

![](https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FLcZ0usfvbewWXO3UJlKZ%2F12.png?alt=media\&token=ba25feac-6b82-470d-89c1-e91932f88bb8)
{% endhint %}
{% endstep %}
{% endstepper %}

In this tutorial we have created a simple shader for visualizing the volumetric mask and demonstrated how to update and control its settings using the controller script. In the next tutorials are demonstrated, more complex usage of DRM effects, but before continuing, it is necessary to highlight core concepts of the DRM usage:

* **DRM** effect can be integrated into any shader, made by **Shader Graph**, [**Amplify Shader Editor**](https://assetstore.unity.com/packages/tools/visual-scripting/amplify-shader-editor-68570?aid=1011lvgVb) or hand-written HLSL file.
* Before integrating **DRM** effect inside a shader it is necessary to choose its style and visual properties from the **DRM** editor window and click on the appropriate shader editor button (in the bottom part of the editor window) for generating all required files used by this DRM effect:

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2Fvml7Fc5LwosFHlfy3H0r%2F1.png?alt=media&#x26;token=da9baba1-7f6c-4eed-9016-51e7de645c76" alt="" width="344"><figcaption></figcaption></figure>

* After generating **DRM** files, its node is automatically selected and highlighted inside the **Project** window. It can be drag & dropped inside shader editor:

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FzxDsbaVuZWQxvkTvdYrL%2F3.png?alt=media&#x26;token=bbc3786c-6d38-450b-96db-977cb95aff65" alt=""><figcaption></figcaption></figure>

* Output of the DRM node is a volumetric 3D spherical mask -  *<mark style="color:blue;">float</mark>* type value.
* For calculating and rendering volumetric mask DRM node uses complex set of properties that are not visible inside a shader or material editor, instead they need to be updated using **DRM Controller** script:

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FhbRgkxPAU7WfHl7Gx3wz%2F4.png?alt=media&#x26;token=148f6c93-a0c5-459b-8dc2-0733c55db776" alt="" width="299"><figcaption></figcaption></figure>

* **DRM Settings** of the controller script must be exactly the same as node settings it updates.&#x20;
* Inside shader can be used any number of various DRM nodes and each one needs to be updated using its own **DRM Controller** script.
* Materials requiring updating their DRM nodes need to be added to the **Materials** array of the **DRM Controller** script.
* If multiple materials are using the same DRM node and its calculated result needs to be the same for all materials, then they all can be updated using a single **DRM Controller** script.
* **DRM Controller** script uses Pool system for collecting DRM objects containing properties for calculating and rendering DRM nodes inside shader.

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FEL1HcOd8Ta0Wl5f5Bnmw%2F5-(Photoshop).gif?alt=media&#x26;token=a0c57781-3d51-4bf2-9203-a1e6026621bf" alt=""><figcaption></figcaption></figure>
