# Blending Textures

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

## Recommended Posts

This has probably been answered before, but search has been down for a while so i figured i might as well ask. When applying alpha blending on my textures, i get an outline around the image(im doing a texture quads 2D engine). If i set the filtering to point instead of linear, its all fixed, but i need the linear filtering for it to look good. Any ideas?

##### Share on other sites
yesterday, i had the same problem.
i render a model to a texture, then render a billboard with this texture
if i use linear filter, there is a outline around the image, like cartoon render
finally, i use alpha-testing to solve the problem.

any better method, plz post.

##### Share on other sites
By Alpha testing, what do you mean? For my alpha, i have the following code that is called when the device is created:
p_D3DDevice->SetRenderState(D3DRS_LIGHTING,false);		p_D3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE,true);		p_D3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);		p_D3DDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);		p_D3DDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);		if(filtering)		{			p_D3DDevice->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR);			p_D3DDevice->SetSamplerState(0,D3DSAMP_MIPFILTER,D3DTEXF_LINEAR);			p_D3DDevice->SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_LINEAR);		}		else		{			p_D3DDevice->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_POINT);			p_D3DDevice->SetSamplerState(0,D3DSAMP_MIPFILTER,D3DTEXF_POINT);			p_D3DDevice->SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_POINT);		}

should i add anything to it?

##### Share on other sites
you could use alpha-testing like this:

PD3DDEVICE->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
PD3DDEVICE->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
PD3DDEVICE->SetRenderState( D3DRS_ALPHAREF, 10 );

10 is the test value, you can adjust it until the outline is not clear.

##### Share on other sites
oh thanks man i set it to 255 and it did the job!
Thank you so much!