0

While experimenting with the XNA BlendState class, I found that it has two state groupings:
One for Alpha Blending and one for Color Blending (as the framework calls it).

The mutable members of each group are termed *BlendFunction, *DestinationBlend, and *SourceBlend
(where * is replaced by either Alpha or Color).

I understand how to blend two RGBA colors, and I assume that's what the Color Blending function are for


What's the purpose of this 'alpha blending' that XNA apparently supports? How does it work?

Aren't all 4 color components, including the alpha value, modified by Color Blending anyway?

Christian Rau
  • 45,360
  • 10
  • 108
  • 185
Griffin
  • 2,399
  • 7
  • 48
  • 83

1 Answers1

2

Yes, all four components are blended by Color blending. Alpha blending lets you set a custom blending that will override the Color blending for just the alpha channel.

So, if you want the same blending function for all channels there is no need to set the alpha blending to any different. It's simply a customization option for using a different blend on the alpha channel.

Dervall
  • 5,736
  • 3
  • 25
  • 48
  • Do you have any examples of when/how I could apply this? – Griffin Aug 29 '12 at 06:33
  • Would depend on what effect you're trying to achieve. On the top of my head, nothing really comes to mind. Remember that these all are basically convenience functions for writing the shaders yourself or things that are supported natively by old hardware that does not do shaders themselves. Using shaders would probably be the more modern way of doing things as long as you know the underlying hardware will support it, which it should be given that shaders are ancient news by now. – Dervall Aug 29 '12 at 06:38
  • @Dervall Actually blending is still one of the few things that cannot be done using programmable shaders, yet. – Christian Rau Aug 29 '12 at 09:18