Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Selective additive blending?

  1. #1
    Newbie Newbie
    Join Date
    Aug 2012
    Posts
    2

    Selective additive blending?

    Hi all,

    First post

    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?

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655
    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 ?

  3. #3
    Newbie Newbie
    Join Date
    Aug 2012
    Posts
    2
    Quote Originally Posted by ZbuffeR View Post
    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 ?
    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.


  4. #4
    Member Regular Contributor
    Join Date
    Jan 2005
    Location
    USA
    Posts
    433
    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) ?
    God have mercy on the soul that wanted hard decimal points and pure ctor conversion in GLSL.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •