Hi,
I am trying to make a post processing pixel shader effect. To do this i use 2 textures.
In my effect i do this:
sampler samplerLeftEye; //Texture 1
texture RightEye; //Texture 2
// TODO: add effect parameters here.
struct PixelInput
{
float2 TextureCoordinate0 : TEXCOORD0;
float2 TextureCoordinate1 : TEXCOORD1;
};
sampler samplerRightEye = sampler_state
{
Texture = <RightEye>;
Magfilter = LINEAR;
Minfilter = LINEAR;
Mipfilter = LINEAR;
AddressU = mirror;
AddressV = mirror;
};
float4 PixelShaderFunction(PixelInput input) : COLOR
{
float4 left;
float4 right;
left = tex2D(samplerLeftEye, input.TextureCoordinate0);
right = tex2D(samplerRightEye, input.TextureCoordinate1);
left.a = 0.5f;
right.a = 0.5f;
return (left+right);
}
technique Technique1
{
pass Pass1
{
// TODO: set renderstates here.
PixelShader = compile ps_1_1 PixelShaderFunction();
}
}
How ever when i run my project only the samplerLeftEye Texture is drawn because the tex2D(samplerRightEye, input.TextureCoordinate1);
results in a black texture. It has something to do with the input.TextureCoordinate1. If i use input.TextureCoordinate0 i get an error saying i can't use
TEXCOORD0 twice.
How can i solve this problem?