Sign in to follow this  
Scet

[solved] My triangles are hurting eachother, z-fighting problems

Recommended Posts

OK I'm having this problem where when I move through the level, triangles disappear or get "cut up" or jump infront of others. I have the Z-buffer enabled and I am clearing it each frame. I tried turning on culling, clipping and setting the depth-bias, but those didn't do much of anything. See the "split" in the blue-grey quad(it's just two triangles, the whole level is one big triangle list), as I move so does the "split" or the quad will just disappear altogether. Has anybody had this problem or does anyone have the solution? People aren't going to play DOOM.Net if it slices the level [sad] [Edited by - Scet on April 23, 2006 8:21:35 AM]

Share this post


Link to post
Share on other sites
Classic problem unfortunately - "Z Fighting" (or sometimes "flimmering"). It happens when you have coplanar geometry that generates the same Z value. Due to various floating point errors/rounding you can get strange patterns where the "in front" polygon will change...

Best bet is to try and seperate those polygons - move them further apart, or possibly cull the one that should actually be behind the other.

Other possibilities are to increase the Z resolution (e.g. a 24 or 32 bit depth buffer instead of 16) or to tweak the projection matrix - try and make the difference between Z-Near and Z-Far as small as possible.

Depth bias should sort this out, but getting that working can be a little tricky - you need to split/change the bias between the two coplanar sets of geometry, but getting all hardware to work the same way can be difficult (even though the D3D9 changes are supposed to solve that)...

hth
Jack

Share this post


Link to post
Share on other sites
Make sure you near clipping plane value is not too small and you far clipping plane value is not too big.
You can find this values in your projection matrix.

[edit] beaten again.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kamikaze15
Make sure you near clipping plane value is not too small and you far clipping plane value is not too big.
You can find this values in your projection matrix.


This was actually the problem it seems. I had far clipping plane set to 10000 so I could see the whole level, but it murdered things up close. Setting it < 2000 seems to fix it.

Thanks for the help guys.

Share this post


Link to post
Share on other sites

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