How to make the Shader combines two alpha textures ?
hi, i'm using this shader to combine two alpha textures so this is the result:
the blue one is the main texture, the red lines are the second texture
is there anyway to make the red lines cover the blue part only?
ّ
this is the shader i'm using:
Shader "Custom/testshader" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_BlendTex ("_BlendTex", 2D) = "white" {}
_Blend1 ("Blend between Base and Blend 1 textures", Range (0, 1) ) = 0
}
SubShader {
Tags { "Queue"="Geometry-9" "IgnoreProjector"="True" "RenderType"="Transparent" }
Lighting Off
LOD 200
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma surface surf Lambert alpha:fade
sampler2D _MainTex;
fixed4 _Color;
sampler2D _BlendTex;
float _Blend1;
struct Input {
float2 uv_MainTex;
float2 uv_BlendTex;
};
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 mainCol = tex2D(_MainTex, IN.uv_MainTex) * _Color;
fixed4 texTwoCol = tex2D(_BlendTex, IN.uv_BlendTex);
fixed4 mainOutput = mainCol.rgba * (1.0 - (texTwoCol.a * _Blend1));
fixed4 blendOutput = texTwoCol.rgba * texTwoCol.a * _Blend1;
o.Albedo = mainOutput.rgb + blendOutput.rgb;
o.Alpha = mainOutput.a + blendOutput.a;
}
ENDCG
}
Fallback "Custom/testshader"
}
35535.png
(236.1 kB)
Comment
Your answer
Follow this Question
Related Questions
Combining 2 shaders 1 Answer
Toon Basic shader turns objects pink in 5.3.4f1 1 Answer
shader graph messes up the texture (2D) 0 Answers
how to make dynamic textures for multiple objects? 0 Answers