g_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_DESTALPHA);
g_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ZERO);
g_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
Question on alpha blending
Hi. I'm trying to draw my polygons blended with the alpha value stored in the frame buffer, the render states I'm using are:
The polygons I'm drawing have alpha=0, and I'm clearing the frame buffer with D3DCOLOR_ARGB(0,0,0,0). My problem is the polygon still shows up in screen.
Correct me if I'm wrong, but if the alpha formula was:
Final Color = (ObjectColor * SourceBlendFactor) plus (PixelColor * DestinationBlendFactor)
My dest blend factor is zero. So the final color only depends on the object color blended with the source blend, which is in fact the dest alpha (the framebuffer), which I cleared to be zero as well. So the object shouldn't be appearing in screen, right?
It seems to me as if the framebuffer was not correctly cleared and still had 1.0 as alpha value. If I use D3DBLEND_INVDESTALPHA the object disappears.
Any ideas of what I could be doing wrong?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement