0
\$\begingroup\$

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?

Thanks!

\$\endgroup\$
  • \$\begingroup\$ Is there a problem with drawing the first layer, then the second, then the third, and so on to a screensized quad as textures? \$\endgroup\$ – Bálint Nov 14 '17 at 12:51
  • \$\begingroup\$ I'd still need to combine the textures in the fragment shader, right? \$\endgroup\$ – Pateman Nov 14 '17 at 16:02
  • \$\begingroup\$ Unless I'm misunderstanding what you've just said. :) \$\endgroup\$ – Pateman Nov 14 '17 at 18:20
  • \$\begingroup\$ You don't have to do that, if you simply render all of them separately one after the other as textured quads on top of each other, but it's possible I'm the one who got confused \$\endgroup\$ – Bálint Nov 14 '17 at 18:27
  • \$\begingroup\$ Let me clarify, because I feel like we're missing each other now. I draw each layer to a separate FBO (game menus are in a separate layer, transparent objects in another, and opaque objects in another). Let's say I applied some post-processing to the last layer (e.g. grayscale). Now I want to take all three FBOs and kinda merge them together like you'd do with layers in PS in order to draw them on the screen. Does that make sense now? :) \$\endgroup\$ – Pateman Nov 14 '17 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.