Sign in to follow this  
orphankill

White Outlining in Textures

Recommended Posts

orphankill    122
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 this post


Link to post
Share on other sites
Cantos    212
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 this post


Link to post
Share on other sites
jollyjeffers    1570
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 this post


Link to post
Share on other sites
orphankill    122
Quote:
Original post by Cantos
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
*** Source Snippet Removed ***

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


Didn't work.

Quote:
Original post by jollyjeffers
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.


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 this post


Link to post
Share on other sites
jollyjeffers    1570
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 this post


Link to post
Share on other sites
orphankill    122
Still haven't fixed the border problem, but...

Quote:
Original post by jollyjeffers
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.


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)?

Share this post


Link to post
Share on other sites
jollyjeffers    1570
You need to set D3DSAMP_MIPFILTER to be D3DTEXF_LINEAR for trilinear - it's just linear filtering between mip levels. Normal bilinear filtering just takes the best mip level rather than a potential blend of two.

hth
Jack

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this