Hi.
I’m trying to make a shader where i can set differents colors at differents parts of my character ( 1 texture) with the use of multiple alpha channel ( one alpha for the torso, one for the legs, ect…) , but here i’m stuck with a little (big) problem. All the Alpha have the same color.
here my code:
Shader "Custom/characterCustom" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_Color2 ("Main Color2", Color) = (1,1,1,1)
_Color3 ("Main Color3", Color) = (1,1,1,1)
_MainTex ("Base", 2D) = "white" {}
_MyTexture ("B", 2D) = "white" {}
_MyTexture2 ("C", 2D) = "white" {}
}
SubShader {
Pass {
SetTexture[_MainTex]
SetTexture[_MyTexture] {
Combine texture Lerp(constant) previous
}
SetTexture[_MyTexture2] {
Combine texture Lerp(constant) previous
}
}
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
fixed4 _Color;
sampler2D _MyTexture;
fixed4 _Color2;
sampler2D _MyTexture2;
fixed4 _Color3;
struct Input {
float2 uv_MainTex;
float2 uv_MyTexture;
float2 uv_MyTexture2;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
fixed4 d = tex2D(_MyTexture, IN.uv_MyTexture) * _Color2;
fixed4 e = tex2D(_MyTexture2, IN.uv_MyTexture2) * _Color3;
o.Albedo = c.rgb;
//o.Albedo = c.rgb + d.rgb;
o.Alpha = d.a + e.a;
}
ENDCG
}
Fallback "Diffuse"
}
i’m sure i am wrong here o.Albedo = c.rgb; but i’m not very familiar with the shaders and i don’t know how i can add the different color in separate manner?
Any help is apreciated ![]()