[Solved] Shader: cutout shader over a texture

Hello community,

Currently i’m trying to make a shader that has a main texture + a transparent(cutout) texture/layer on top of it. Imagine this as a ‘skin & eyebrow’ situation the main texture is the skin. The eyebrow texture is suppose to be the transparent overlaying part of the shader.

The current code only seem to show the material color as it’s base, the code as below does need an extra texture my question is, how to swap the material color as the background layer and use a texture instead in order to get a (png eyebrow) over a skin texture. It is a really basic concept but i’ve just started looking into the whole shader department so if anyone can help me on my way, please do :wink: Here is what the shader code currently looks like:

Shader "custom/headshader" {

    Properties
    {
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex ("Base (RGBA)", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 250
    
        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _MainTex;
        fixed4 _Color;

        struct Input
        {
            float2 uv_MainTex;
            float2 uv_DecalTex;
        };

        void surf (Input IN, inout SurfaceOutput o)
        {
            fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
            o.Albedo = lerp(_Color, c.rgb, c.a);
            o.Alpha = 1;
        }
        ENDCG
    }
    Fallback "Diffuse"
}

I think you’re trying to display a one texture on top of a background texture but what you’re doing is using the cloud alpha to cutout the background.

Try this instead:
http://answers.unity3d.com/questions/273680/transparent-cutout-shader.html