"Stretching" shadow z coordinate to make the most of non-linear depth buffer?

Non-linear depth textures provide no advantage to shadowmaps. They provide greater precision closer to the light source, but lower precision far away from the source.

To get around this, I am thinking about bringing the z coordinate of my shadow vertices closer to the camera. The goal is to get an even distribution of precision across the entire shadowmap, without manually writing to gl_FragDepth, so we can retain early Z discard.

For cubemap shadowmaps I just don’t bother with depth; instead I store a linear distance using a color buffer only (and using a minimum blend operation to simulate “depth”) which works fine and makes the biasing easier when it comes to comparison time.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.