Getting ready

This recipe is based on the Vertex and Fragment Shaders described in the Using the grab pass to draw behind objects recipe, as it will rely heavily on GrabPass.

  1. Create a new Vertex and Fragment Shader. You can start by copying the one used in the previous recipe, Using the grab pass to draw behind objects, as a base by selecting it and hitting Ctrl+D to duplicate it. Once duplicated, change its name to WaterShader.
  2. Create a material that will use the shader (WaterMat).
  1. Assign the material to a flat geometry that will represent your 2D water. In order for this effect to work, you should have something rendered behind it so that you can see the water-like displacement:
  1. This recipe requires a noise texture, which is used ...

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.