Jump to content
  • Advertisement
Sign in to follow this  

what coordinate system am I in?

This topic is 3406 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

My object starts out in object space. When I multiply it by the world matrix I am in world space. When I multiply that by the view matrix I am in camera space. When I multiply that I am in projection space in some mathmatical world of the viewing frustrum that I cannot visualize in my head. When my vertex leaves the vertex shader and is about to enter the pixel shader, i.e my debug output from PIX postVS, what coordinate system am I in? Should I be able to tell if a vertex will be visible or clipped on the screen? My object is not showing up. PIX shows my inputs correctly in the vertex shader debugger. I cannot launch the pixel shader debugger, because there are no active pixels when there should be. My only conclusion is that my vertices are getting clipped. I have no idea why! Should something at -0.934, -1.207, -0.501, -0.500 show up? Here are my variables from PIX in the vertex shader debugger for the first vertex: vs debugger variables Here is what it looks like postVS: vs debugger variables Render tab is just blank and if I click debug pixel on any of it, all I see is: Initial frame buffer value ClearRenderTargetView Final frame buffer value Which tells me nothing. I don't see a way to debug the pixel shader on something that isn't showing as an active pixel on the screen. --------------------------------------- I seemed to have solved the problem. I changed
struct VS_INPUT
{
   float3 position : POSITION;
   float3 normal   : NORMAL;
   float2 uv       : TEXCOORD0;
   
};




to
struct VS_INPUT
{
   float4 position : POSITION;
   float3 normal   : NORMAL;
   float2 uv       : TEXCOORD0;
   
};




My data has 3 floats. I don't know why I have to program the vertex shader to accept 4. Doesn't it know what the 4th value should be? It seems to know, when I ask for 4 floats, it automagically sets the 4th to 1.0. However, when I asked for 3, it ended up setting the 4th to 0.0 for the output. Should I also be changing my normals to be a float 4 instead of a float 3?? Can someone explain what happened here. All I know is that I got it working, but I'd like to know why. [Edited by - brekehan on January 21, 2009 11:35:10 PM]

Share this post


Link to post
Share on other sites
Advertisement
The pixels are transformed into homogeneous coordinates, which range from (-1,-1), which is the top left corner of the screen, and (+1, +1), which is the bottom right corner of the screen. The coordinate for the exact center of the screen is (0,0). It looks like those post-VS coordinates are out of range, so that might be why you don't see it in the view port.

It seems like it still should be drawing some pixels, though, because even though the verts themselves are out of range, it seems at first glance that the faces defined by those verts still overlap the viewport.

So it might help to look at the Render during this draw call, and just right-click on any pixel and debug it. Search for a fragment with a draw call number that matches the draw you're working with. It might be that it failed a depth test or an alpha test, or that the shader outputted an alpha value of 0 for some reason.

Share this post


Link to post
Share on other sites
Read this article at the section labelled "Set Up the Viewport for Clipping"

The W component which is included in the Vector4 or float4 is an indication of whether or not the vertices have already been transformed (don't transform them for me) or if they should be transformed (that little section in your vertex shader where you multiply the position by the wvp (world * view * projection) matrix.

That's why your object didn't show up until you included the float4.

I hope this helps!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!