Getting ready

Let's gather our assets together so that we can create the code for our Vertex Shader:

  1. Create a new scene and place a plane mesh in the center of the scene (GameObject | 3D Objects | Plane).
The Plane object created may seem to be a single quad but, in fact, has 121 verts, which we are going to be moving. Using a quad would provide unexpected results. To check for yourself, select the Plane object and, under the Plane (Mesh Filter) component, double-click on the Mesh property.
  1. Create a new shader (VertexAnimation) and material (VertexAnimationMat).
  2. Finally, assign the shader to the material and the material to the plane mesh.

Your scene should look similar to the following screenshot:

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.