• Advertisement

Archived

This topic is now archived and is closed to further replies.

ScreenSpace Vertices In Shaders

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

I would like to be able to send vertices defined in screen-space thru a custom vertex shader. The fixed function pipeline offers the D3DFVF_XYZRHW flag for using screen-space verts, but is there any way to do this using the programmable pipeline? I am using DirectX 8 on the PC by the way (I know XBox lets you do this but I need it to work on the PC).

Share this post


Link to post
Share on other sites
Advertisement
Yes, just move the untranformed vert into oPos.

shader declaration should look like this:

{
D3DVSD_STREAM(0),
D3DVSD_REG(0,D3DVSDT_FLOAT3),
...
D3DVSD_END()
};

and vertex shader like this

vs.1.1
mov oPos.x,v0
...



Mike

"The state is that great fiction by which everyone tries to live at the expense of everyone else." - Frederick Bastiat, The Law

Share this post


Link to post
Share on other sites
But usually the output for the oPos register is the coordinate in clip-space ([-1..+1] range for (x,y) and [0..1] for z) isn''t it? I thought it works such that after the vertex shader runs the value you write to the oPos register is scaled into the current viewport, is there something special one can do to disable it from scaling to the viewport? Or perhaps I am not understanding how it works correctly?

Thanks.

Share this post


Link to post
Share on other sites
Well, if that doesn''t work, just set an orthographic matrix.


Mike

"The state is that great fiction by which everyone tries to live at the expense of everyone else." - Frederick Bastiat, The Law

Share this post


Link to post
Share on other sites

  • Advertisement