Alpha test and diffuse alpha blending at the same time?
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)
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
http://www.gamedev.net/community/forums/topic.asp?topic_id=44040
--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement