Better Depth Testing
I''m using the default OpenGL depth testing, glEnable(DEPTH_TEST), but it doesn''t work very well at distance. Is there anyway of "makeing it work better"? And I don''t care about speed.
Ben Gosney.
Try moving your near and far clipping planes closer together, and/or increasing color depth.
You may also want to check to see if your target cards support w buffers.
You may also want to check to see if your target cards support w buffers.
AFAIK, the default behaviour is always a linear mapped depth buffer, since that is what the OpenGL specs define.
You may want to have a look at the EXT_depth_float extension: here
Edited by - Yann L on February 15, 2002 3:33:46 PM
You may want to have a look at the EXT_depth_float extension: here
Edited by - Yann L on February 15, 2002 3:33:46 PM
In orthographics projection, the depth buffer precision has a linear distribution. In perspective projection, it has a logarithmic or exponential distribution, with more precision closer to the near clip plane. This is nothing that OpenGL requires/specifies. It''s a pure mathematical "feature".
The larger the relative distance (near to far ratio), the more effective depth buffer precision you loose. You should always keep the far clip plane as far away as possible. Moving the near plane away a few units makes much more effect that moving the far plane closer a few units (moving both is better though ).
The larger the relative distance (near to far ratio), the more effective depth buffer precision you loose. You should always keep the far clip plane as far away as possible. Moving the near plane away a few units makes much more effect that moving the far plane closer a few units (moving both is better though ).
I wasn''t talking about the perspective behaviour of the transformed z coordinate. Of course it is exponential. I was talking about the z *mapping* of the buffer. Means, how values stored into the depth buffer actually map to a transformed z coordinate. Normally, this mapping is linear, even for perspective scenes. This is what''s normally called a zbuffer.
Now W-buffering changes that. In does dynamic range compression on the *transformed* z coordinate. This compressed range mapping has an inverse effect, compared to the standard z-1 exponent of the buffer, and gives a linear depth value distribution for perspective scenes. Means, you have the same precision for near as for far geometry, and that in your perspective projection. W-buffering is not applicable for ortho-projection.
This type of mapping is not specified in the OpenGL standard, it only specifies standard glDepthRange() type mapping. I know of the before mentioned extension (although I never used it), and I know that Glide did w-buffering on 3Dfx Voodoo boards.
Now W-buffering changes that. In does dynamic range compression on the *transformed* z coordinate. This compressed range mapping has an inverse effect, compared to the standard z-1 exponent of the buffer, and gives a linear depth value distribution for perspective scenes. Means, you have the same precision for near as for far geometry, and that in your perspective projection. W-buffering is not applicable for ortho-projection.
This type of mapping is not specified in the OpenGL standard, it only specifies standard glDepthRange() type mapping. I know of the before mentioned extension (although I never used it), and I know that Glide did w-buffering on 3Dfx Voodoo boards.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement