texture Blend1P;
sampler Blend1PSamp =
sampler_state 
{
    texture = <Blend1P>;
    AddressU  = WRAP;        
    AddressV  = WRAP;
    MINFILTER = POINT;
    MAGFILTER = POINT;
    MIPFILTER = NONE;
};

texture Blend2P;
sampler Blend2PSamp =
sampler_state 
{
    texture = <Blend2P>;
    AddressU  = WRAP;        
    AddressV  = WRAP;
    MINFILTER = POINT;
    MAGFILTER = POINT;
    MIPFILTER = NONE;
};

texture Blend1N;
sampler Blend1NSamp =
sampler_state 
{
    texture = <Blend1N>;
    AddressU  = WRAP;        
    AddressV  = WRAP;
    MINFILTER = POINT;
    MAGFILTER = POINT;
    MIPFILTER = NONE;
};

texture Blend2N;
sampler Blend2NSamp =
sampler_state 
{
    texture = <Blend2N>;
    AddressU  = WRAP;        
    AddressV  = WRAP;
    MINFILTER = POINT;
    MAGFILTER = POINT;
    MIPFILTER = NONE;
};

float Blend1Value;
float Blend2Value;

struct Output
{
	float4 p : COLOR0;
	float4 n : COLOR1;
};

Output MorphBlendPS(float2 texcoord : TEXCOORD0)
{
	Output o;
	o.p = tex1D(Blend1PSamp, texcoord.x) * Blend1Value;
	if(Blend2Value > 0) o.p += tex1D(Blend2PSamp, texcoord.x) * Blend2Value;
	o.n = tex1D(Blend1NSamp, texcoord.x) * Blend1Value;
	if(Blend2Value > 0) o.n += tex1D(Blend2NSamp, texcoord.x) * Blend2Value;
	return o;
}

technique AddMorphBlend
{
	pass P0
	{
		PixelShader = compile ps_3_0 MorphBlendPS();
		
		AlphaTestEnable = false;
		SrcBlend = One;
		DestBlend = One;
		CullMode = None;
		ZEnable = false;
		ZFunc = Always;
		ZWriteEnable = false;
		FillMode = Solid;
	}
}