How to do it...

Let's start by editing the Vertex and Fragment Shaders:

  1. Create a Properties block with these items in it:
Properties {  _MainTex("Base (RGB) Trans (A)", 2D) = "white" {}  _Colour("Colour", Color) = (1,1,1,1)  _BumpMap("Noise text", 2D) = "bump" {}  _Magnitude("Magnitude", Range(0,1)) = 0.05}
  1. Add their variables in the second pass:
sampler2D _MainTex;fixed4 _Colour;sampler2D _BumpMap;float _Magnitude;
  1. Add the texture information to the input and output structures:
float2 texcoord : TEXCOORD0;
  1. Transfer the UV data from the input to the output structure:
// Vertex functionvertOutput vert(vertInput v) {  vertOutput o;  o.vertex = UnityObjectToClipPos(v.vertex);  o.uvgrab = ComputeGrabScreenPos(o.vertex);  o.texcoord = v.texcoord; ...

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.