Jump to content
  • Advertisement
Sign in to follow this  
mrmrcoleman

How can I achieve this effect...

This topic is 4847 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
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 );


Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!