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 8 of 8

Thread: Weighted average for transparency

  1. #1
    Intern Contributor
    Join Date
    Feb 2005
    Location
    Israel
    Posts
    84

    Weighted average for transparency

    Hi,

    I want to use the weighted average as described in the latest Nvidia OpenGL SDK in the 'Dual Depth Peeling' example but it seems that this technique can only work for 1 object, if I want different transparency for different objects, some of them opaque, it will not work as it always blend based on averages.

    Is there any way to use it in such a way?

    Thanks,
    Ido
    Ido Ilan

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,401

    Re: Weighted average for transparency

    Haven't looked at that particular example yet. All I can say with any certainty is that transparency isn't yet a done deal in realtime graphics, no matter how you slice it (no pun intended).

    Can you give us a quick rundown of the technique, or better still do you have a link to a relevent document handy? It's saturday, and I for one am a shiftless layabout on saturdays.

  3. #3
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,006

    Re: Weighted average for transparency

    I think it is this paper:
    http://developer.download.nvidia.com...pthPeeling.pdf

    I would render all the opaque geometry first, then only use this technique with a existing z-buffer to render transparent objects.

  4. #4
    Intern Contributor
    Join Date
    Feb 2005
    Location
    Israel
    Posts
    84

    Re: Weighted average for transparency

    Thanks for the replays,

    I would render all the opaque geometry first, then only use this technique with a existing z-buffer to render transparent objects.
    I don't think this will work, to use the weighted average the depth test must be disabled, it average everything based on it alpha and because the geometry is not sorted I can't use the z-buffer.

    I thought about saving the min/max z-buffer and use it to combine the scene in the final stage but I don't think it is good because I will get incorrect result.

    Any suggestion?

    Thanks,
    Ido
    Ido Ilan

  5. #5
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,006

    Re: Weighted average for transparency

    Quote Originally Posted by Ido Ilan
    I don't think this will work, to use the weighted average the depth test must be disabled
    Depth writing must be disabled, but depth testing is fine to have on. (not I have not implemented this myself, but am 99% sure from looking at the paper)

  6. #6
    Intern Contributor
    Join Date
    Feb 2005
    Location
    Israel
    Posts
    84

    Re: Weighted average for transparency

    Ok,

    So I draw all opaque objects into the fbo using depth write+test, then draw all transparent objects using the weighted average with depth test enabled but depth write disabled.
    The fbo will have 3 attachments, two colors: sum of colors, number of fragments to average and one depth attachment.

    I must draw all my objects into the fbo and I can't use the back buffer.
    Is that correct?

    Ido
    Ido Ilan

  7. #7
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,006

    Re: Weighted average for transparency

    Without actually implementing it, it seems correct.

  8. #8
    Intern Contributor
    Join Date
    Feb 2005
    Location
    Israel
    Posts
    84

    Re: Weighted average for transparency

    Hi,

    I've implemented it, very easy, it works ok, thank you for the help.

    I see two problems with this approach:

    1. When I change an object from opaque to transparent there is a sharp drop in "color"/"lighting" as you see only front faces and next you see the blending. (if the blending was based both on alpha factor and z factor it could be better).
    2. you loose a lot of details, If its only one object it looks ok, but when several transparent on screen you loose many colors.

    Next I will sort all the triangles in the scene and compare the result, currently the engine sort the triangles per object, this work very well and fast(bucket sort based on 2048 z slices) but have problems with contained transparent objects.

    Ido
    Ido Ilan

Posting Permissions

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