Z-buffer precision


Do you guys know if there is a limit on the Z-buffer range ?
When Rendering at very far distances, like 200.000 units my z-buffer goes crazy, he messes everything around, both 16 and 32 bit.


Try to move the near clipping plane a little farther.

There’s a nice equation in the Blue Book (v1.2) under ‘gluPerspective’:

Let r = (zFar/zNear),
then roughly log(base2)r bits of depth buffer precision are lost.

“Because r approaches infinity as zNear approaches 0, zNear must never be set to 0.”

Great book. Especially once you’ve gotten the hang of the material covered in the red book.

– Jeff

I got it working…,
thanks guys