Jump to content
  • Advertisement
Sign in to follow this  
n0ob

Boggling pixel shader issue

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

So, I'm rendering a 101x101 texture (for testing) to a 1x1 render target. The input is just position and a texture coord. The pixel shader returns the texel at the input texture coord of the test texture: return tex2D( Sampler, In.UV ); However, it's returning the upper left texel, instead of the middle like I want. If I put in some checks for the UV value, such as: if( In.UV.x == .5 || In.UV.y == .5 ) return tex2D( SceneSampler, In.UV ); return float4(0,0,1,1); With this code it returns the color at the upper left corner of the texture, still (and not the blue color) So, apparently the value is (.5, .5), but when it's used by the sampler it's (0, 0). If I do this before everything: In.TextureUV.xy = float2(.5, .5); Then it works as expected, and I get the middle texel, and not a blue color. I'm just wasting a ton of time on this, and I don't know of anything that might cause this behavior (besides a compile bug?) I've tried compiling PS2.0 and PS3.0, with the same result. Any input is appreciated!! Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Hmm, that is boggling. Have you used the most recent DirectX SDK or have you tried compiling these on another computer?

Share this post


Link to post
Share on other sites
Whenever something like this happens, you should always use PIX to find out what's going on. Using PIX, you can examine the ASM code to make sure nothing funky is going on.

Share this post


Link to post
Share on other sites
Turns out the texture had mip levels with point filtering.. So whatever my logic was doing must've been making it choose a different level. Anyway, I made sure it was one level and it worked. Thanks for the PIX suggestion! I hadn't really used it before this.

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!