variance shadow mapping and mipmapping

I implemented a variance shadow mapping. I store a linear depth and linear depth ^ 2 in the color texture. Next a gaussian blur is applied to that texture. It consist of two passes, so two additional
textures are required:

  • first texture storing result of the vertical blur
  • second texture storing result of the final blur (vertical + horizontal) and is sampled in a shader

I use mipmapping, the above textures have set appropriate min filter:

  • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

In the rendering loop glGenerateMipmap is called. Generally a variance shadow mapping works fine but I get some artifacts when I use mipmapping for the texture which stores the final blur and is sampled in the shader (mipmapping using with the linear depth texture and the vertical blur texture doesn’t cause any artifacts)

Why I get these artifacts ? Here is screen

I also wonder if I should use mipmapping for all three texture. Does it make sense ?

Whenever you see screen-space tangent surfaces, you have large texcoord derivatives and therefore are typically sampling very high up in the MIPmap chain (smallest levels – i.e. the most downsampled). Consider the effects of that.

For instance:

So what is the conclusion ? In all articles about VSM which I have read was information that using mipmapping, anisotropic filtering and gaussian blur with VSM can improve quality of the soft shadows. Finally I set parameters for textures this way:

  • (linear depth, linear depth ^ 2) mipmapping + anisotropic filtering
  • (vertical blur) anisotropic filtering ( using mipmaps when reading a vertical blur texture doesn’t cause any artifacts but I have doubts if it make sense).
  • (final blur) anisotropic filtering

What do you think about that ?