I am trying to write a shader that fades in and blends the textures of entskin1-entskin3..

The idea is to simulate facial hair growth based on the alpha values and color values of the 3 skins.

Code:
float4 vecSkill1;
float4 vecSkill2;
float4 vecSkill3;

float4 Color;

texture entSkin1;
texture entSkin2;
texture entSkin3;

sampler smpSource1 = sampler_state { texture = <entSkin1>; };
sampler smpSource2 = sampler_state { texture = <entSkin2>; };
sampler smpSource3 = sampler_state { texture = <entSkin3>; };

float4 ColorToAlpha_PS( float2 Tex : TEXCOORD0 ) : COLOR0
{
	float4 Color1;
	float4 Color2;
	float4 Color3;

	Color1 = tex2D( smpSource1, Tex.xy);
	Color2 = tex2D( smpSource2, Tex.xy);
	Color3 = tex2D( smpSource3, Tex.xy);
	
	Color1.a*= vecSkill1;
	Color2.a*= vecSkill2;
	Color3.a*= vecSkill3;
	
	Color.rgb = lerp(Color1.rgb,(Color2.rgb * Color2.a),Color1.a);
	Color.rgb = lerp(Color.rgb,(Color3.rgb * Color3.a),Color1.a);
	return Color;
}

technique tech_00
{
	pass pass_00
	{
      AlphaBlendEnable = true; 
		VertexShader = null;
		PixelShader = compile ps_2_0 ColorToAlpha_PS();
	}
}



I am only getting partial results....The first skin is partially showing (I am assuming this is due to the alpha values somewhere) and Skin 2 and 3 are not blending in at all...

anyone can point me in the right direction ?


John C Leutz II