1
\$\begingroup\$

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);

enter image description here 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?

\$\endgroup\$
  • \$\begingroup\$ Is your vertex shader actually mapping to values on the screen? The pixel shader only runs for fragments that aren't clipped/culled which happens after the vertex shader runs. Your MVP matrix may be bad. Try drawing with an identity matrix and a full-screen quad. \$\endgroup\$ – Sean Middleditch Jun 8 '14 at 23:07
  • \$\begingroup\$ @SeanMiddleditch I tried that, MVP I set as identiy in the Visual Studio you can see that the VertexShader does display my model. I also tried Quad Rendering it shows the same but with a quad, still nothing is rendered. Other thing : I tried the same matrix and model with another (Basic Effect from SharpDx) it renders, so something is wrong with my Shader? but I don't know what :\ \$\endgroup\$ – Morphex Jun 8 '14 at 23:20
  • \$\begingroup\$ Heh, call it a blackbuffer badum tss \$\endgroup\$ – MickLH Jun 9 '14 at 2:35
  • \$\begingroup\$ That would be a more suitable name for it right now, although it sucks since I am pretty much clueless on what is wrong and what to do to fix it. \$\endgroup\$ – Morphex Jun 9 '14 at 2:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.