How to do it...

In order to make our grayscale screen effect work, we need a script and shader. So, we will complete these two new items here and fill them in with the appropriate code to produce our first screen effect. Our first task is to complete the C# script. This will get the whole system running. After this, we will complete the shader and see the results of our screen effect. Let's complete our script and shader with the following steps:

  1. Open the TestRenderImage.cs C# script and begin by entering a few variables that we will need to store important objects and data. Enter the following code at the very top of the TestRenderImage class:
#region Variablespublic Shader curShader;public float greyscaleAmount = 1.0f;private Material ...

Get Unity 2018 Shaders and Effects Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.