Skip to main content
GameDev.net gamedev.net
🔒 Locked

Blending Textures

Started by barakus Jan 7, 2005 at 5:11 AM 3 replies 450+ views
Original Post
barakus
barakus
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?
CoreWill
CoreWill
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.
------------------------------The Great Nature!
barakus
barakus
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?
CoreWill
CoreWill
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.
------------------------------The Great Nature!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.