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: How to solve the "sawtooth" shape?

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2002
    Posts
    18

    How to solve the "sawtooth" shape?

    Hi,my teacher,

    When I draw two intersection surfaces, I found that there is a visual error occured in intersection lines of the surfaces,and the shapes look like "sawtooth" from different observed angle.
    How to solve this problem, or when I draw two intersection objects, I hope there is smooth in intersection.

    thanks

    student

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    The Round Table at Camelot
    Posts
    1,537

    Re: How to solve the "sawtooth" shape?

    I think what you're describing is called "Z-Fighting." Check the FAQ on this site about this.

    -SirKnight
    -SirKnight

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    San Diego, CA, USA
    Posts
    769

    Re: How to solve the "sawtooth" shape?

    Yes, what he is describing are artifacts due to the finite precision of the depth buffer.

    You can minimize these artifacts by being sure to use a 24 bit depth buffer (instead of 16 bit), but the best solution is to avoid intersecting geometry altogether.

    Can you describe why this situation is coming up? Perhaps we can help eliminate it.

    -- Zeno

  4. #4
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    4,388

    Re: How to solve the "sawtooth" shape?

    Try moving the near clip plane out as far as you can and less importantly try and bring the far clip plane in too.

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2002
    Posts
    18

    Re: How to solve the "sawtooth" shape?

    Originally posted by Zeno:

    You can minimize these artifacts by being sure to use a 24 bit depth buffer (instead of 16 bit), but the best solution is to avoid intersecting geometry altogether.

    -- Zeno
    I have to draw some intersection objects.But when they are rotated, some visual errors occured at some viewing angle. It is a bad thing.
    I can not draw them using polygon offset,because it seems not to ne real.

    How can I do?

  6. #6
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: How to solve the "sawtooth" shape?

    Zeno and dorbie already told you how.
    Make the zFar/zNear ratio in your frustum as small as possible and use a depth buffer with 24 bits if you have used 16 bits so far.

    [This message has been edited by Relic (edited 10-29-2002).]

  7. #7
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    The Round Table at Camelot
    Posts
    1,537

    Re: How to solve the "sawtooth" shape?

    You can also use the stencil buffer for this too. I seem to remember many dicussions about this kind of thing on this board.

    -SirKnight
    -SirKnight

  8. #8
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    4,388

    Re: How to solve the "sawtooth" shape?

    Stencil helps for coplanar surfaces but for intersections it doesn't. You need Z precision.

    When people post a question they should at least take the time to read the replies.


    [This message has been edited by dorbie (edited 10-29-2002).]

  9. #9
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    The Round Table at Camelot
    Posts
    1,537

    Re: How to solve the "sawtooth" shape?

    Ah yes correct, I was just thinking of coplaner surfaces. Opps.

    -SirKnight
    -SirKnight

  10. #10

    Re: How to solve the "sawtooth" shape?

    Move the near clip plane as far forward as you can. The far clip plane doesn't matter much.

Posting Permissions

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