LayerShader

Original Author: Bill Vinton (Sync1B) Updated version for 2-texture cards, and doubled lighting version: Jessy

Description
This shader is good for making terrains where you need to tile textures but still want paths. Basically it blends between two textures using alpha from the third (Path Mask) texture.

This shader requires a 4-texture video card (GeForce3 and up, Radeon 8500 and up) to be rendered in one pass.

See also: TerrainFourLayer, which blends four terrain textures, and TerrainTwoLayerBumped shader, which adds bumpmapping.

Usage
Terrains, Tile masking

Path Mask texture's alpha channel is used to blend between Main and Path textures.

This first, original version, does not use "doubled" lighting. (Doubling the lighting seems to be the standard with built-in Unity shaders). Because the strength of the Ambient light in the Render Setting is halved, you will only be able to achieve half the brightness of your textures with ambient light alone, unless you script the Ambient light to have color components above 1.

The second shader below doubles the lighting calculation, which means that if you set Ambient light to be white, and have no other lights in your scene, the terrain (or whatever else you use this on) will show up with the textures exactly as you painted them. It is also possible to achieve overblown highlights with this latter version.

[[Media:Two Layer Terrain.zip|Click here for a zip file that includes these two shaders.]]