Rendering points

Started by
4 comments, last by sirob 15 years, 5 months ago
I'm trying to render a single point to the screen to test some of my code. The point is at 0,0,0. It is to be rendered white on a black background. I have the primitive topology as D3D10_PRIMITIVE_TOPOLOGY_POINTLIST. I can't see the point rendered anywhere in my window. Why isn't this working, and what can I do to fix this? My guess would be that since the point doesn't cover exactly the center of a pixel it isn't rendered. Is this even close to my problem?
Advertisement
Quote:Original post by Diltsman
I'm trying to render a single point to the screen to test some of my code. The point is at 0,0,0. It is to be rendered white on a black background. I have the primitive topology as D3D10_PRIMITIVE_TOPOLOGY_POINTLIST. I can't see the point rendered anywhere in my window.

Why isn't this working, and what can I do to fix this? My guess would be that since the point doesn't cover exactly the center of a pixel it isn't rendered. Is this even close to my problem?
I don't know how pointlist works exactly, but can you test it in PIX. Debug the pixel which should contain your point and look at the mesh view tab to see what happens to your point.

Hope this brings us one step further.

Vertex
Quote:Original post by Diltsman
I'm trying to render a single point to the screen to test some of my code. The point is at 0,0,0. It is to be rendered white on a black background. I have the primitive topology as D3D10_PRIMITIVE_TOPOLOGY_POINTLIST. I can't see the point rendered anywhere in my window.

Why isn't this working, and what can I do to fix this? My guess would be that since the point doesn't cover exactly the center of a pixel it isn't rendered. Is this even close to my problem?


A point rendered can't "disappear" between two pixels, in general. It will be rendered on the closest pixel to its actual position.

That said, if your backbuffer dimensions don't match the client rectangle of the window, DX might apply a point-filtered-scaling that might hide the point. Make sure the window's internal size, without the borders, matches the backbuffer size.

Also, an error in your pixel or vertex shaders might cause the point to fail to appear where you expect it.

In addition, any failure of any call, or you failing to call a required method (for example, if you forgot to set a stream source), would also cause the point to fail to draw correctly.

Make sure no calls are failing, and that you're calling everything you should be (use the tutorials in the SDK documentation as a reference). Also, make sure there is no debug output in VS's output window.
Sirob Yes.» - status: Work-O-Rama.
PIX looks to be a really useful tool. Thank you for suggesting it.

When I run one of my frames through PIX, it looks like a pixel is drawn where I expect it. I have tabs labeled PreVS, PostVS, and PostGS. I'm not seeing where it is showing the output of the Pixel Shader, though.

struct VS_INPUT{    float4 pos : SV_Position;    float4 col : Color;};struct VS_OUTPUT{    float4 pos : SV_Position;    float4 col : Color;};VS_OUTPUT VS(in VS_INPUT input){    VS_OUTPUT output;    output.pos = input.pos;    output.col.x = 1.0;    output.col.y = 1.0;    output.col.z = 1.0;    output.col.a = 1.0;    return output;}float4 PS(in VS_OUTPUT input) : SV_Target{    return input.col;}
So, I changed the resolution to 640x480 so that the rendered point would be larger on the screen, and I don't see it. Any ideas why it doesn't appear to be rendering?
There's a mound of possible reasons. However, since you say it is getting past the vertex shader (as you can see it in the correct location using PIX), it's probably either a Zbuffering issue, or an alpha blend/test issue. Make sure both settings are disabled.
Sirob Yes.» - status: Work-O-Rama.

This topic is closed to new replies.

Advertisement