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: Subtractive blending

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2000
    Posts
    6

    Subtractive blending

    Hi,

    I'm trying to use subtractive blending on a GE Force 2 with the Linux Nvidia drivers.

    The basic problem is that I want to subtract some alpha-only geometry from the on-screen image. I'm doing this in several passes with jittering to get some AA, so a simple GL_ONE_MINUS_SRC_ALPHA blend function won't work for me.

    I'm currently using:
    Code :
    glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT);
      glBlendFunc(GL_ONE, GL_ONE);
     
      for(each pass) {
        glTranslatef(jitter[i].x, jitter[i].y, 0);
        // render alpha-only image
      }
    Unfortunately, I see absolutely no effect from this. If I use a glBlendFunc(GL_ONE, GL_SRC_ALPHA) I see an inverted view of what I expect, but I can't get a positive view. glGetError isn't showing anything wrong.

    Any hints?

    Thanks,
    J

  2. #2
    Junior Member Newbie
    Join Date
    Dec 2000
    Posts
    6

    Re: Subtractive blending

    Hmm... replying to myself.

    Well, I've worked out part of my problem. As I said, it's an alpha-only image, with the color components set to 0. So I'm not seeing any result, because it's only affecting the framebuffer alpha channel.

    So, my new attempt looks like:
    Code :
      glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT);
      glBlendColorEXT(1., 1., 1., 1.);
      glBlendFunc(GL_CONSTANT_COLOR, GL_ONE);
    ...but this still does nothing for me. My understanding is that GL_CONSTANT_COLOR should scale my BlendColor (1, 1, 1, 1) by the alpha (as generated by the rendering prims), and then calculate dest = dest - (const_color * src_alpha).

    What am I missing?
    J

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Sep 2000
    Location
    Santa Clara, CA
    Posts
    1,463

    Re: Subtractive blending

    Originally posted by jsgf:
    dest = dest - (const_color * src_alpha).
    No, what you've done is dest = dest - src.

    I'd suggest an intensity texture and going back to ONE,ONE.

    - Matt

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,840

    Re: Subtractive blending

    whats your clear color? when you have it to 0, then it doesnt change anything.. second make sure your texture-alpha values are correct.. and even with the constantcolor you cant see anything..
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

Posting Permissions

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