Results 1 to 7 of 7

Thread: blending function problem with halo-effects

  1. #1
    Junior Member Newbie
    Join Date
    May 2009
    Posts
    10

    blending function problem with halo-effects

    Hi. I'm currently trying to render some visual links (lines) with a nice halo-effect.

    My lines are produced as quadstrips. What I'm trying to do now is to render the line twice, the second time with a higher width and less alpha.

    This looks OK, but my problem is the following: At the nodes where one line is splitted up into many, the halo get's too opaque. This is because there are many lines on top of each other, so the alpha values are adding up.

    Here is a picture. Or three pictures in one.

    (you should be able to klick on the thumbnail to open it at full size)

    The first picture is without halo, so you can see where the lines split up and what causes the problem. The other two pictures show the unwanted effect, with and w/o comments.

    I hope this gives a good picture of my problem. I want to get rid of this effect or at least reduce it to a maximum. I guess this should be manageable through blending functions. I already tried some, but couldn't get the wanted results.

    Maybe you guys can help me. Thanks!

    P.S.: I also tried the method described in NeHe turoials (lesson 36, radial blurr) but didn't get this to work. There are some problems, because the lines are not drawn at once and... so the described method above is how I want to solve this problem now. I already spent too much time on the render-to-texture approach. Many thanks guys.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Dec 2008
    Location
    USA
    Posts
    134

    Re: blending function problem with halo-effects

    You could use the stencil buffer. Write to the stencil buffer when you add a halo, then when you draw the next one, make sure that you did not already draw a halo there.

  3. #3
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Location
    Watford, UK
    Posts
    1,294

    Re: blending function problem with halo-effects

    Just an idea, using some extensions I have no experience with: glBlendEquationEXT with GL_MAX_EXT . Clear a RGBA FBO to (0,0,0,0). draw the yellow stuff on it with the gl_max_ext blending mode. Draw that fbo's texture onscreen via regular alphablending.

    The stencil approach might not be able to handle some artifacts even if you make it 8-bit with comparison+conditional pass, I think.

  4. #4
    Junior Member Newbie
    Join Date
    May 2009
    Posts
    10

    Re: blending function problem with halo-effects

    Hey guys, thanks for your tipps. I will try these tomorrow and will report back in.
    (Tomorrow because of the fact that I'm european and Champions League Group Stage starts in 30 minutes )

  5. #5
    Junior Member Newbie
    Join Date
    May 2009
    Posts
    10

    Re: blending function problem with halo-effects

    Couldn't get this to work so far. glBlendEquationEXT isn't supported by JOGL (I'm programming in Java and use the JOGL Binding).

  6. #6
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Location
    Watford, UK
    Posts
    1,294

    Re: blending function problem with halo-effects

    If GL_MAX and glBlendEquation (which have been added to core) are inaccessible, then the post-process method is your only way.

  7. #7
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: blending function problem with halo-effects

    The proposed stencil idea will work very nicely to prevent overdraw on the transparent lines. You will have to draw ALL lines of a given transparency with the requisite stencil write and test. Then clear or change the reference value for the next width & transparency.

    Zbuffer would also work.

Similar Threads

  1. Setting blending-function in GLSL
    By hlewin in forum OpenGL: General
    Replies: 4
    Last Post: 08-24-2013, 10:59 AM
  2. Replies: 1
    Last Post: 05-01-2013, 09:37 PM
  3. Blurry glowing halo effects on objects
    By BerlinBrown in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 09-16-2009, 07:11 PM
  4. Blending function for maximum alpha estimation
    By AnselmG in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 01-23-2008, 02:52 AM
  5. multitexturing and blending function
    By Lev in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 05-30-2001, 04:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean