Sign in to follow this  

PS output problem!?

This topic is 3663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am having trouble rendering a triangle from a specific angle in DX10. I have had success rendering one in the XY plane around with worldspace points (0, 0.5), (0.5, -0.5) and (-0.5, -0.5) and a viewing transform constructed from D3DXMatrixLookAtLH using Dir: {0, 0, 1} Pos: {0, 0, 0} Up: {0, 1, 0} Now ive repositioned the triangle so that it lies in the XZ worldspace plane, with the camera centered 5000 units up the Y-axis looking vertically down, with the normal pointing towards Z. The triangle points are the same but scaled by 2000 in all components. . . but things don't show up anymore! Using pix and looking at the input and output of the vertex shader, transformations are being applied correctly and placing the points about where you'd expect them. But for some reason, nothing shows up. 'Debug pixel' doesn't say anything about the output from the vertex shader as it would normally, or anything about the point being culled for depth failure or whatnot. Rendering a sdkmesh file with the looking-down camera view works fine, and positions the object as you'd expect it to be positioned. Here is the shader i am using to render triangles, shamelessly stolen from MS:

//--------------------------------------------------------------------------------------
// Constant Buffer Variables
//--------------------------------------------------------------------------------------
matrix world;
matrix view;
matrix projection;

//--------------------------------------------------------------------------------------
struct VS_INPUT
{
    float4 Pos : POSITION;
    float4 Color : COLOR;
};

struct PS_INPUT
{
    float4 Pos : SV_POSITION;
    float4 Color : COLOR;
};


//--------------------------------------------------------------------------------------
// Vertex Shader
//--------------------------------------------------------------------------------------
PS_INPUT VS( VS_INPUT input )
{
    PS_INPUT output = (PS_INPUT)0;
    output.Pos = mul( input.Pos, world );
    output.Pos = mul( output.Pos, view );
    output.Pos = mul( output.Pos, projection );
    output.Color = input.Color;
    
    return output;
}


//--------------------------------------------------------------------------------------
// Pixel Shader
//--------------------------------------------------------------------------------------
float4 PS( PS_INPUT input) : SV_Target
{
    return input.Color;
}


//--------------------------------------------------------------------------------------
technique10 Render
{
    pass P0
    {
        SetVertexShader( CompileShader( vs_4_0, VS() ) );
        SetGeometryShader( NULL );
        SetPixelShader( CompileShader( ps_4_0, PS() ) );
    }
}
I am quite new to DX and at a loss for what is disappearing my triangle . I've uploaded PIX output to http://files-upload.com/files/658357/Run5.PIXRun thanks in advance!

Share this post


Link to post
Share on other sites
I suspect that the geometry is being clipped, either by the near plane, by being completely off-screen or by back-face culling.

Move the camera around and change the face culling mode.

hth
Jack

Share this post


Link to post
Share on other sites
How do i specify clipping mode?!
I am using

D3DXMatrixPerspectiveFovLH (&projMat, 3.1415f * 0.25f , aspect, 0.5f, 100000.0f);

to specify the projection matrix, which places the plane at 500 units away from the camera well and truely between the near and far planes. I am not specifying
vertex normals . . . does it decide about backfacing because of the winding order
or something crazy like that?

Share this post


Link to post
Share on other sites

This topic is 3663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this