Selective additive blending?

Hi all,

First post :slight_smile:

How do you correctly render a particle effect, which have particles that are blended additively, onto an image background?

The particles are also blended additively to the background, how can avoid that? (i.e blend them additively to each other but not to the background as well)

Actually, I have additional constraints:

I’m working on a 2D game for mobile devices (OpenGL ES 2.0) that is rendered using 8 layers as follows:

  1. Background #1 (parallax scrolling)
  2. Background #2 (parallax scrolling)
  3. Background #3 (parallax scrolling)
  4. Particle Effects Layer #1
  5. Game Objects
  6. Particle Effects Layer #2
  7. UI
  8. Particle Effects Layer #3

If FBO is the only way to go to solve the blending problem, I’d have to create 8 textures that have the screen dimensions, and render each layer separately to the FBO. Then rendering the 8 textures to the window frame buffer which is too heavy on memory. I can alternatively use a single texture but that’ll require 16 FBO switches…

Any tips?

From your description, it seems you only need to use 1 FBO for each special effects layer. Then blend that non additively.
But why do you need to add-blend particles between themselves and not with the background ? Any real reason ?

[QUOTE=ZbuffeR;1241883]From your description, it seems you only need to use 1 FBO for each special effects layer. Then blend that non additively.
But why do you need to add-blend particles between themselves and not with the background ? Any real reason ?[/QUOTE]

1 FBO for each particle layer means 3 FBOs and 6 FBO switches… it seems like a big penalty (memory, performance) to do it for just a few particle effects, I hoped that there is some kind of other solution, what everybody do?

I attached an image that illustrates the problem.

This sounds like a simple problem with many solutions that would not be intensive.

Maybe if you more precisely explained your situation (and problems) a best answer would be very easy to come by.

For instance. Do you want the effect on the right to look like the one on the left?

And can you just draw your 1, 2, 3, 4 (and so on) in that order (over one another) ?