🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Z Buffer artifacts

Started by
1 comment, last by NightShade 24 years, 6 months ago
Have you tried using z-bias? In D3D, this is set by the D3DRENDERSTATE_ZBIAS render state.

As for W-buffering, I know that Voodoo 2's and 3's, TNT 2's, and GeForce 256's have it for sure.

Advertisement
Hi everyone,
I'm working on a 3d engine that renders a heightfield. The height field contains data about the ground below the sea level, and above. I want to render a flat alpha plane right at sea level (the water). It works ok, but only at close distances. Even with a 32 bit zbuffer I get Z-fighting between the water and the land. On my velocity card's 16 bit z buffer it's much worse. My question is twofold: First, I guess this is a precision problem - a 16 bit value can only hold so much precision, and these artifacts must be where the two values being compared are so close that it's random which one wins. My viewport extends out for 40000 units (we'll call them meters). Another thing that happens is that the artifacting becomes worse the further I move from 0,0,0. This program uses a huge world several hundred miles across. Anyway, what if I divided everything by 10, or 100? Anyone know offhand if that would make a difference?
Second, I bet W buffering would fix this, but does anyone know if this is a rare feature, or one that is becoming common in newer cards? This velocity card supports it, but my G400 doesn't, so who knows.
I guess a third option would be (assuming the camera is above the water) to draw the underwater part, then the water, then the above water parts, but this would require a big change in the way the land is stored, and I'd like to keep the nice neat heightfield format.
Thanks in advance for any comments!
-ns
-ns-
Hey, sweet, I guess it is worth adding w buffer support then. I will also look into the Z bias state. Thanks alot mhkrause!
-ns-

This topic is closed to new replies.

Advertisement