How can I achieve this effect...

Started by
1 comment, last by mrmrcoleman 18 years, 8 months ago
Hello. I have a texture which is drawn with these states:

GlobalDirect3D9Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
GlobalDirect3D9Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCCOLOR);
GlobalDirect3D9Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR);

GlobalDirect3D9Device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
GlobalDirect3D9Device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
GlobalDirect3D9Device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);

Is there some programatic way to fade this to invisible? Or even a fade to black would do. I need to be able to achieve this without using any alpha. For example, is there some way to modulate the first colorarg with an external number, such as the TFACTOR variable? Thanks for any pointers on this one. Mark
Advertisement
Quote:Original post by mrmrcoleman
[...]such as the TFACTOR[...]


Why not actually *use* TFACTOR ;)

[source lang=cpp]float f = 0.5f;pDev->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_COLORVALUE(f,f,f,f) );pDev->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );pDev->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR );pDev->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE );
Hmm, I tried that and it didn't work. Just tried it again and bingo. It's only Monday and I'm going downhill already ;(

Mark

This topic is closed to new replies.

Advertisement