Sign in to follow this  

Z fights under the skirt

This topic is 4777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this