Jump to content

  • Log In with Google      Sign In   
  • Create Account

Mipmaps and Texture Seams


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 TheFallenOne   Members   -  Reputation: 136

Like
0Likes
Like

Posted 31 May 2013 - 12:35 AM

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.



Sponsor:

#2 Hodgman   Moderators   -  Reputation: 31800

Like
1Likes
Like

Posted 31 May 2013 - 01:11 AM

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.



#3 mhagain   Crossbones+   -  Reputation: 8276

Like
1Likes
Like

Posted 31 May 2013 - 01:54 AM

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.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS