Archived

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

flaXen

Alpha test and diffuse alpha blending at the same time?

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
Previous posters wanting to do stuff like this found my answer helpful, you may too:

http://www.gamedev.net/community/forums/topic.asp?topic_id=44040

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites