Moment Shadow Mapping

Contents
Moment Shadow Mapping (MSM) is a rendering technique for rendering soft-shadows in real-time. This project was my attempt at implementing the Hamburger 4MSM paper for the CS-562: Advanced Real-Time Rendering Techniques coursework I took during my time at DigiPen Institute of Technology.
The renderer for the project was written using C++, OpenGL, and GLSL.
1 An overview of the technique
The technique builds on the ubiquitous two-pass shadow map algorithm, where:
- Instead of storing the depth ‘z’ in a single channel shadow map, we store (z, z^2, z^3, z^4) in a four channel shadow map.
- The four channel shadow map is then blurred by running it through a Gaussian blur filter.
- During the lighting pass:
- We calculate pixel depth, zf, as in regular two-pass shadow mapping.
- Next, we calculate light depth, as in regural two-pass shadow mapping, by projecting the pixel onto the shadow map and extract the (z, z^2, z^3, z^4) values, which are now blurred.
- Now instead of comparing the two depth values, we run zf and (z, z^2, z^3, z^4) values through the MSM algorithm to calculate a full range of shadow factor between [0, 1].
2 Results

MSM: Capturing four different moments in shadow map

MSM: Blurring the shadow map

Soft Shadows: Using Perspective Projection for light's viewing volume (point lights)

Soft Shadows: Using Orthographic Projection for light's viewing volume (directional lights)
| Hard Shadows | Anti-Aliasing with MSM |
|---|---|
![]() | ![]() |
MSM soft shadows with just enough blur to achieve anti-aliasing
| Gaussian Blur Passes = 2, Kernel Size = 5 | Gaussian Blur Passes = 10, Kernel Size = 11 |
|---|---|
![]() | ![]() |
MSM soft shadows with varied amount of shadow map blurring
3 Future work
Implementing the blur filter for the shadow map in the fragment shader hampered the frame rate. Using compute shaders would be better for performance.





