I'm rendering transparent objects in separate framebuffer then compositing it with opaque one to get final image.
The transparent pass has additive blending:
glBlendFunci(0, GL_ONE, GL_ONE);
so transpareny seems work perfect (I used weighted, blended OIT). Now I have problem if I set all surfaces' alpha to 1. Transparency works if alpha is between 0 and < 1 but not work as expected if alpha = 1. In this case (alpha=1) transparency surface seems opaque on opaque surface[s], but it also appears as semi-transparent on transparent surface[s].
I think additive blending causes this issue/artifact, how can I fix this? I want to transparent surfaces appear opaque if alpha is set to 1 in fragment shader. I can't disable blending because it will disable whole transparency process.
What I want to do is control blending in fragment shader or per-fragment blending; is this possible? Overriding old values of some fragments in framebuff e.g. to zero (0,0,0,0) could also help to fix/control blending, because I can put some values in blend equation to get what I want.
I'm asking this because maybe there is a way to simulate this which I don't know yet. Maybe I can fix this with another rendering passes/targets, I will give a try, any help would be appreciated
The first image is rendered with alpha = 0.5 and the second one is rendered with alpha = 1.0. As you can see transparency is still active among transparent objects. The pink plane overrides Suzanne mesh and bottom plane but not sphere :( Both sphere and pink plane are rendered in transparency pass.