Gaussian Blur

Higher frequency shadow map variations can introduce some very noticeable artifacts which can be parried to some extent by applying blur to the accumulation buffer!

Higher frequency density can either be a result of actual density distribution in the medium or higher frequency in the parts of the shadow maps that are sampled. Below I illustrate this by looking at volumetric light shafts from sunlight through a tree.

No BlurIn the case when no blur is made we can see that there are some artifacts within the light shafts. This happens because the ray marching step size is too long to be able to accurately capture the higher frequency variations in the medium. The number of samples is, of course, low in order to be able to render in real time.


7-tap bilateral gaussian blur

Enter 7-tap gaussian blur. By running two separate passes of one dimentional gaussian blur with 7-taps we can smoothen out many of the artifacts that were introduced. However, a very noticable undesired effect is that the blurring of the volumetric light accumulation buffer smudge out across the geometry. What we need is the gaussian blur to be more edge preserving.


7-tap regular gaussian blur

The final version is a 7-tap bilateral gaussian blur, where the change of depth will also be used as weight when the blur is performed. We can see how many of the artifacts are less noticable, but the crisp edges of the leaves in the tree are preserved.


Here is a good tool for calculating gaussian kernels with different standard deviations: