How to avoid z-fighting?

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
panurge
Posts: 22
Joined: Sat Jul 04, 2009 11:08 pm

How to avoid z-fighting?

Post by panurge »

Hi everyone. I'm creating a planet-generator, in the following way:

I put all the data in a two-dimensional array into the Z component of each vertex of a cube-mesh. This works pretty fine for creating mountains.
I create the sea by spawning a big flat mesh at Z=0.

When the camera moves, the intesection between the sea-mesh and the earth-mesh wobbles in a strange and annoying way. How can i aviod this?

Hope this is clear. I can't send you an editable file at the moment. I already tried checking and uncheckng "draw back face" and similar in the material options, but the prolem persists.

Thanks in advance!
User avatar
Kjell
Posts: 1891
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi panurge,

Did you enable the Grid2DOnly checkbox of your MeshBox components?

If that doesn't solve it, try to reduce the Clipping range by adjusting the ClipNear / ClipFar properties on App. The smaller your range, the higher the "resolution" of the Z-Buffer will be for that range.

A screenshot or executable would make it easier to help :wink:

K
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Sometimes if they are at the exact same place you can get this problem.
Off-setting one by a tinny amound may do it; z=-0.01;
iterationGAMES.com
User avatar
panurge
Posts: 22
Joined: Sat Jul 04, 2009 11:08 pm

Post by panurge »

Thanks guys, sorry for answering so late, but i currently don't own an internet connection...
for the moment i simply avoided the problem by eliminating the 'sea'. Anyway, i'll post my project on these forums for you to see.

thank you again
Post Reply