Sign in to follow this  

DX HLSL + Alpha Blending! Raagh!!

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

Haha, hello everyone, To make a long story short, I render an image onto a full-screen screen-space quad and run it through a shader that modifies the returned alpha in the pixel shader. I can't get it to blend with the buffer that is already there though. I do device-setrenderstate and enable alpha blending with D3DRS_ALPHABLENDENABLE,TRUE and D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA and D3DRS_SRCBLEND,D3DBLEND_SRCALPHA but nothing happens. It is just using the output color. one thing to node is I am using a seperate render-target than the standard BB. Do I need to use something else than setrenderstate after I setrendertarget??? What is up? Thanks a bunch. I apologize for my bad grammar but I am in a rush :D! Stephen Timothy Cooney

Share this post


Link to post
Share on other sites
In addition, Alphablending will only work on certain pixel formats. For example all 32Bit float formats don't support alphablending at all, and 16Bit float formats don't support alphablending except for rather new gfx boards. To my knowledge, 16Bit float alphablending is supported starting from the NVidia GeForce 6 series and the ATI Radeon X1000 series. If you use a custom rendertarget and expect the blending to happen there, you might want to check the pixel format of that rendertarget

Share this post


Link to post
Share on other sites
I fixed it :D.

Real quick though, the RT does not need to support alpha blending. Even more so, when the blend method is ZERO ZERO :p or SrcAlpha/InvSrcAlpha it should be fine. Neither of those even use the destination buffer's alpha.

The problem was in the .FX file. The technique (I was extending someone's code so I was not aware, dumb me) was setting AlphaBlendEnable = False. Inevitably, this killed it... I just had to modify the technique part of the .fx file and everything is pretty!

I was going to reply and say I fixed it yesterday but my post was so far back I didn't think anybody would see it >_>. doh

Thanks everyone,
Stephen Timothy Cooney

For Reference the RT format was X8R8G8B8 and I'm on a 7950 (I believe).

Share this post


Link to post
Share on other sites

This topic is 3845 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.

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