Despite the simplicity of the problem I encountered, I cannot find the answer ANYWHERE on the Internet. I have the original texture that I get from the used RenderTarget, which then passes it to me. My effect has a vertex shader and a pixel shader, but the pixel shader is important. I want vertex shaders to do nothing for input vertices. Then the output should be passed to my pixel shader, which will perform image processing (for example, blur, etc.) on the image. The result of this will be towards the screen.
So basically, I just need a vertex shader that accepts the texture and transfers it completely unchanged. There is no three-dimensional geometry.
Here is the code I wrote for this:
float4 VSBasic(float4 vin : POSITION) : POSITION { return vin; }
And here is my pixel shader, which should turn all the pixels into red:
float4 PS_GaussianBlur(float2 texCoord : TEXCOORD) : COLOR0 { float4 color = float4(0.0f, 0.0f, 0.0f, 1.0f); //int kernelLength = min(31, kernelRadius * 2 + 1); //for (int i = 0; i < kernelLength; i++) //color += tex2D(colorMap, texCoord + offsets[i]) * kernel[i]; color = float4(1.0f, 0.0f, 0.0f, 1.0f); return color; }
Note that the blurry part is commented out for testing.
So what am I doing wrong ?!
PS The only reason I even use the vertex shader is that XNA will complain that I use conflicting versions of the pixel / vertex shaders, unless you specify that I should compile PS_3_0 and VS_3_0 (because I need PS_3_0 , it works for me in PS_2_0 without a vertex shader). Therefore, if there is another way to specify the vertex shader version without actually implementing the vertex shader, let me know.
EDIT: for clarification, my solution works fine in PS_2_0, but PS_2_0 does not have enough constant registers in my opinion. I want to expand the shader in PS_3_0 so that I can work with a lot more registers. However, when I do this, XNA complains that PS_3_0 is not compatible with previous vertex shaders, so I had to create my own vertex shader. However, I do not want this vertex shader to do anything, since all the work is done in my pixel shader. Hope this clarifies the situation.