Water Surface Problem

I am creating a transparent water surface on a 3D texture covered terrain.

Everything looks fine until I start rotating and moving around in the terrain. The areas that are on the water surface level flicker alot. It looks like big random chunks of it go under the water surface and then above it. I was looking for information about Z-Buffer and that the textures are fighting for the Z-Buffer, but no luck …

Can you suggest something please …

you probably have a depth buffer precision issue. There are three solutions. One is to increase the number of bits, try switching from 16 to 32 bit color if possible. Another is to pull in the far clipping plane and the third is to bump out the near clipping plane. If you can afford to its probably best just to bump the near plane out

Originally posted by chowe6685:
you probably have a depth buffer precision issue. There are three solutions. One is to increase the number of bits, try switching from 16 to 32 bit color if possible. Another is to pull in the far clipping plane and the third is to bump out the near clipping plane. If you can afford to its probably best just to bump the near plane out

In the program I’m using
gluPerspective(45, (float) width()/height(), m_radius/100, m_radius10000);
so
near = m_radius/100;
far = m_radius
10000;
where
m_radius = max((maxX-minX),(maxY-minY));

So you are saying that I should pump the near higher ?

Remove “/100” from your near plane calculation and somewhat better depth buffer precision. If you have a 16 bit depth buffer, you better replace if with “*10” or so instead.

Thanks alot for the tips … I can’t set the depth buffer bit size … I’m using QT. And it is set to 1.