Sprite Diffuse Shader
In Unity there are multiple ways to create a "Sprite Diffuse Shader" (meaning that sprites are affected by light sources), using both Shader Graph (URP) or HLSL.
Using Shader Graph
URP/SRP
With the addition of the URP (Universal Render Pipeline), or SRP (Scriptable Render Pipeline) you can use the "2D" rendering asset, which already includes a Sprite Diffuse Shader.
LWRP/HDRP
If you're using older versions of Unity, with LWRP or HDRP installed, here's how you can create a Sprite Diffuse Shader. In this tutorial I've used: Lightweight Render Pipeline 2.0.5-preview, Unity 2018.2.0f2.
Here's what we'll achieve:
Diffuse Shader
Here's the shader:

Explanation
In a few words: Sprite Renders need the sprites texture to be called "_MainText".
HLSL
If you want to write a sprite diffuse shader in HLSL, you can go to the Unity Archive and install the built-in shaders for each Unity version.
Thanks for reading! ❤️
Let us know what you think! We're a small team and we are loving what we do, so any feedback is appreciated ❤️ You can also consider joining the newsletter (either weekly or monthly, we care deeply about it) and never miss our new posts. Cheers!
✦ Join the newsletterMore Posts
-
April 2025
-
February 2025
-
December 2024
Cheers to 2024: a Year In Review
Dec 2024 -
December 2024
Godot Signals Architecture
Dec 2024 -
November 2024
-
September 2024
-
March 2024
We are now six people!
Mar 2024 -
November 2023
Comments