   VSM: Why Compute partial derivatives of depth
  Hi,I have seen different implementations of variance shadow maps.Some generate the moments like this:float2 moments;   //First moment is the depth itself.  moments.x = depth;   //Compute partial derivatives of depth.  float dx = ddx(depth);  float dy = ddy(depth);   // Compute second moment over the pixel extents.  moments.y = depth * depth + 0.25f * (dx * dx + dy * dy); Others use just the squared depth for the second moment. I tried both and can't see a difference in the result. Does the first method improve something?   
  The term with the derivatives accounts for the fact that the depth across a single shadow map pixel is not constant. This means that even a single pixel should have a certain amount of variance, depending on how much the depth changes across a pixel width (hence the derivatives of depth).As for its effect, including the term might help with shadow acne problems. Then again, it can also lead to weird artifacts at shadow edges where the derivatives become numerically unstable. My advice is: if you don't see any effect then turn it off and save yourself some cycles.   ;  I will keep that in mind. Thanks for the explanation.   