How to do it...

Let's learn how to use packed textures by entering the code shown in the following steps:

  1. We need to add a few properties to our Properties block. We will need five sampler2D objects, or textures, and two Color properties:
Properties 
{ 
 _MainTint ("Diffuse Tint", Color) = (1,1,1,1) 
     
//Add the properties below so we can input all of our    textures 
  _ColorA ("Terrain Color A", Color) = (1,1,1,1) 
  _ColorB ("Terrain Color B", Color) = (1,1,1,1) 
  _RTexture ("Red Channel Texture", 2D) = ""{} 
  _GTexture ("Green Channel Texture", 2D) = ""{} 
  _BTexture ("Blue Channel Texture", 2D) = ""{} 
  _ATexture ("Alpha Channel Texture", 2D) = ""{} 
  _BlendTex ("Blend Texture", 2D) = ""{} 
} 
As always, remove the properties we are not using from the base ...

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.