Tint Multiple Textures Separately
Hi,
I have 2DTextures: c1, c2.
And I have Colors: _Color1, _Color2.
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c1 = tex2D(_MainTex1, IN.uv_MainTex1);
fixed4 c2 = tex2D(_MainTex2, IN.uv_MainTex2);
o.Albedo = c1.rgb *c2.rgb * _Color1; //NEED HELP HERE
o.Alpha = c1.a + c2.a;
}
_Color1 is tinting both textures, I want to tint those individual textures with one color each one.
Thanks a lot if someone can provide a code answer.
Comment
Best Answer
Answer by $$anonymous$$ · Jan 29, 2017 at 09:15 PM
Didn't expect to know how to do it that soon (i'm new to shaders)
So, the way I did it:
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c1 = tex2D(_MainTex1, IN.uv_MainTex1);
fixed4 c2 = tex2D(_MainTex2, IN.uv_MainTex2);
o.Albedo = lerp(c1,_Color1,c1.a);
o.Albedo *= lerp(c2,_Color2,c2.a);
o.Alpha = c1.a + c2.a;
}
I'm using alpha channel from my textures as a mask.