문제

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.

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top