Creating and using a simple shader
The Shader Graph feature in Unity is a powerful and exciting feature that opens up shader creation and editing to everyone, without any need for complex mathematics or coding skills. In this recipe, we’ll create a simple shader to generate a checkerboard pattern, create a material that uses that shader, and then apply it to a 3D cube. It is worth noting that the Shader Graphs known as PBR Shader Graphs in previous versions of Unity is now known as URP Lit shaders. The end result of this recipe will be as follows:
Figure 14.7: Example of a checkerboard pattern being applied to a 3D cube
How to do it...
To create and use a simple shader, follow these steps:
- Create a new Unity 3D project – choose the 3D (URP) template from the list of templates.
- First, we need to install the Universal Render Pipeline (URP) package. Use Package Manager and make sure Unity Registry is checked. Search for Universal RP and...