I'm new to hlsl. I'm trying to write a pixel shader that converts from RGB space to YIQ space (NTSC). The conversion process is fine, but I cannot seem to get the sampler and tex2D to return any colour besides that in the upper left of the texture. I know it has to be a stupid mistake, but googling has just made me more confused.
I have tried declaring a texture and linking it to the sampler2D with sampler_state, but that didn't seem to change anything. I'm using Ventuz, which runs DirectX 9 and Pixel Shader 3.0. I have a simple plane object with an image texture. I just want to be able to see the texture untouched after going through the shader so I can then try the conversion steps.
float4x4 WorldViewProjection : WORLDVIEWPROJECTION;
sampler2D TextureSampler : register( s0 );
float4 VS( float4 Position : POSITION ){
return float4( mul( Position, WorldViewProjection ) );
}
float4 PS( float2 uv : TEXCOORD ) : COLOR
{
float4 Colour = tex2D( TextureSampler, uv.xy );
/* Perform colour space conversion steps */
return YIQA;
}
technique Tech1
{
pass pass0
{
vertexshader = compile vs_3_0 VS();
pixelshader = compile ps_3_0 PS();
}
}
What am I doing wrong?