Jump to content
  • Advertisement
Sign in to follow this  
kamimail

the precision problem in 16 bit Z-Buffer

This topic is 2223 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi ,all:
I am working at a project that aims to develop a virtual globe system by using WebGL.
We have made the system work, but there is z-fighting problems.
I have heard from others that there exists a solution that use a perspective projection matrix,a matrix different from the projection matrix used in the OpenGL,which can resolve/relieve the precision problem.
Does anyone known the equation of the projection matrix? Thank you very much!

Share this post


Link to post
Share on other sites
Advertisement
I've never used WebGL, but it seems to support vertex shaders, so you could modify the depth value there - e.g. scaling to generate a linear depth (or something in between). E.g. here

I encountered a similar problem in my flight simulator - Tegra 2 devices only provide a 16 bit depth buffer. I ended up dynamically adjusting the near plane, so when the camera is away from the terrain the near plane is quite far, which reduces z-fighting in distant objects. The near plane distance is reduced as you get close to the ground in order to prevent seeing through the ground (fortunately the ground then tends to obscure view of the z-fighting artefacts happening far away).

Share this post


Link to post
Share on other sites

I've never used WebGL, but it seems to support vertex shaders, so you could modify the depth value there - e.g. scaling to generate a linear depth (or something in between). E.g. here


I wouldn't recommend that, it really f**ks with your rasterization.

There's no magic tweak that I know of that will fix the precision issues of a 16-bit integer depth buffer. In the past people dealt with it by just moving up their near plane as far as they can bear it, and also pulling in the far plane if possible. With floating point depth buffers you can flip the clip planes to try to "balance out" the precision, but with an integer depth buffer you don't want to do that.

Share this post


Link to post
Share on other sites
MJP ,MrRowl,Thanks for your reply.
I don't really understand why the w-compensation method suggested by MrRowl will has negative effect on the rasterization.would someone can clarify it to me ? Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!