Modifying my shader to overlay rather than blend.

Hiya all.

I've modified the LayerShader from Unify so that it maps two textures (with alphas) to one mesh using two different UV maps.

Is there any way I could modify it so that instead of combining MainTex with PathTex, it overlays MainTex over PathTex? The source is below:

Shader "DoubleUV2" { 

Properties {
    _Color ("Color", Color) = (1,1,1)
    _Blend ("Blend", Range (0,1)) = 0.5 
    _MainTex ("Main Texture", 2D) = "" 
    _PathTex ("Path Texture (RGB)", 2D) = ""

}

Category {
    Material {
        Ambient[_Color]
        Diffuse[_Color]
    }

    SubShader {
        Pass {
        BindChannels
        {
            Bind "Vertex", vertex         
            Bind "texcoord1", texcoord0
            Bind "texcoord", texcoord1
            Bind "Color", color
            Bind "Normal", normal
        }

            SetTexture[_PathTex]

            SetTexture[_MainTex]
            {
                combine texture * previous, previous + texture
            }

        }

        Pass {
            Lighting On
            Blend DstColor SrcColor
        }
    }
}

}

Regards, Joel.

You should really check the docs on Texturing in ShaderLab.

In the example there, they define a texture blend shader with

combine texture lerp (texture) previous

There are any number of kinds of functions you can use for combining textures and your use of terminology is unspecific.

//multiply (what you're already doing)
combine texture * previous

//add
combine texture + previous

//Alpha blend (previous's alpha will be used to blend previous over texture).
combine previous lerp(previous) texture

Based on the fact that you have a "blend" property, it would seem you want to control using that property. I did something like that here.

SetTexture[_PathTex]
SetTexture[_MainTex]
{
    ConstantColor (0,0,0, [_Blend])
    combine previous lerp(constant) texture
}

or if you wanted it to be more of an additive combiner, you could do something like:

SetTexture[_PathTex]
SetTexture[_MainTex]
{
    ConstantColor ([_Blend],[_Blend],[_Blend],[_Blend])
    combine previous * constant + texture
}