How to deal with mipmaps on the mirrored mesh?

Started by
4 comments, last by JohnnyCode 10 years, 7 months ago

Hi~Recently I downloaded some skined meshes for my demo,some of them were mirrored and just have a half of contents in the texture(since the UV in mesh were also mirrored). Then I found a problem that when the mip level increases,a black line appears in the middle of mesh.Is it because the GPU samples some background color in the border of the actual image content when I sample the smaller mipmap? How can I sovle this problem ? Do I need to make some bias or clamp the mip level ?

Advertisement

maybe you've set the wrong wrapping mode, try GL_CLAMP_TO_EDGE.

or your texture has already some dark pixels? in that case you'd need to use a 'dilate' filter to fill all the empty area in your texture. you might not see those pixels if the best mip level is used, but those pixels bleed into really used pixel the further you go down the mip chain (in the end, there is just 1 pixel that is average of the whole texture, not the _really_used_texture_).

maybe you've set the wrong wrapping mode, try GL_CLAMP_TO_EDGE.

or your texture has already some dark pixels? in that case you'd need to use a 'dilate' filter to fill all the empty area in your texture. you might not see those pixels if the best mip level is used, but those pixels bleed into really used pixel the further you go down the mip chain (in the end, there is just 1 pixel that is average of the whole texture, not the _really_used_texture_).

Yes,the texture have a background color of black. What is the 'dilate' filter ? Can I use this in D3D9 ? Thank you~

maybe you've set the wrong wrapping mode, try GL_CLAMP_TO_EDGE.

or your texture has already some dark pixels? in that case you'd need to use a 'dilate' filter to fill all the empty area in your texture. you might not see those pixels if the best mip level is used, but those pixels bleed into really used pixel the further you go down the mip chain (in the end, there is just 1 pixel that is average of the whole texture, not the _really_used_texture_).

Yes,the texture have a background color of black. What is the 'dilate' filter ? Can I use this in D3D9 ? Thank you~

simply said: for every 'background' pixel search the closest non-background pixel and use that color instead. that's done when you generate the mipmaps. for testing you could e.g. in photoshop select all black areas, apply a blur filter repeatedly until no background color is visible anymore.

maybe you've set the wrong wrapping mode, try GL_CLAMP_TO_EDGE.

or your texture has already some dark pixels? in that case you'd need to use a 'dilate' filter to fill all the empty area in your texture. you might not see those pixels if the best mip level is used, but those pixels bleed into really used pixel the further you go down the mip chain (in the end, there is just 1 pixel that is average of the whole texture, not the _really_used_texture_).

Yes,the texture have a background color of black. What is the 'dilate' filter ? Can I use this in D3D9 ? Thank you~

simply said: for every 'background' pixel search the closest non-background pixel and use that color instead. that's done when you generate the mipmaps. for testing you could e.g. in photoshop select all black areas, apply a blur filter repeatedly until no background color is visible anymore.

Thanks~I will try it.

there is a certain logic to when bilinear , or any, filtering founds itself needing a pixel out of bound. It does travel to oposite wrap, would there be a seam? the wraped pixel is fetched, for that is a pixel realy appearing in case of tilling, and, the tilling is reason for this dilema encounter anyway.

This topic is closed to new replies.

Advertisement