Creating custom Shader Graph functions
While utilizing the built-in Shader Graph nodes is useful, it is also possible to create nodes of our very own utilizing our own custom script files. This can be especially useful when certain actions need to be done several times, such as when you need to use a for
loop. In this recipe, we will see how we can use the Custom Function node to generate an output.
Getting ready
Ensure that you have created a project using one of the scriptable render pipelines mentioned in the Creating a URP-based Shader Graph project recipe in Chapter 13, Shader Graph – 2D. For the purpose of this chapter, we will be using the HDRP, so you can select High Definition RP/3D Sample Scene (HDRP) instead of the URP options when creating the new project. Afterward, complete the following steps:
- Create a new scene, if you haven't done so already, by going to File | New Scene.
- Afterward, we need to have something to show our shader, so let...