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

Thread: Early Z rejection

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2004
    Posts
    11

    Early Z rejection

    Hi,

    I wrote a simple application to test the effect of early-z rejection in NV hardware.

    It simply draws 20 textured quads(one behind
    another) with orthographic projection.

    The application is fill limited hence
    drawing those quads in front-to-back and
    back-to-front order should make a difference.
    And it does.The difference is,though,pretty small.

    Test details :
    Quadro FX 500 card, 44.96 driver, Suse Linux 9.1.

    512x512 window size:
    Back to front : ~193 fps
    Front to back : ~210 fps

    1024x768:
    BtoF : 66fps
    FtoB : 73fps

    I'd like to hear experiences of others
    to go on exploring early-z rejection
    optimisations.Above results didn't seem so
    impressing to me and it doesn't worth
    the amount of work I need to implement this
    in our application.Is this what we can
    expect from early-z rejection or do I miss
    something?

    thanks

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

    Re: Early Z rejection

    from what ive seen a while ago on my gffx5200 doing a first pass laying down z values and then drawing the scene normally gave me only ~10% speed increase (this with resonably expensive shaders).
    * now this is with resonably expensive shaders with simplier stuff the benifit is gonna be less
    * drivers/hardware change thus this 10% values is prolly more now

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

    Re: Early Z rejection

    200 fps does NOT qualify as severely fill limited. Also, fill limited can mean many things. There is a per-fragment overhead even with early Z reject. If your texturing operation is very simple, then the savings aren't that much.

    I would test this by rendering an object sampling from 8 textures, each with ANISOTROPIC filtering at level 8 or more, and making sure the texture coordinates are such that minification actually happens.

    Also, make sure you clear the color and Z buffers together, and don't enable blend or alpha test. If you get that wrong by mistake, it'll turn off early Z.

    Get your back-to-front case down to like 20 fps while bound on fragment processing, then the front-to-back case might speed up more.
    "If you can't afford to do something right,
    you'd better make sure you can afford to do it wrong!"

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Posts
    748

    Re: Early Z rejection

    Your test is not good enough: add some complex per-pixel calculations, like normal+gloss mapping, and you'll see a much higher difference.

    I was myself quite amazed when i saw that early Z rejection made *a lot* of difference in my app some time ago. I don't remember the exact number but it was like 30-50% performance improvement.

    Y.

  5. #5
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: Early Z rejection

    Originally posted by jwatte:
    and don't enable blend or alpha test. If you get that wrong by mistake, it'll turn off early Z.
    Why is this so?
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

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

    Re: Early Z rejection

    Originally posted by Ysaneya:
    I was myself quite amazed when i saw that early Z rejection made *a lot* of difference in my app some time ago. I don't remember the exact number but it was like 30-50% performance improvement.Y.
    was this an actual program, or a benchmark, as from what ive seen the performance gain wasnt that much (+ i was shader limited), perhaps time for me to do a couple more recent tests

  7. #7
    Junior Member Newbie
    Join Date
    Oct 2004
    Posts
    11

    Re: Early Z rejection

    My purpose with the test is to see
    if I can optimise an existing application
    with depth sorting.

    - 1024x768 resolution
    - ~60hz refresh
    - single textured geoemtry
    - A lot of overdraw
    - Anisotrpoic filtering

    characterizes my case quite well.

    My initial post did not include results
    with Aniso enabled but they do not change
    much with it.

    Maybe if I have more complex fragments
    I can observe a better gain,though this wouldn't
    characterize my application.

Posting Permissions

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