PDA

View Full Version : How to solve the "sawtooth" shape?



ding
10-28-2002, 03:11 PM
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

SirKnight
10-28-2002, 03:16 PM
I think what you're describing is called "Z-Fighting." Check the FAQ on this site about this.

-SirKnight

Zeno
10-28-2002, 03:46 PM
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

dorbie
10-28-2002, 04:12 PM
Try moving the near clip plane out as far as you can and less importantly try and bring the far clip plane in too.

ding
10-28-2002, 05:21 PM
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?

Relic
10-29-2002, 07:19 AM
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).]

SirKnight
10-29-2002, 07:35 AM
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

dorbie
10-29-2002, 10:22 AM
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).]

SirKnight
10-29-2002, 12:11 PM
Ah yes correct, I was just thinking of coplaner surfaces. Opps. http://www.opengl.org/discussion_boards/ubb/biggrin.gif

-SirKnight

fresh
10-29-2002, 01:44 PM
Move the near clip plane as far forward as you can. The far clip plane doesn't matter much.