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!
the precision problem in 16 bit Z-Buffer
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).
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).
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement