Sign in to follow this  
navid

black smoke particles using blending?

Recommended Posts

hi all. i have designed a smoke particle system using Directx 9.0. i use a ".png" file as the texture for my point sprites. the .png file background is white which is transparent & the smoke part of the texture is orange. the smoke particles are fine using any color except black. my problem is that i can't render black particles. they all are transparent. what i want to do is to render black smoke which will fade over time. my blending config. is : device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE); device->SetRenderState(D3DRS_ALPHABLENDENABLE, true); device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); device->SetRenderState(D3DRS_DESTBLEND,2); any help would be great.

Share this post


Link to post
Share on other sites
Your blending is SRC*SRC_ALPHA + DEST. If source is black, then nothing is added to dest, so it's in effect transparent. You can't make the image darker when adding to the dest (using D3DBLEND_ONE for D3DRS_DESTBLEND). You have to multiply the background by something. I think that SRC * D3DBLEND_ZERO + DEST * D3DBLEND_INVSRCALPHA will work.

By the way, I'd suggest that you always use the constants defined by Direct3D, such as D3DBLEND_ONE, instead of numbers. It's much clearer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this