Jump to content
  • Advertisement
Sign in to follow this  
Endemoniada

Screen Coordinate Shader Problem

This topic is 2570 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 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!