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

Thread: Alpha test BEFORE fragment procesing

  1. #1
    Intern Contributor
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    94

    Alpha test BEFORE fragment procesing

    Hi; In my app, the alpha channel in difuse textures is used as a mask (like fences, leaves...). When i use

    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER,0.5f);

    with GLSL shaders, it didnt work, all pixels r drawned...but when i use it with nv_reg_combiners or ati_fragment_shader, it works...whats happening?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: Alpha test BEFORE fragment procesing

    Alpha testing happens after fragment processing. You should make sure that the alpha you're outputting is correct.

  3. #3
    Intern Newbie
    Join Date
    May 2005
    Location
    Austria
    Posts
    49

    Re: Alpha test BEFORE fragment procesing

    When I use Alpha Test + GLSL + Pbuffers on my 9600 it needs a lot of time to compute. But if I use a depth buffer with depth test, there is no such performance drop. Why does this happen?
    Alpha test should be the most simplest test (no writing to a depth buffer, ... )

  4. #4
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,979

    Re: Alpha test BEFORE fragment procesing

    I think you should perform alpha test manually...

  5. #5
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,444

    Re: Alpha test BEFORE fragment procesing

    Originally posted by olmeca:
    When I use Alpha Test + GLSL + Pbuffers on my 9600 it needs a lot of time to compute. But if I use a depth buffer with depth test, there is no such performance drop. Why does this happen?
    Alpha test should be the most simplest test (no writing to a depth buffer, ... )
    How much is "lot of time" in this context?

  6. #6
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,444

    Re: Alpha test BEFORE fragment procesing

    Originally posted by Coluna:
    Hi; In my app, the alpha channel in difuse textures is used as a mask (like fences, leaves...). When i use

    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER,0.5f);

    with GLSL shaders, it didnt work, all pixels r drawned...but when i use it with nv_reg_combiners or ati_fragment_shader, it works...whats happening?
    Consider using alpha-to-coverage instead of alpha testing.
    http://www.humus.ca/index.php?page=3D&ID=61

  7. #7
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Jul 2000
    Location
    S41.16.25 E173.16.21
    Posts
    2,609

    Re: Alpha test BEFORE fragment procesing

    excellent as always humus (grrr now ive gotta go and play with this, as if i dont have anuf to do already)

  8. #8
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: Alpha test BEFORE fragment procesing

    Consider using alpha-to-coverage instead of alpha testing.
    And what is the cost of this technique?

  9. #9
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,444

    Re: Alpha test BEFORE fragment procesing

    In the demo it's about 10-15% slower than alpha testing.

Posting Permissions

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