Okay, for the getting lighter problem, your issue is these lines:
float momentdistance = coord.z - moments.x; float p_max = variance / (variance + momentdistance*momentdistance);
You can see that as momentdistance approaches 0, p_max will approach 1 / 1, giving you fully light pixels. One simple solution for this would be to scale momentdistance up by some set value, but, to put it simply, there will ALWAYS be this 'getting lighter' problem when using variance shadow mapping, thats part of how it determines shadowing in the first place. In most cases this wont be an issue as the object being shadowed will be thick enough that you wont notice the light section since it will be hidden by the object it self, ie. a crate.
That worked well, but now the parts of the shadow that would have been lighter are dark. Should I just increase the radius of the blur?