Advertisement Jump to content
Sign in to follow this  

How can I achieve this effect...

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

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

Share this post

Link to post
Share on other sites
Original post by mrmrcoleman
[...]such as the TFACTOR[...]

Why not actually *use* TFACTOR ;)

[source lang=cpp]
float f = 0.5f;

pDev->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pDev->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR );
pDev->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE );

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!