Sign in to follow this  

Question on alpha blending

Recommended Posts

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:
g_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ZERO);
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?

Share this post

Link to post
Share on other sites
Original post by Namethatnobodyelsetook
I'm guessing your backbuffer is X8R8G8B8 not A8R8G8B8.

Yep, that was it. Really stupid for me using an old initialization code and assuming it was correct. Thanks!

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