Reviewing textures and UV mapping
To finish this quick review of the shader fundamentals, let’s have a short discussion on textures and UV mapping. Although we often think of the albedo (which means, the main color) when we hear the word texture, the truth is that shaders use a wide range of textures for diverse reasons, and they can be a valuable tool for optimizing your rendering. Of course, using 2D textures on 3D objects naturally implies converting between these two worlds, thus the need for the UV mapping process.
In the following sections, we are going to quickly refresh our knowledge of UVs and textures before discussing special types of textures and studying how to declare and use textures in a Unity shader code.
Wrapping a 2D image on a 3D shape
Textures are, as you know, 2D images. Therefore, the first step to using them in a 3D scene, and on 3D objects, is to find a technique to project this 2D plane onto the 3D shape. This is done via the process of UV...