Jump to content
  • Advertisement
Sign in to follow this  
Krisc

Blending ... Semi Transparency...?

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

I can get colorkeying to work so that all of one color is transparent...I am now wondering how to get all of the image to fade out? I am creating a simplistic particle system and would like to fade out the particles. How would I go about doing this in DirectX9?

Share this post


Link to post
Share on other sites
Advertisement
you must modify the alpha value of the D3DMATERIAL9::Diffuse, and set the material to the object

before rendering anything, set these render states to the device :

_device->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
_device->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
_device->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );


I don't know what you are using on for your transparent textures, but you better use alpha channels on the texture in order to make transparent areas (with tga pics)
you must also set texture stage states in order to do alpha operations


// select alpha from alpha channel of the texture
_device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
// select alpha from material
_device->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
// mix these two arguments together
_device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);


to do fade out , just decrease the diffuse alpha value from 1 to 0 on each frame

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!