Jump to content
  • Advertisement
Sign in to follow this  
Syranide

Texture sampling troubles

This topic is 3037 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'm currently working on a little game, and I just added textures to the terrain which is made up of cubes. The textures currently uses point-sampling to get a crisp feel, everything is peachy with no AA and point-sampling, but if I activate AA or linear-sampling then it starts sampling way outside of the texcoord-boundries.


Here's a picture to demonstrate, no texture mipmaps, point-sampling, 16xQ AA (although all variations have the same issue). To the right is a snippet of the texture, although not obvious, the tile also has 1 pixel padding.



The 1 pixel padding does basically nothing to alleviate the problem and as is evident on the hill to the left of the center, at extreme angles, it doesn't even appear to sample within the texcoord boundry at all... it's just red.

What on earth is going on?
I realize that it might not be much to go on, but I figured someone might at least have run into this before or have some idea on what's going on.


PS. I'll happily post relevant code if asked.

Share this post


Link to post
Share on other sites
Advertisement
When MSAA is used, by default the position used for interpolating texture coordinates is the center of the pixel even if the triangle doesn't cover the center. Thus it's possible for triangles to be extrapolated past their edges. You can alleviate this with centroid sampling. Check out this sample.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!