PDA

View Full Version : Value stored in Z-Buffer



myk45
03-07-2013, 10:00 PM
Hello All,

I was reading this article on Z-Buffer: http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html
I see that the actual value stored in the Z-Buffer is:

z_buffer_value = (1<<N) * ( a + b / z )

Where:

N = number of bits of Z precision
a = zFar / ( zFar - zNear )
b = zFar * zNear / ( zNear - zFar )
z = distance from the eye to the object

Is this the same way the Z-Buffer values are stored on all graphic cards? or could it differ?
Thanks!

thokra
03-08-2013, 03:12 AM
The math is hardware independent. Aside from numerical issues, I'd suggest that all GPUs produce relatively identical depth values.

myk45
03-08-2013, 04:40 AM
Thanks for the confirmation thokra!