After Fiddling around I am pretty sure this is not a Shader issue.
Edit 4: The only diference I can see is that BasicEffect calls these methods before drawing:
// Make sure that domain, hull and geometry shaders are disable.
GraphicsDevice.DomainShaderStage.Set(null);
GraphicsDevice.HullShaderStage.Set(null);
GraphicsDevice.GeometryShaderStage.Set(null);
So I tried this:
technique
{
pass
{
Profile = 11.0;
// TODO: set renderstates here.
GeometryShader = NULL;
HullShader = NULL;
DomainShader = NULL;
VertexShader = VertexShaderFunction;
PixelShader = PixelShaderFunction;
}
}
Still it doesnt render anything. Maybe this will someone to get a idea.
My matrix is calculated like this :
Matrix MVP = Matrix.Multiply(Matrix.Multiply(Matrix.Identity, Matrix.LookAtLH(new Vector3(-10, 10, -10), new Vector3(0), new Vector3(0, 1, -0))), Camera.Projection);
VoxelEffect.Parameters["MVP"].SetValue(MVP);
I am currently Using it with Matrix.Identity.
Visual Studio Graphics Debug shows me that my vertex shader is actually working, but not the PixelShader. I striped the Shader to the bare minimums so that I was sure the shader was correct. But why is my screen still black?
EDIT: Before people start saying that this is duplicated of
DirectX11 pixel shader in pipeline is missing
I already checked that a few others, and none of the answers solved my issue.
EDIT 2:
RenderDevice.Quad.Draw(MyEffect);
This shows a quad on screen, as it should so the problem is not on my Shader code. Still I am baffled, I am doing this using another call which if I use the default BasicEffect class renders fine but if I use mine it doesnt show anything:
VertexPositionNormalTexture[] QuadsVertices = new VertexPositionNormalTexture[]
{
new VertexPositionNormalTexture(new Vector3(-1, 1, 0),Vector3.Zero,new Vector2(0, 0)),
new VertexPositionNormalTexture(new Vector3(1, 1, 0), Vector3.Zero,new Vector2(1, 0)),
new VertexPositionNormalTexture(new Vector3(-1, -1, 0), Vector3.Zero,new Vector2(0, 1)),
new VertexPositionNormalTexture(new Vector3(1, -1, 0), Vector3.Zero,new Vector2(1, 1)),
};
Matrix MVP = Matrix.Identity;
g.Draw(MyEffect); //This renders nothing
Using Quad Render I get a nice Quad on the screen. So what could possibly be the issue here?
MVP
matrix may be bad. Try drawing with an identity matrix and a full-screen quad. – Sean Middleditch Jun 8 '14 at 23:07