Reading list on Z-buffer precision

Nathan Reed recently published a blog article plotting his numerical findings of Z-buffer precision under different uses. On the way he references a couple of previous articles, that also reference other resources; I think it’s a good opportunity to list some of them. They all tell a part of the story and I recommend reading all of them to get the complete picture.

The effect of quantization in gamma space and linear space

I mentioned already (here and here) that one problem with gamma correct rendering is how we lose prevision for small values, and may run out of it if we didn’t have enough of it. I wrote a quick shader to demonstrate this problem and see how severe it is depending on the number of bits.

Thanks to BeautyPi‘s fantastic tool, ShaderToy, I could put it on line. Here is the live demo with an absurdly low precision format (R5G6B5) so you cannot miss the banding; just press the play button. It displays colors with maximum and low precision, in linear space and gamma space. The lighter vertical line shows the 50% intensity position. You can see the shader and play with the values here.

Maximizing depth buffer range and precision

Half of the available range is packed into tiny distance from the near plane to twice the near plane distance.

This quote from this article of the Outerra blog is more or less its punch line. The author explains the precision issues with typical depth buffer use, and explores ways to get better results. Since Outerra is a planet engine, no wonder depth precision must be critical.

I discovered Outerra and its blog fairly recently, through a couple of mentions in the Flipcode’s Daily Flip, and was impressed by its rendering. The amount of work that went into it must be insane. See these captures demonstrating the space to ground transition or the grass rendering for instance: