PDA

View Full Version : depth buffer growth function



Walrus
12-19-2002, 09:32 AM
Hi, i'm just doing some work with the depth buffer, and i know it doesn't grow linearly (as we aproach the far clipping plane, the accuracy decreases) I'm just wondering of this accuracy decreases as we move father back in the depth buffer (z-value approaches 1.0). Does anybody know the equations that represents this decrease? thanks

roffe
12-19-2002, 10:19 AM
If setting up your projection matrix with glFrustum, for example, your ndc z
(after perspective divide) would be:

Z_ndc = (zfar+znear)/(zfar-znear) + 2*zfar*znear/((zfar-znear)*z_eye)

I was interested in a similiar matter yesterday. You might find this thread interesting:
http://groups.google.com/groups?dq=&hl=e...3Dcomp.graphics (http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&threadm=c706d39b.0212190134.200a9155%40posting.goo gle.com&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.graphics) .algorithms

The above function visually: http://www.efd.lth.se/~e98mp/thesispage/images/zbuffer.jpg