Variance Shadow Mapping Shadow Brightness Issue

Started by
12 comments, last by kalle_h 9 years, 11 months ago

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?

Advertisement

Increasing the blur might help you, but really, it'd down to you, the old advice 'if it looks right, it is right' certainly applies here.

It might be that in the end, you decide variance shadow mapping might not be the best option if you have lots of thin geometry just as phil_t did. It's really down to you, I've just tried to explain how the algorithm works, and why you are seeing what you are so that you can figure out how you want to go about dealing with it.

Good Luck

I've decided to abandon variance shadow mapping because they plainly just don't work right. By multiplying the distance, it is possible to get a softer shadow, but it comes at a cost. The contrast of the blur will no longer work. The higher you multiply it, the lower the contrast. Its a cool idea, and blurring shadowing does work, but the fact that it does this kind of makes it unusable. To anyone who else has this problem and wants to solve it, I would recommend not using variance shadow mapping, as fixing this issue to the fullest extent will pretty much nullify the benefits of using them. Thanks to everyone who helped.

Variance shadow mapping has it uses like for particles or volumetrics. But for general scenes there are usually too strong artifacts.

This topic is closed to new replies.

Advertisement