# White Outlining in Textures

This topic is 3711 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I'm using a color key on an image of a button. Every time I display the image on screeen, which I make stretch a little bit in my game, there is a mysterious white outline around the image. I know I've seen this topic here before, but I have failed to locate it. Anyone know what causes this or how to fix it?

##### Share on other sites
I was having a problem a couple of days ago with ID3DXSprite doing a fuzzy gray border around my sprites. I got rid of it by putting
d3dDevice->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_POINT);d3dDevice->SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_POINT);

immediately after my call to ID3DXSprite::Begin();

##### Share on other sites
Let me guess, the background you're removing is white? Chances are you've got your linear filtering picking up small amounts of white and blending it with your edge texels.

Usually sorting out the texture coordinates (see the "Directly Mapping Texels to Pixels" page) solves this problem. Dropping back to POINT filtering as was suggested will technically work, but you'll get very poor quality rendering once you start resizing the image.

hth
Jack

##### Share on other sites
Quote:
 Original post by CantosI was having a problem a couple of days ago with ID3DXSprite doing a fuzzy gray border around my sprites. I got rid of it by putting*** Source Snippet Removed ***immediately after my call to ID3DXSprite::Begin();

Didn't work.

Quote:
 Original post by jollyjeffersLet me guess, the background you're removing is white? Chances are you've got your linear filtering picking up small amounts of white and blending it with your edge texels.Usually sorting out the texture coordinates (see the "Directly Mapping Texels to Pixels" page) solves this problem. Dropping back to POINT filtering as was suggested will technically work, but you'll get very poor quality rendering once you start resizing the image.

No, the background is actually another texture which is mostly dark blue and black. The texel thing sound like the way to go, but do you mean by 'sort' them? I'll take a look at that page you suggested now. Also, I've been looking at the SetSamplerState function and noticed that Anisotropic is a choice. In most games this can be set to a multiple of x2 if desired. Does this mean that the textures are rendered in that many passes, or does it mean something else entirely?

[Edited by - orphankill on November 23, 2007 10:23:34 AM]

##### Share on other sites
Quote:
 The texel thing sound like the way to go, but do you mean by 'sort' them?
Nothing to do with actual sorting, just to fix them [smile]

Quote:
 I've been looking at the SetSamplerState function and noticed that Anisotropic is a choice. In most games this can be set to a multiple of x2 if desired. Does this mean that the textures are rendered in that many passes, or does it mean something else entirely?
Anisotropic filtering is essentially just an improvement over bilinear/trilinear filtering - try it and see, but it's more for oblique angles rather than the general case.

hth
Jack

##### Share on other sites
Still haven't fixed the border problem, but...

Quote:
 Original post by jollyjeffersAnisotropic filtering is essentially just an improvement over bilinear/trilinear filtering - try it and see, but it's more for oblique angles rather than the general case.

I've noticed that the SetSamplerState function allows for bilinear filtering and anisotropic. But how would I set trilinear filtering, or adjust the anisotropic ratio level to 4:1 (or 8:1, etc, etc)?