Jump to content
  • Advertisement
Sign in to follow this  
EliT

difference between multiplicative and subtractive blending?

This topic is 4809 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've been looking around a bit, but I'm having trouble finding a clear answer anywhere. What exactly is multiplicative alpha blending? I think its src color * dest color, which you can do with a src factor of zero and a dest factor of src color, right? that confuses me though - the guy who taught me alpha blending said those parameters were subtractive blending - so what's going on here? thanks in advance for your help. Eli

Share this post


Link to post
Share on other sites
Advertisement
Src * Dest is definitely multiplicative blending. To a beginning graphics programmer, it may be confused with subtractive blending because multiplying the color values effectively darkens the result, if both arguments are in 0...1 range (very common).

Subtractive blending actually is Src - Dest, and it also usually darkens the image (unless you have negative dest parameter).

EDIT: When talking about the framebuffer multiplicative blending, the source blending function should be D3DBLEND_DESTCOLOR, destination blend function should be D3DBLEND_ZERO and the blening operation be D3DBLENDOP_ADD. This effectively multiplies the source color with the framebuffer color, and adds zero (because we don't need the destination color as explicit source color). This is effectively the same as src = zero and dest = srccolor.

[Edited by - Nik02 on September 15, 2005 3:33:21 AM]

Share this post


Link to post
Share on other sites
so subtractive blending is a different op entirely? is it src color * src alpha - dest color * inv src alpha then?


and for multiplicative blending, is there any difference ( i know theres not one mathematically, but performance-wise ) between doing

src blend * 0 + dest color * src color and

src blend * dest blend + dest color * 0?

Share this post


Link to post
Share on other sites
You can enable subtractive framebuffer blending as follows: Blendop = subtract, src = one, dest = one. To subtract destination from source, use inverse subtract blendop.

As for which multiply is faster: it could depend on the hardware - there is a possibility that the operation is short-circuited depending on whether either source or destination is zero or one. Haven't profiled this particular feature, though, as I rarely need exotic framebuffer blends in my programs.

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!