How to setup World,View and Projection for 2D? [XNA 3.1,C#]
I'm trying to use shaders which requires
float4x4 World;
float4x4 View;
float4x4 Projection;
But I don't know how to setup them with 2D engine. I mean I don't really know what value should I pass for the correct Vertex Shader calculating with 2D.
Code:
efs[ObjShaders[i].ShaderID].effect.Parameters["World"].SetValue(Matrix.Identity);
efs[ObjShaders[i].ShaderID].effect.Parameters["View"].SetValue(Matrix.CreateLookAt(new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 0, 0)));
efs[ObjShaders[i].ShaderID].effect.Parameters["Projection"].SetValue(Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),aspectRatio,1.0f, 10.0f));
efs[ObjShaders[i].ShaderID].effect.Parameters["EyePos"].SetValue(new Vector3(0,0,0));
Shader part:
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;
float4 worldPosition = mul(float4(input.Position), World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);
output.texCoord = input.texCoord*100;
output.worldPos = worldPosition.xyz;
return output;
}
Problem: When I try to use this with VertexShader = compile vs_2_0 VertexShaderFunction(); it just doesn't show anything. but If I just use PixelShader it draws the texture,but it feels a bit buggy and misplaced.