Alpha blend op for deferred transparency

In order to support multiple layers of transparency with refraction, I am rendering normals and color to a deferred buffer, and then combining that with the refracted scene background in a final pass. This is an efficient way to blend multiple layers of transparency together, as you would need when rendering a particle system with heat distortion. You can see some examples here:

I’m trying to determine the correct blend factor for the alpha value in the deferred buffer. I think it should be something like this:

pixel.a = background.a * (1.0 - foreground.a) + foreground.a

Let’s plugin in some numbers:

| background | foreground | final alpha |
| 0.5 | 0.5 | 0.75 |
| 0.25 | 1.0 | 1.0 |
| 0.75 | 0.0 | 0.75 |
| 0.1 | 0.9 | 0.91 |

Those results look correct to me. Is there a Vulkan blend op that uses this equation?

Duh :crazy_face:

colorBlendAttachment[0].srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment[0].dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
colorBlendAttachment[0].alphaBlendOp = VK_BLEND_OP_ADD;