Scrolling textures by modifying UV values
One of the most common texture techniques used in today's game industry is the process of allowing you to scroll the textures over the surface of an object. This allows you to create effects such as waterfalls, rivers, and lava flows. It's also a technique that is the basis of creating animated sprite effects, but we will cover this in a subsequent recipe of this chapter. First, let's see how we will create a simple scrolling effect in a Surface Shader.
Getting ready
To begin this recipe, you will need to create a new shader file (ScrollingUVs
) and material (ScrollingUVMat
) in a similar manner to how we've created our shader files previously. This will set us up with a nice clean shader that we can use to study the scrolling effect by itself.
How to do it...
To begin with, we will launch our new shader file that we just created and enter the code mentioned in the following steps:
- The shader will need...