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


D3DTOP_BLENDDIFFUSEALPHA + lighting, possible?

Recommended Posts

Endurion    5411
Hi all, i''m working on a little game project of mine, displaying a simple iso-based map. I''m using two texture stages for blending two possible layers into each other using D3DTOP_BLENDDIFFUSEALPHA. Set up like this:
    theApp.SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
    theApp.SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE );
    theApp.SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
    theApp.SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG2 );
    theApp.SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );

    theApp.SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
    theApp.SetTextureStageState( 1, D3DTSS_COLOROP,   D3DTOP_BLENDDIFFUSEALPHA );
    theApp.SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );
    theApp.SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
    theApp.SetTextureStageState( 1, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1 );
This works all fine and dandy. Until i wanted to add lighting. After enabling lighting the vertices, which have their alpha set to 0 will be black/ambient colored. Is it possible to get the basic lighting working, blending two textures and still use only two stages? If it''s not possible, is it somehow possible to have a working diffuse color (for implementing fake lighting), since the alpha is used for blending? Many thanks in advance, Endurion

Share this post

Link to post
Share on other sites