Jump to content
  • Advertisement
Sign in to follow this  
TheFallenOne

Mipmaps and Texture Seams

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

Hey guys,

 

I'm having a bit of an issue with texture mipmaps.

 

I have a model that uses a diffuse texture that doesn't stretch to the edge of the image file. To clarify, the edges of the texture are padded with a solid black color, and the texture coordinates on the model never hit either 0 or 1, they use a smaller subset of the texture.

 

When I disable mipmaps, everything works great, but with mipmaps, the edge of the texture is showing a line from the black pixels bordering the texture, making it appear like the model has a seam in it.

 

My guess is either the mipmaps are sampling part of the black pixels, or the texture coordinates are coming out with a different result on the mipmap'd texture.

 

Does anyone have any suggestions on how to fix this?

 

I can post images and code if needed.

Share this post


Link to post
Share on other sites
Advertisement

How are you generating your mipmaps, and/or what do they look like?

 

The default way of generating each mipmap level is to simply down-sample the level above by 50%. Four original pixels are averaged to get the new mip pixel. At the edge of a shape, you'll be blending some 1/2/3 of that shape's pixels with 3/2/1 black pixels, causing the blackness to 'bleed' into your shape.

 

You can either take care when generating the mipmaps, so that these black pixels are ignored, or, you can replace the black textures with similar colours to the nearby shapes so that the automatic/default algorithm doesn't do as bad of a job.

Share this post


Link to post
Share on other sites

This sounds like you're padding textures to work around non-power-of-two restrictions.  The first thing you should definitely do is check for non-power-of-two support and if you've got it, then don't bother with the padding.  Otherwise, instead of padding to black, you can repeat the last row/column to the full padded extent of the texture.

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!