Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualBrother Bob

Posted 02 April 2013 - 06:28 PM

As Brother Bob correctly pointed out, the ratio between zNear and zFar is the important thing [...]

Actually, that is only half the truth, and, in my opinion, the wrong half of the truth. It is not what I said, but, to be honest, I wasn't very explicit in what I meant either. What matters for precision is the ratio of the near clip plane and the objects you draw; the far clip plane plays a very small role, if not completely insignificant.

 

Let's say you have zNear=1, and zFar=100, and you draw the object at around z=10. Plug those values into the link you gave and it will tell you what precision you have at z=10 which is what matters if you want to draw an object at that depth. I used 10 depth buffer bits just to get some reasonably scaled values (plus the fact that 210 ~ 1000, so the depth resolution is easily related to percentages also so you can say how large percentage of the precision is distributed where); the depth resolution at z=10 is 0.095.

 

Now change zFar to something of several orders of magnitude larger, say 100000, and the depth resolution at z=10 becomes 0.096. So the near clip plane was pushed away with three orders of magnitude, and the precision changed by roughly 1% for the worse. Add another three orders of magnitude to the far clip plane, and the precision is virtually identical; the change is in the 7-8:th digit.

 

Now let's look at the near clip plane instead. Double the near clip plane, and watch the depth resolution at z=10 improve by roughly the same ratio.

 

So once the far clip plane is about 1000 times the near clip plane, its actual value is virtually meaningless and has no effect on precision. The near clip plane, and the ratio between the near clip plane and the objects being drawn, is everything.


#1Brother Bob

Posted 02 April 2013 - 06:25 PM

As Brother Bob correctly pointed out, the ratio between zNear and zFar is the important thing [...]

Actually, that is only half the truth, and, in my opinion, the wrong half of the truth. It is not what I said, but, to be honest, I wasn't very explicit in what I meant either. What matters for precision is the ratio of the near clip plane and the objects you draw; the far clip plane plays a very small role, if not completely insignificant.

 

Let's say you have zNear=1, and zFar=100, and you draw the object at around z=10. Plug those values into the link you gave and it will tell you what precision you have at z=10 which is what matters if you want to draw an object at that depth. I used z=10 just to get some reasonable values; the depth resolution at z=10 is 0.095.

 

Now change zFar to something of several orders of magnitude larger, say 100000, and the depth resolution at z=10 becomes 0.096. So the near clip plane was pushed away with three orders of magnitude, and the precision changed by roughly 1% for the worse. Add another three orders of magnitude to the far clip plane, and the precision is virtually identical; the change is in the 7-8:th digit.

 

Now let's look at the near clip plane instead. Double the near clip plane, and watch the depth resolution at z=10 improve by roughly the same ratio.

 

So once the far clip plane is about 1000 times the near clip plane, its actual value is virtually meaningless and has no effect on precision. The near clip plane, and the ratio between the near clip plane and the objects being drawn, is everything.


PARTNERS