Here is what I have come up with based on this idea. Unfortunaly I'm stuck when it comes to passing the needed value to the shader…
The shader it’s self works well if you replace “mtlSkill1” in the pixel shader output, with a value like 0.5 (must be between 1 and 0) but to do smooth transitions you would need to set this dynamically out side the shader and pass it. As ello hase metioned above.
So the big question is dose any one know how I would pass a value between 1 and 0 to a shader, again for example the number 0.5
Here is the shader
Code:
float4x4 matWorldViewProj;
float4 mtlSkill1;
struct VS_OUTPUT
{
float4 Pos: POSITION;
float2 Txr1: TEXCOORD0;
float2 Txr2: TEXCOORD1;
float2 Txr3: TEXCOORD2;
};
VS_OUTPUT mainVS(
float4 inPos: POSITION,
float2 Txr1: TEXCOORD0
)
{
VS_OUTPUT Out;
// Output our transformed and projected vertex
// position and texture coordinate
Out.Pos = mul(inPos,matWorldViewProj);
Out.Txr1 = Txr1;
Out.Txr2 = Txr1;
Out.Txr3 = Txr1;
return Out;
}
texture entSkin1;
sampler Texture0 = sampler_state
{
Texture = <entSkin1>;
};
texture entSkin2;
sampler Texture1 = sampler_state
{
Texture = <entSkin2>;
};
texture entSkin3;
sampler Texture2 = sampler_state
{
Texture = <entSkin3>;
};
float4 mainPS(float2 inTxr1: TEXCOORD0, float2 inTxr2: TEXCOORD1, float2 inTxr3: TEXCOORD2) : COLOR
{
// Output
float4 color1 = tex2D(Texture1,inTxr2);
float4 color2 = tex2D(Texture2,inTxr3);
float4 blended = lerp(color1,color2,mtlSkill1);// uses a value between 1 and 0, for example 0.5
return tex2D(Texture0,inTxr1)*blended;
}
//--------------------------------------------------------------//
// Technique Section for MyEffectGroup
//--------------------------------------------------------------//
technique MyEffect
{
pass Pass_0
{
VertexShader = compile vs_1_1 mainVS();
PixelShader = compile ps_1_1 mainPS();
}
}
Any help would be greatly appreciated
Cheers