Depth buffer artefacts on Geforce 2 hardware

I’m rendering a landscape with multiple textures scattered about it. This means I can’t use triangle strips and I can’t sort the triangles by depth order (without changing texture units nearly every triangle). Instead I’m sorting by texture changes and rendering triangles willy nilly with the depth buffer turned on.

However, I’ve noticed a nasty flickery artefact whilst rendering. Whilst completely still, the triangles kind of overlap slowly with each other in certain awkward areas, such as points on mountains. It looks like the depth buffer values are changing each frame by a tiny amount and cycling round a set of values.

What’s up? How can I make them be the same every frame? So at least it’s wrong but statically wrong rather than glitching annoyingly.

And then - has anyone got a better way to do this which avoids the depth buffer’s precision problems? I ask because I want to do multiple passes and blending’s a no-no if there’s overdraw…

Cas

just increase your near clip planes value or use a 24bit depth buffer

Already using a 24 bit buffer, but my near clip plane is set to 1… I’ll experiment with bigger numbers. Ta.

Zed,

thanks a 1000000. I suppose it was a little unrealistic to have the depth range from 1 to 1000000… and so it works just fine now.

Cas