[DX10] Triangle not being rasterized

Started by
14 comments, last by Degra 15 years, 9 months ago
I'm trying to draw a simple triangle using basic vertex and pixel shaders (no geometry shader set). Pix is telling me that the vertices are being correctly transformed in the vertex shader, but then the rasterizer is (apparently) only drawing the first pixel, or the vertex positions have all been sucked into the exact centre of the screen (also the location of the first vertex). If I change the position of the first vertex, even just nudge it to (-1, 0, 0) the single pixel disappears (yet it still looks fine Post-VS in Pix). Free Image Hosting at www.ImageShack.us The viewport setup is.. Width = 640; Height = 480; MinDepth = 0.0f; MaxDepth = 1.0f; TopLeftX = 0; TopLeftY = 0; I am still able to render my skybox (cube + cubemap) absolutely fine without any major state changes (just a different effect). Has anyone got any ideas? Thanks in advance, Ed [Edited by - Degra on July 6, 2008 2:27:34 PM]
Advertisement
Have you checked if your Cullmode match your triangle vertex order?
Quote:Original post by Demirug
Have you checked if your Cullmode match your triangle vertex order?


Culling is turned off.

This is the rasterizer state..

FillMode = D3D10_FILL_SOLID;
CullMode = D3D10_CULL_NONE;
FrontCounterClockwise = true;
DepthBias = false;
DepthBiasClamp = 0;
SlopeScaledDepthBias = 0;
DepthClipEnable = false;
ScissorEnable = false;
MultisampleEnable = false;
AntialiasedLineEnable = false;
try changing FrontCounterClockwise to false, and check again. If it works now, you specified the vertices in the false order...
Quote:Original post by MadMax1992
try changing FrontCounterClockwise to false, and check again. If it works now, you specified the vertices in the false order...


Nope, still nothing except that one pixel :(.
Can you write your shader here ?
float4x4 cWVP : WORLDVIEWPROJECTION;

struct VS_INPUT
{
float3 position : POSITION;
float4 colour : COLOUR;
};

struct VS_OUTPUT
{
float4 position : SV_Position;
float4 colour : COLOUR;
};


struct PS_OUTPUT
{
float4 colour : SV_Target;
};



VS_OUTPUT Pass0VertexShader( VS_INPUT IN )
{
VS_OUTPUT OUT;

OUT.position = mul(float4(IN.position, 1.0f), cWVP);
OUT.colour = IN.colour;
return OUT;
}

PS_OUTPUT Pass0PixelShader( VS_OUTPUT IN )
{
PS_OUTPUT OUT;

OUT.colour = float4(IN.colour.rgb,1.0f);
return OUT;
}




technique10 Debug
{
pass Pass0
{
SetVertexShader(CompileShader( vs_4_0, Pass0VertexShader() ));
SetGeometryShader(NULL);
SetPixelShader(CompileShader( ps_4_0, Pass0PixelShader() ));
}
}

[Edited by - Degra on July 7, 2008 2:27:08 AM]
Shouldn't you need a value colour in your VS_OUTPUT structure? since you are accessing it in the pixelshader?
Nothing wrong is this shader.
Can you write your draw call ?
Quote:Original post by littlekid
Shouldn't you need a value colour in your VS_OUTPUT structure? since you are accessing it in the pixelshader?


he is right, struct VS_OUTPUT doesn't contain float4 colour.

maybe you should check error messages you receive when you compile the shaders.
If a shader can't compile and you try to use it, it will just skip the rendering for those primitives.

This topic is closed to new replies.

Advertisement