black smoke particles using blending?
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement