The last post I found on this topic is from Mar 2000
Would be nice if OpenGL 2.x can support multiple z buffer formulas.
For the application I write, I need a large visibility range.
e.g. (let us assume the length unit is meter)
near clip plane: less than 1 meter (zero would be best)
far clip plane: greater than 50.000 meter
max. distance between two z-buffer values: 0.001 meter
The ‘standard’ z buffer formula (with the log2(far/near) distribution) don’t capture this needs.
Some formula with a “(far-near)/(2^zBits)” distribution would be nice.
zval = ((far-near)/(2^zBits)) * (ze-near)
far = far clip plane
near = near clip plane
zBits = z buffer depth
ze = distance between eye and object
The “(far-near)/(2^zBits)” part can be precalculated on the glFustrum() operation.
DepthBufferFormula(enum formula, float reserved1, float reserved2);
formula = GL_LOG2SOMETHING | GL_LINEAR | …
reserved1, reserved2 = parameters for more specific formulas
FYI: With the formula above one could capture half of earth on a z buffer resolution of 1 millimeter and a z buffer depth of 32 bits.
Shinta, who still asking himself, whats the point in depending the z buffer res on the near clip plane.