There's more...

Now that we have our simple screen effect system up and running, let's take a look at some of the other useful information we can obtain from Unity's renderer:

We can actually get the depth of everything in our current game by turning on Unity's built-in Depth mode. Once this is turned on, we can use the depth information for a ton of different effects. Let's take a look at how this is done:

  1. Duplicate the sphere we created twice and create a plane underneath:
  1. Create a new shader by duplicating the ScreenGreyscale code by ...

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.