Sign in to follow this  
Endemoniada

Screen Coordinate Shader Problem

Recommended Posts

Endemoniada    430
Hi guys,

I don't understand why the following does't work, the vertex inputs are in screen coordinates:

// vertex shader part

output.position.x=(input.position.x/(ScreenWidth/2.0))-1.0;
output.position.y=-(input.position.y/(ScreenHeight/2.0))+1.0;
output.position.z=0.0;
output.position.w=1.0;

I'm doing it this way because I don't want to use sprites and I'd rather not use a seperate vertex buffer/declaration (with D3DDECLUSAGE_POSITIONT), plus it seems pretty straightforward and efficient (if it worked.)

What do you think ?

Thanks.

Share this post


Link to post
Share on other sites
jamesleighe    222
Are you sure ScreenWidth & ScreenHeight are set properly?

If your using DirectX and installed the SDK then you have PIX, which you should run and use the shader debugger to look at how things are getting transformed.

Also, make sure you set your view(etc.) matrix to a properly configured orthographic matrix.

(But just use PIX, it will tell you what's wrong easy)

Share this post


Link to post
Share on other sites

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