Skip to main content
replaced http://gamedev.stackexchange.com/ with https://gamedev.stackexchange.com/
Source Link
added 702 characters in body; edited tags
Source Link
Morphex
  • 279
  • 1
  • 9

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 :

        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(VoxelEffectMyEffect); //This renders nothing

My matrix is calculated like this :

        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(VoxelEffect); //This renders nothing

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 :

        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
deleted 712 characters in body
Source Link
Morphex
  • 279
  • 1
  • 9

After Fiddling around I have issues witham pretty sure this is not a pixel shader, myShader issue is mostly that I get nothing draw on the screen.

 float4x4 MVP;
 // TODO: add effect parameters here.
struct VertexShaderInput
{
float4 Position : POSITION;
float4 normal : NORMAL;
float2 TEXCOORD : TEXCOORD;

};
struct VertexShaderOutput
{
float4 Position : POSITION;

};
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
input.Position.w = 0;
VertexShaderOutput output;
output.Position = mul(input.Position, MVP);
// TODO: add your vertex shader code here.
return output;
}
float4 PixelShaderFunction(VertexShaderOutput input) : SV_TARGET
{

return float4(1, 0, 0, 1);
}
technique 
{
    pass 
    {
    Profile = 11.0;
    VertexShader = VertexShaderFunction;
    PixelShader = PixelShaderFunction;
    }
}

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?

I already checked that a few others, and none of the answers solvesolved my issue.

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 <GeometricPrimitive.Draw> which if I use the default BasicEffect class renders fine but if I use mine it doesnt show anything:

  var a = new VertexPositionNormalTexture[4];
  VertexPositionNormalTexture[] QuadsVertices = new VertexPositionNormalTexture[]
  a[0] = new VertexPositionNormalTexture(new Vector3(0), new Vector3(0),{
 new Vector2(0));
        a[1] = new VertexPositionNormalTexture(new Vector3(-1, 0, 1), new Vector3(0), Vector3.Zero,new Vector2(0, 0));,
        a[2] =   new VertexPositionNormalTexture(new Vector3(1, 1, 10), new Vector3(0).Zero, new Vector2(1, 0));,
        a[3] =   new VertexPositionNormalTexture(new Vector3(-1, 0, -1), new Vector3(0), Vector3.Zero,new Vector2(0, 1));,
        int[] index = new[] {0new VertexPositionNormalTexture(new Vector3(1, -1, 20), 2Vector3.Zero,new 3Vector2(1, 1};)),
       var g = new GeometricPrimitive<VertexPositionNormalTexture>(Hyro.RenderDevice, a, index)};
        Matrix MVP = Matrix.Identity;

  g.Draw(VoxelEffect); //This renders nothing

I have issues with a pixel shader, my issue is mostly that I get nothing draw on the screen.

 float4x4 MVP;
 // TODO: add effect parameters here.
struct VertexShaderInput
{
float4 Position : POSITION;
float4 normal : NORMAL;
float2 TEXCOORD : TEXCOORD;

};
struct VertexShaderOutput
{
float4 Position : POSITION;

};
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
input.Position.w = 0;
VertexShaderOutput output;
output.Position = mul(input.Position, MVP);
// TODO: add your vertex shader code here.
return output;
}
float4 PixelShaderFunction(VertexShaderOutput input) : SV_TARGET
{

return float4(1, 0, 0, 1);
}
technique 
{
    pass 
    {
    Profile = 11.0;
    VertexShader = VertexShaderFunction;
    PixelShader = PixelShaderFunction;
    }
}

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?

I already checked that a few others, and none of the answers solve my issue.

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 :

  var a = new VertexPositionNormalTexture[4];
        a[0] = new VertexPositionNormalTexture(new Vector3(0), new Vector3(0), new Vector2(0));
        a[1] = new VertexPositionNormalTexture(new Vector3(1, 0, 1), new Vector3(0), new Vector2(0));
        a[2] = new VertexPositionNormalTexture(new Vector3(1, 1, 1), new Vector3(0), new Vector2(0));
        a[3] = new VertexPositionNormalTexture(new Vector3(1, 0, 1), new Vector3(0), new Vector2(0));
        int[] index = new[] {0, 1, 2, 2, 3, 1};
       var g = new GeometricPrimitive<VertexPositionNormalTexture>(Hyro.RenderDevice, a, index);
        Matrix MVP = Matrix.Identity;

  g.Draw(VoxelEffect); //This renders nothing

After Fiddling around I am pretty sure this is not a Shader issue.

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?

I already checked that a few others, and none of the answers solved my issue.

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 <GeometricPrimitive.Draw> 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(VoxelEffect); //This renders nothing
added 1011 characters in body
Source Link
Morphex
  • 279
  • 1
  • 9
Loading
edited tags
Link
Morphex
  • 279
  • 1
  • 9
Loading
Added new information
Source Link
Morphex
  • 279
  • 1
  • 9
Loading
edited title
Link
Morphex
  • 279
  • 1
  • 9
Loading
Source Link
Morphex
  • 279
  • 1
  • 9
Loading