Combining two shaders (560181)

Hi,

I am trying to combine a custom shader with the default Bumped Specular shader. My custom shader is similar to this example code from the documentation:

Shader "Examples/2 Alpha Blended Textures" {
    Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
        _BlendTex ("Alpha Blended (RGBA) ", 2D) = "white" {}
    }
    SubShader {
        Pass {
            // Apply base texture
            SetTexture [_MainTex] {
                combine texture
            }
            // Blend in the alpha texture using the lerp operator
            SetTexture [_BlendTex] {
                combine texture lerp (texture) previous
            }
        }
    }
}

My goal with this is to take a base color like so:

Then overlay a texture on top of it that contains transparency:

To create a new texture that combines both of them:

The code above can get me to this point, but I want to combine this functionality with the Bumped Specular shader. Any suggestions would be greatly appreciated.

Thanks!

You need to learn cg/surface shaders, it is something like the below.

col1 = tex2d(your main texture, uv);
col2 = tex2d(your blend texture, uv);
s.Albedo = lerp(col1, col2, 1.0 - col2.a);
s.normal = do your normal as it is done in the bumpmap shader
s.Alpha = col1.a + col2.a;