Jump to content
  • Advertisement
Sign in to follow this  
chiyuwang

blending of alpha channel

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

I am wondering is it possible to use different blend mode for blend rgb and alpha. for example use following for alpha BlendOp = Add; SrcBlend=SrcAlpha; DestBlend=One; use following for color rgb: BlendOp = Add; SrcBlend=SrcAlpha; DestBlend=InvSrcAlpha; [Edited by - chiyuwang on January 22, 2009 3:44:40 AM]

Share this post


Link to post
Share on other sites
Advertisement
You can achieve this (and much more) by using the programmable pipeline (pixel shader in your case).

Share this post


Link to post
Share on other sites
Pixel shaders have nothing to do with the blending stage, ignore the above post.

Yes, it's possible.

D3DRS_SEPERATEALPHABLENDENABLE enables this mode.

D3DRS_SRCBLENDALPHA, D3DRS_DESTBLENDALPHA, and D3DRS_BLENDOPALPHA control how to blend.

You must check a caps bit to check for support. Not all cards support it. For cards without support you can use D3DRS_COLORWRITEENABLE to write to RGB in one pass, and just ALPHA in another pass. Obviously this isn't ideal.

Also, just so you're aware, if you ARE using shaders... I tried using the alpha versions of the blending state once, in an pass block of an HLSL file, and they states were NOT set correctly. It just set the non alpha versions of the state. It's been a while since then, and it may have been fixed, but at the time you could only set these states in code.

Share this post


Link to post
Share on other sites
LOL I'm sorry.

Personal note to myself: don't think about five other things when answering a question on a technical forum :(

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!