Author : Thierry Tremblay
Page : << Previous 2
case, values are mapped linearly, and this ensure the Z buffer precision is the same for any value of Z in view space. In the second case, the mapping is non linear, it is proportional to -1/Z and that means that the farthest an object is in view space, the less precision the Z buffer will have. This is not necessarily bad.
The 1/Z approach does have less precision for far objects, but it also has better precision at close range, and this is not negligible. Another advantage of using the 1/Z buffer is the fact that I use texture planes in the engine, which gives me the 1/Z I need. If I were to use Z, I would have to do a division for each vertices!
Another thing to consider is that when rendering polygons, I use the "less or equal" function. So if you draw objects that need Z buffering in a back to front order (which is the case in the Frog Engine), then the precision doesn't matter so much. Of course, I may change this later in the project if the results are not good... But in my experience, this works well.
Page : << Previous 2