I have three different layers in which my scene is organized, meaning I can place different entities in different layers. The layers are rendered in order, let's call them LAYER_1, LAYER_2, and LAYER_3.
Each layer is rendered to a separate FBO that has a color attachment (texture) and a depth attachment (an RBO for now, didn't need to sample it in the shader just yet). Each layer can have different post-processing effects applied to it or none at all.
Just for clarity, maybe let me describe a simple use case for that setup: I want to render UI elements on top of the scene. I don't want any post-processing to occur on the UI layer, only the scene (for example, bloom).
Now what I want to do is to get the output of the three layers and draw them to a single quad. Getting the output is the easy part - it's basically those three color attachments that I can sample in the fragment shader. But how do I actually combine the results?