# Non-Linearly Quantized Moment Shadow Maps

## Abstract

Moment shadow maps enable direct filtering to accomplish proper antialiasing of dynamic hard shadows. For each texel, the moment shadow map stores four powers of the depth in either 64 or 128 bits. After filtering, this information enables a heuristic reconstruction. However, the rounding errors introduced at 64 bits per texel necessitate a bias that strengthens light leaking artifacts noticeably. In this paper, we propose a non-linear transform which maps the four moments to four quantities describing the depth distribution more directly. These quantities can then be quantized to a total of 32 or 64 bits. At 64 bits, the results are virtually indistinguishable from moment shadow mapping at 128 bits per texel. Even at 32 bits, there is hardly any additional light leaking but banding artifacts may occur. At the same time, the computational overhead for the reconstruction is reduced. As a prerequisite for the use of these quantization schemes, we propose a compute shader that applies a resolve for a multisampled shadow map and a 9² two-pass Gaussian filter in shared memory. The quantized moments are written back to device memory only once at the very end. This approach makes our technique roughly as fast as variance shadow mapping with 32 bits per texel. Since hardware-accelerated bilinear filtering is incompatible with non-linear quantization, we employ blue noise dithering as inexpensive alternative to manual bilinear filtering.

Keywords: 32-bit quantization, compute shader, fast Gaussian blur, moment shadow mapping, non-linear quantization, on-chip filtering, real-time rendering, shadows

An executable demo is available on the author's blog.

## Images

## Download Paper

## Additional Material

- Software
*(ZIP archive, 6.8 KB)* - Presentation slides (pdf)
*(PDF document, 3.5 MB)* - Presentation slides
*(PPTX file, 44 MB)* - Appendix
*(PDF document, 562 KB)* - Video
*(MPEG-4 video, 39 MB)*

## Bibtex

@INPROCEEDINGS{peters-2017-quantized-msm, author = {Peters, Christoph}, title = {Non-Linearly Quantized Moment Shadow Maps}, booktitle = {Proceedings of the 9th Conference on High-Performance Graphics}, series = {HPG '17}, year = {2017}, month = jul, publisher = {ACM}, location = {Los Angeles, CA}, keywords = {32-bit quantization, compute shader, fast Gaussian blur, moment shadow mapping, non-linear quantization, on-chip filtering, real-time rendering, shadows}, abstract = {Moment shadow maps enable direct filtering to accomplish proper antialiasing of dynamic hard shadows. For each texel, the moment shadow map stores four powers of the depth in either 64 or 128 bits. After filtering, this information enables a heuristic reconstruction. However, the rounding errors introduced at 64 bits per texel necessitate a bias that strengthens light leaking artifacts noticeably. In this paper, we propose a non-linear transform which maps the four moments to four quantities describing the depth distribution more directly. These quantities can then be quantized to a total of 32 or 64 bits. At 64 bits, the results are virtually indistinguishable from moment shadow mapping at 128 bits per texel. Even at 32 bits, there is hardly any additional light leaking but banding artifacts may occur. At the same time, the computational overhead for the reconstruction is reduced. As a prerequisite for the use of these quantization schemes, we propose a compute shader that applies a resolve for a multisampled shadow map and a 9² two-pass Gaussian filter in shared memory. The quantized moments are written back to device memory only once at the very end. This approach makes our technique roughly as fast as variance shadow mapping with 32 bits per texel. Since hardware-accelerated bilinear filtering is incompatible with non-linear quantization, we employ blue noise dithering as inexpensive alternative to manual bilinear filtering.}, isbn = {978-1-4503-5101-0/17/07}, url = {https://doi.org/10.1145/3105762.3105775}, doi = {10.1145/3105762.3105775} }