Alpha blending needs to read + compute + write
each pixel instead of being a simple write
. The formula is
new_value = old_value * (1 - alpha) + color * alpha
this is of course much more difficult to do than
new_value = color
Question
From my fledgling experience with OpenGL, I'm seeing performance hits coming from alpha blending especially. I won't show any code samples because it's not particularly relevant. I'm just interested in why exactly alpha blending is an expensive measure when fragments are drawn. Clearly it's an extra operation instead of just writing the fragment shader output to the pixel, but can anyone elaborate on what exactly this operation is? I know I can sift through official documentation, but I'm looking for a quick straightforward explanation.
Solution
Alpha blending needs to read + compute + write
each pixel instead of being a simple write
. The formula is
new_value = old_value * (1 - alpha) + color * alpha
this is of course much more difficult to do than
new_value = color