Writing our unlit URP shader
With all this theory out of the way, it’s time to write our first URP shader! For this first example, we will go for something simple – we will design a basic unlit shader that accepts a base color and a main texture.
Figure 3.3 shows what the shader will look like on a few primitive shapes with a simple checker texture and a red color:
Figure 3.3 – Example of primitive shapes with our unlit URP shader applied
Important note
The shader we will design in this chapter will not be production-ready. It was simplified to facilitate the exploration of HLSL-based programming but does not use some of the basic optimization tricks URP offers (in particular, it is not compatible with the SRP Batcher).
To get ready to write our unlit URP shader, let’s follow these steps:
- Create a new shader script file by right-clicking on our Project panel and going to the Create | Shader | Unlit Shader menu...