# Make a GameObject compatible with 2D lights in URP

> Prepare your sprites and existing materials to be lit by 2D lighting.

Make a shader or a visual effect graph compatible with 2D lights in the Universal Render Pipeline (URP).

By default, sprites and tiles you drag into the Editor view use the `Sprite-Lit-Default` shader, which is already compatible with 2D lights.

To manually set a sprite to use the `Sprite-Lit-Default` shader, follow these steps:

1. Select the sprite GameObject in the **Hierarchy** window.
2. In the Editor window, in the Editor component, select the **Material** picker (**⊙**).
3. Select the **Sprite-Lit-Default** material.

## Create a custom shader that reacts to 2D light

To create a custom shader that reacts to 2D lights, use [Shader Graph](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest).

Follow these steps:

1. In the **Assets** menu, go to **Create** > **Shader Graph** > **URP** > **Sprite Lit Shader Graph**.

2. Open the newly created shader graph asset.

3. Add three **Sample Texture 2D** nodes to the shader graph.

4. Set the **Type** of one of the new nodes to **Normal**.

5. Connect the outputs of the nodes to the following **Fragment** context input slots:

   * First **Default** type node: Connect **RGBA** to **Base Color**, then connect **A** to **Alpha**.
   * Second **Default** type node: Connect **RGBA** to Editor.
   * **Normal** type node: Connect **RGBA** to **Normal (Tangent Space)**.

6. Create three **Texture 2D** properties by selecting **Add** (**+**) on the [Blackboard](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Blackboard.html), then choosing **Texture 2D**:

   * **Main Texture** `MainTex`: Defines the base color and transparency (alpha) of the sprite.
   * **Mask Texture** `MaskTex`: Determines areas of the sprite that should be visible or hidden using a custom mask.
   * Normal Map `NormalMap`: Adds surface details by simulating bumps and grooves, enhancing lighting effects on the sprite.

7. Drag each property into the shader graph workspace and connect them to the **Texture** input slots in the corresponding **Sample Texture 2D** nodes.

8. Select **Save Asset** to save the shader.


   **A shader graph that enables 2D sprites to react to lighting. Three textures are connected to three Sample Texture 2D nodes. The third node has a type of Normal. The nodes are connected to the inputs of the Fragment context.:**
   ![](/api/media?file=/engine/6000.0/media/images/ShaderGraph.png)

You can now apply the shader graph to a material and use it on sprites in a scene, allowing sprites to interact with 2D lights.

## Create a visual effect graph that reacts to 2D light

To create a visual effect graph that reacts to 2D light, follow these steps:

1. [Create a visual effect graph](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@latest/index.html?subfolder=/manual/GettingStarted.html#creating-visual-effect-graphs) and select the **Simple Loop** template.
2. In the visual effect graph, replace the **Output Particle Unlit** node with an **Output Particle Shader Graph Quad** node.
3. In the **Output Particle Shader Graph Quad** node, select the **Shader Graph** picker (**⊙**).
4. In the **Select Shader Graph Vfx Asset** window, select the eye icon to show hidden packages.
5. Select the **VFXSpriteLit** shader.

For more information, refer to [Using a Shader Graph in a visual effect](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@latest?subfolder=/manual/sg-working-with.html#using-a-shader-graph-in-a-visual-effect).

## Additional resources

* [Create and assign a material](/engine/6000.0/manual/materials-and-shaders/materials/create-material.md)
* [Unity Shader Graph documentation](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html)
* [Blackboard in Shader Graph](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Blackboard.html)
