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\$
6
  • \$\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\$ Commented Nov 14, 2017 at 12:51
  • \$\begingroup\$ I'd still need to combine the textures in the fragment shader, right? \$\endgroup\$ Commented Nov 14, 2017 at 16:02
  • \$\begingroup\$ Unless I'm misunderstanding what you've just said. :) \$\endgroup\$ Commented Nov 14, 2017 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\$ Commented Nov 14, 2017 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\$ Commented Nov 14, 2017 at 19:41

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.