Next, let's add a slider that will allow the user to control how much to blend between the textures. The following code will add a slider and place it at the bottom of the screen:
All we have to do now is register a function that is called when the slider event occurs and within that function, change the parameter of the blend program. This is done using vizact.onslider().
When the slider object is moved we set the blend amount to the position of the slider, which goes from 0 to 1. So, when the slider is at the very right edge, the value will be 1, which means 0% of texture 1 will be blended with 100% of texture 2. Run your script and move the slider back and forth to see the textures blending in real time. Multi-texturing can be used to create many interesting effects, especially when used with the power of shader effects.