Archived

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

Alpha test and diffuse alpha blending at the same time?

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

I use an alpha test to mask a 2D sprite in my game engine. I want to make it so a general alpha transparency can also be used (using the alpha channel in the color attribute of each vertex). How would I go about doing this? Once I enable diffuse alpha blending, it disables alpha testing. Here are my code segments: // To enable diffuse alpha blending g_pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); g_pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); // To enable alpha testing for masking purposes g_pd3dDevice->SetRenderState(D3DRS_ALPHAREF, (DWORD)0x00000001); g_pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); g_pd3dDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); Any hints would be helpful, Thanks! -- Dan (flaXen)

Share this post


Link to post
Share on other sites