With the scene prepared, we can now begin the process of experimenting with some of the built-in helper functions included with the UnityCG.cginc file. Double-click on the shader that was created for this scene in order to open it in your IDE of choice and insert the code given in the following steps:
- Add the following code to the Properties block of the new shader file. We will need a single texture and slide for our example shader:
Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _DesatValue ("Desaturate", Range(0,1)) = 0.5 }
We then need to make sure that we create the data connection between our Properties and CGPROGRAM blocks.
- Use the following code, placed after the CGPROGRAM declaration and #pragma directives, ...