Jump to content
  • Advertisement
Sign in to follow this  
september

HLSL and pixel coordinates

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

Advertisement
Thank you for your answer but I haven't managed to make it works like that.
First, I must confess that I do Cg but HLSL and Cg are very close.
Here is my answer:

float4 main(in float4 color : COLOR,
in float4 fragpos : WPOS)
{
}


fragpos has the good coordinates.

I don't know if it works with HLSL (I'm curious to know) but if you want to use a texture interpolator, you will need to compute the complete projection in the vertex shader not only transform the vertex by modelviewproj.

bye.

Share this post


Link to post
Share on other sites
With SM3 you can use the VPOS register for the pixel shader and it will be filled with the screen position of the pixel.

Older shader models do not have this and you'll have to pass it in from the vertex shader as mentioned above.

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!