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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.