Archived

This topic is now archived and is closed to further replies.

BeanDog

DX9-bilinear texture filtering bleeds around edges

Recommended Posts

I render textures to quads, with uv coordinates from (0,0) to (1,1)--the whole texture. When I turn on texture filtering: m_pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); m_pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); I see the very bottom pixel of the texture blended into the top line of the quad, and likewise for all other sides. Aside from leaving a buffer around the edges of all of my textures or turning off filtering, is there a way to turn this "wrapping" filtering off? ~BenDilts( void );

Share this post


Link to post
Share on other sites
add half a texel: (1 / x) * .5, x is the resolution, to 0,0 and subtract half a texel from 1, 1. that will make the edge of the texture the center of the edge texel.

Share this post


Link to post
Share on other sites
Better yet, set the U and V addressing modes to CLAMP (D3DSAMP_ADDRESSU and D3DSAMP_ADDRESSV to D3DTADDRESS_CLAMP) and you can not worry about the edges bleeding. Note that you must keep things in the range of (0,1) in both U and V dimensions when using this addressing mode.

Share this post


Link to post
Share on other sites