- Home /
Question by
benfattino · Jul 14, 2013 at 07:50 PM ·
shaderalphadiffuseblend
Blend two texture diffuse shader with alpha
Somebody can help me to add transparent value to this shader? I need to make fade with another object.
Shader "Custom/Blend2TextureDiffuse" {
Properties
{
_ColorTint ("Tint", Color) = (1.0, 1.0, 1.0, 1.0)
_Blend ("Blend", Range(0, 1)) = 1.0
_MainTex ("Texture", 2D) = ""
_Texture2 ("Texture 2", 2D) = ""
_BumpMap ("Bumpmap", 2D) = "bump" {}
}
SubShader
{
Tags { "RenderType" = "Opaque" }
Cull Off
CGPROGRAM
#pragma surface surf Lambert
// #pragma surface surf WrapLambert
// half4 LightingWrapLambert (SurfaceOutput s, half3 lightDir, half atten) {
// half NdotL = dot (s.Normal, lightDir);
// half diff = NdotL * 0.5 + 0.5;
// half4 c;
// c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten * 2);
// c.a = s.Alpha;
// return c;
// }
struct Input
{
float2 uv_MainTex;
float2 uv_Texture2;
float2 uv_BumpMap;
};
fixed4 _ColorTint;
void mycolor (Input IN, SurfaceOutput o, inout fixed4 color)
{
color *= _ColorTint;
}
sampler2D _MainTex;
sampler2D _Texture2;
sampler2D _BumpMap;
float _Blend;
void surf (Input IN, inout SurfaceOutput o)
{
float3 t1 = tex2D (_MainTex, IN.uv_MainTex).rgb;
float3 t2 = tex2D (_Texture2, IN.uv_Texture2).rgb;
o.Albedo = lerp(t1, t2, _Blend);
o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
}
ENDCG
}
Fallback "Diffuse"
}
Comment
Your answer
Follow this Question
Related Questions
Decal Alpha Blend 0 Answers
Blend 2 Texture with alpha 1 Answer
Scripting Shader: How to control Alpha with slider? 1 Answer
Separate Alpha and Color Textures for CutOut Shader 1 Answer