Is there any way to increase OpenGL depth buffer precision?
Hi all, I'm having a problem drawing two objects in the scene. They're very close each other and they don't show correctly when the camera move away, some vertices put on top of others and they shouldn't (yeah, the typical depth precision problem).
I have searched in google and I've found this:
http://developer.download.nvidia.com/SDK/10.5/opengl/samples.html#simple_depth_float
It seems that solve my problem, but this example uses FBO. Is there any way to increase OpenGL depth buffer precision without using FBO?
Thanks in advance and sorry for my poor English.
The brute force way is to add more bits to the depth buffer, for example by requesting a pixel format with higher depth buffer precision (16 vs. 24 vs. 32 bits) or some other method like the one you linked.
The algorithmic way, which you should focus on first, is to setup the depth properties such that precision is not wasted in the first place and thus maximizing the usage of what you have instead of requesting more of the resource you're wasting. For example, see this.
The algorithmic way, which you should focus on first, is to setup the depth properties such that precision is not wasted in the first place and thus maximizing the usage of what you have instead of requesting more of the resource you're wasting. For example, see this.
The OpenGL depth buffer is not a linear. I think its log linear. Basically, most of the precision is first portion of the depth range.
So - what you can do is for the closeup objects, specify appropriate values for the camera's near and far planes, and also look at glDepthRange (near,far) this should also help with the depth problem.
So - what you can do is for the closeup objects, specify appropriate values for the camera's near and far planes, and also look at glDepthRange (near,far) this should also help with the depth problem.
You can try this technique (which is my technique) for having a linear depth buffer
http://www.geocities.com/vmelkon/zprecision.html
http://www.geocities.com/vmelkon/zprecision.html
Quote:Original post by BionicBytes
The OpenGL depth buffer is not a linear. I think its log linear. Basically, most of the precision is first portion of the depth range.
So - what you can do is for the closeup objects, specify appropriate values for the camera's near and far planes, and also look at glDepthRange (near,far) this should also help with the depth problem.
Here is some information about z-buffer precision from the Opengl Faq.
This should further help what you're trying to explain.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement