Jump to content
  • Advertisement
Sign in to follow this  
barakus

Blending Textures

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

If you intended to correct an error in the post then please contact us.

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


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


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


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


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!