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

Thread: zbuffer notice....

  1. #1
    Intern Contributor
    Join Date
    Aug 2000
    Location
    Epinay sur Seine, France
    Posts
    94

    zbuffer notice....

    Hi,

    (I have a celeron 416/geForce II MX 32, test resolution 800x600x32)

    I'm on OpenGL learning curve and lately i've found that drawing 480 gouraud cubes at THE SAME place actually kills the frame rate : 3/4/5 FPS.
    Drawing those same cubes at DIFFERENT places is, on another side, safe for the frame rate : 75 FPS.

    Tell me if i'm wrong : what kills the frame rate is, in this case, zbuffer test. If the camera is close to the 480 cubes at the same place then there may be chance that there will be nearly 800x600x480 zbuffer tests for ONE display !!

    Am i clear ??
    One life for hate , one eternity for love [img]/forum/images/%%GRAEMLIN_URL%%/smile.gif[/img]

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,258

    Re: zbuffer notice....

    Trust me, but I think the zbuffer test is made for each fragment anyway. This sounds very strange to me.
    - Michael Steinberg

  3. #3
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,258

    Re: zbuffer notice....

    Oh, did you mean with at different places that they were still all visible? Which percentage of screen is drawn in either case?
    - Michael Steinberg

  4. #4
    Intern Newbie
    Join Date
    Oct 2000
    Location
    Toronto, Ontario, Canada
    Posts
    33

    Re: zbuffer notice....

    I am trying to optimize the drawing of my scene and I've run into the same problem.

    If I draw the same cube 100 times onto itself my fps is very low. If I draw it 100 times at different locations the fps is much higher.

  5. #5
    Intern Contributor
    Join Date
    Aug 2000
    Location
    Epinay sur Seine, France
    Posts
    94

    Re: zbuffer notice....

    Well the fact was that, obviously, if you fill nearly all the screen something like 480 times the screen in ONE frame you could have A LOT OF zbuffer tests that would actually kill your framerate....

    This may seem obvious for many coders, but it takes me 2 day of coding to understand this simple law
    One life for hate , one eternity for love [img]/forum/images/%%GRAEMLIN_URL%%/smile.gif[/img]

  6. #6
    Intern Newbie
    Join Date
    Oct 2000
    Location
    Toronto, Ontario, Canada
    Posts
    33

    Re: zbuffer notice....

    I don't think that explains the drop in fps, though. The depth test is performed in any event, whether there's an object rendered at a specific location or not.

    In fact, if you draw the same object over itself 400 times OpenGL performs 1 test for the incoming object, not 400. There really should be no difference if the objects are in the same place or scattered around the scene.

    I've run a lot of tests and I found that most of the drop (in my case it is about 25%) is due to anti-aliasing when the objects are rendered at the same location.

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

    Re: zbuffer notice....

    try using an orthogonal projection matrix and then draw your cubes

  8. #8
    Intern Newbie
    Join Date
    Nov 2000
    Posts
    36

    Re: zbuffer notice....

    maybe also try disabeling the Depth Test and note what the diff is (of course it will be faster but by how much?)

  9. #9
    Intern Contributor
    Join Date
    Aug 2000
    Location
    france
    Posts
    89

    Re: zbuffer notice....

    U'r 100 cubes are all the same color ??

    If yes, try to put different colors to different cubes and let see if it switches from a color to another one. I don't know why u draw hundred times the same cube at the same place but you shouldn't... Maybe the depth buffer test look with an offset wich pixel is in front of wich another one (so if they are at the same Z, it must be difficult)

    Was it clear (i'm not sure)

  10. #10
    Intern Contributor
    Join Date
    Aug 2000
    Location
    france
    Posts
    89

    Re: zbuffer notice....

    ooops i forgot to mention something, what function do you use as a depth func ??
    If it's GL_LESS, try GL_LEQUAL...

Posting Permissions

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