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:
https://www.ultraengine.com/community/blogs/entry/2573-advanced-transparency-and-refraction-in-vulkan/
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?