Z fights under the skirt

Started by
4 comments, last by OrenGL 19 years, 5 months ago
Hi, i use geomipmapping and skirts for crack fixing. The skirts are stored in a vertexbuffer with the rest of the chunk data and get drawn when the terrain chunk is drawn. The problem is that the skirts shine through the terrain geometry. It looks alot like z fighting. Any idea how to fix that? GL_DEPTH_TEST and z-writes are enabled. thanks alot, regards stephan
Advertisement
Fiddle with the range and resolution of your zed buffer/
The general rule of thumb is this: the distance to your near plane should be about 1/1000th of the distance to the farthest displayed point.

It's a tradeoff between z-fighting in the distance and how close you can get to something before it is clipped by the near plane.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
The absolute distance of the far plane doesn't matter that much; not even the ratio matters that much. After all, you can set up a perfectly fine projection matrix that puts the far plane at infinity! It's the absolute value of the near plane that causes Z fighting. Thus, pushing it out as far as you can is always a good idea. Use a collision sphere around your camera, with the radius = near plane distance, to make sure you don't clip through geometry.

In that screen shot, it looks like the Z testing for the skirts isn't even on. Are you sure you've enabled Z test and Z writes? With the right Z test mode?
enum Bool { True, False, FileNotFound };
Quote:Original post by hplus0603
In that screen shot, it looks like the Z testing for the skirts isn't even on. Are you sure you've enabled Z test and Z writes? With the right Z test mode?


Pushing out the near plane helped alot. But there are still z-fights, yes z test and writes are on. Test is less-equal.
I think a much cleaner solution would be to just not render under the skirt. Leave a gap between the patches and render the skirt in the gap with nothing underneath it.
Don't shoot! I'm with the science team.....

This topic is closed to new replies.

Advertisement