Jump to content
  • Advertisement
Sign in to follow this  
tokaplan

That same halo artifact again

This topic is 4043 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

Hi everyone, I've ran into the halo artifact problem, which, as I found out, is a very common one. I've read several threads on the subject (including "Avoiding black borders..." - http://www.gamedev.net/community/forums/topic.asp?topic_id=453401 and TomF's blog on premultiplied alpha http://home.comcast.net/~tom_forsyth/blog.wiki.html ) but still I can't find out what I'm doing wrong. This is what I'm doing in my sample application. The textured quad is drawn onto a black background. Texture's upper half is red, the bottom half is green. Alpha channel is all white except of a narrow stripe along the top edge. I'm using premultiplied alpha during rendering, so the stripe is also present in all color channels. ftp://82.148.20.209/Bug/Color.jpg ftp://82.148.20.209/Bug/Alpha.jpg This is the way I do the rendering g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, true ); g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE ); g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); g_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE ); g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR ); g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR ); g_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP ); g_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP ); Texture wrapping is disabled. I get the following result ftp://82.148.20.209/Bug/Result.jpg Zoomed in on the top of the quad ftp://82.148.20.209/Bug/Result_zoom.jpg As you can see, there's a green stripe along the upper edge of the quad. I understand this can happen if the linear filter samples the opposite side's pixel, but it should not happen since texture addressing mode is set to CLAMP and texture wrapping is disabled. Wiping off alpha from the bottom of the texture makes the green stripe on the top disappear. Can anybody explain this? Why is texture being tiled? P.S. The stripe grows wider if I increase the quad's height. Thank you

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!