O'Reilly logo

Unity 2018 Shaders and Effects Cookbook by Alan Zucconi, John P. Doran

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required