Data clipped before Output Merger

Started by
13 comments, last by Plerion 10 years, 8 months ago

Hello everyone

Im rendering a triangle and according to visual studios debug capabilities it gets clipped somewhere between the vertex shader and the output merger. Ill illustrate that with an image:
3LdAw.png

The data after the vertex shader (current image) looks as it should with the given data but in the output merger nothing gets drawn. Ive compared the initialization code to one of my other projects and i couldnt find any differences. Therefore im not quite sure what code you might need but if you need anything just post it and ill look for the code.

/Edit:
I've found some more information, maybe it helps:
3LeIl.png

3LeJv.png

3LeQh.png

Pixel-Shader:


struct PixelInput
{
float4 position : SV_POSITION;
float2 texCoord : TEXCOORD0;
};
 
float4 pixelMain(PixelInput input) : SV_TARGET {
return float4(1, 1, 1, 1);
}

Vertex-Shader:


struct VertexInput
{
	float4 position : POSITION0;
	float2 texCoord : TEXCOORD0;
};

struct VertexOutput
{
	float4 position : SV_POSITION;
	float2 texCoord : TEXCOORD0;
};

cbuffer MatrixBuffer : register(c0)
{
	matrix World;
	matrix View;
	matrix Projection;
};

VertexOutput vertexMain(VertexInput input) {
	float4 posWorld = mul(input.position, World);
	float4 posView = mul(posWorld, View);
	float4 posProj = mul(posView, Projection);

	VertexOutput output = (VertexOutput)0;
	output.position = posProj;
	output.texCoord = input.texCoord;

	return output;
}

                                  
Advertisement

Do you know where on the screen it should show up? If so look at the pixel history it might tell you why it failed to draw that pixel.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

I thought how it looks after the vertex shader is how it will be on the screen. However not a single pixel in the render target contains another history entry than the one from ClearRenderTargetView.

Hmm. Things to try:

  • Make sure you pass the debug flag at shader creation: D3DCOMPILE_DEBUG
  • Make sure you pass the debug flag at dx creation: D3D11_CREATE_DEVICE_DEBUG
  • Make sure you compile the correct pixel shader, if you have more.
  • In the pixel shader try returning another color, like green, red or even blue.

Maybe your too close to the vertices, so they get clipped away?

When you create your perspective matrix, what's your znear and zfar?

When looking at this calls:

IASetIndexBuffer(NULL, DXGI_FORMAT_UNKNOWN, 0)

IASetVertexBufer(0, 32, someobject(NULL, NULL, NULL, NULL.....

These two commands are the only commands that set the V/I buffers, and these are the only one you call before the rendering, so you don't set the vertex and index buffers after these two commands, so I guess you don't send the correct data?

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

Hey Migi0027

Thanks for your tips, here is what ive got:

- Shaders are compiled with debug

- Device is created with debug (no errors/warnings in the output)

- Pixel shader i need to test a few things, because i also found it strange that it doesnt show up in the pipeline stages but in my other projects it does

I thought it was the clipping as for a test im using a very small triangle (inside the cube 0/0/0 to -2/-2/1) and zNear is set to 1 but my matrix looks from 1/0/0 to 0/0/0 with 0/0/1 as up). I changed it to be at 4/0/0, which changes the post-vertex-shader view in the debugger correctly but still, nothing in the output merger stage.

The data is correct, there are no indices and ive inspected the data in the debugger, it is the same as i pass in


	struct Vertex
	{
		float x, y, z, w;
		float u, v;
	} vertices[3] = {
		{ -2, 2, 1, 1, 0, 0 },
		{ -2, 2, 0, 1, 1, 0 },
		{ 0, 0, 1, 1, 1, 1 }
	};

Also the matrices in the cbuffer are set correctly when inspected using the GPU debugger.

Try using 0.1f for the znear

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

Hey

Thanks for your hint. In currently not at my computer but I think the problem ain't related to the vertex data. The post vertex shader view in the debugger shows the output of the vertex shader in projection space with the usual clipping already applied, e.g. clipping near and far plane.

So I think the problem is that the pixel shader never gets called. I'm not 100% sure but I thin that there are only two possible situations.
1) The rasterizer does not generate any fragments but as all checks are disabled in the rasterizerstate that should not be the case.

2) My pixel shader is not attached correctly even though it shows up in the debugger.

I will have a look at everything when I'm back home.

Thanks and a nice afternoon
Plerion

Hey

Thanks for your hint. In currently not at my computer but I think the problem ain't related to the vertex data. The post vertex shader view in the debugger shows the output of the vertex shader in projection space with the usual clipping already applied, e.g. clipping near and far plane.

So I think the problem is that the pixel shader never gets called. I'm not 100% sure but I thin that there are only two possible situations.
1) The rasterizer does not generate any fragments but as all checks are disabled in the rasterizerstate that should not be the case.

2) My pixel shader is not attached correctly even though it shows up in the debugger.

I will have a look at everything when I'm back home.

Thanks and a nice afternoon
Plerion

Your problem is most likely related to your view transform, if the object is drawn outside of the view frustum or view port, the transformed vertices will not be going through the pixel shader. And this is also the reason that you can't find another pixel with a different pixel history then the clear call, objects that are not in the view port will not have a pixel shader run for them.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

Try debugging your program with pix, and see what shaders are attached and the device states.

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

Though that should show ip on the pixel history, check your blend state, especially RenderTargetWriteMask.

I still suspect some out of clip space trouble. I still use VS 2010 and PIX and now surfing the docs of the graphics debugger I really wonder: Is there no way to list the vertices' values in tabular form like in PIX ? (now that would be a step back)

If no, and you can't use PIX yourself, can you provide a minimal example project ? A working exe would suffice, I'd run it through PIX myself.

PS: Is there an official term for this kind of helping ? Remote group debugging ? Social debugging ? wink.png

This topic is closed to new replies.

Advertisement