SAVSM soft shadows & MSAA

Started by
1 comment, last by d07RiV 5 years, 10 months ago

I'm implementing soft shadows using SAVSM as described in https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch08.html

I almost got everything working, but I hit a bit of a snag. I'm currently passing the SAT texture to the shader, along with the original VSM buffer that is used for blocker depth estimation. However, that buffer is antialiased (because it is rendered together with VSM buffer, which benefits from multisampling), which means depth values along edges are non-sensical. It gets even worse once I start sampling multiple texels for depth estimation.

Is it not possible to use MSAA with this technique at all (aside from rendering the shadowmap twice), or is it okay to ignore this and have some inaccuracy in penumbra size?

Here's what my depth map looks like with MSAA (left) and average blocker depth (right). Shadow texel edges are marked in black.

image.png.5bf5b3755a69c8be76c5616223a2211f.png

Advertisement

I also found that averaging occluder depth over a sample region produces pretty bad results when combined with VSM, unlike the original paper that worked with PCF. It results in blocky shadows (when transitioning from 0 occluders to 1), can consider texels that can't possibly occlude the target point (they are inside the sample region, but are not in the light cone), etc. Maybe I just did something wrong, but it didn't look great for sure.

I switched to using minimum instead - it doesn't get rid of blocks, but it mostly ensures that I get a reasonable occluder depth, and isn't affected by MSAA. I also weighed the samples when taking minimum (crazy) and it seems to work okay.

  image.png.72644802a615d702c1c4cc26a6301446.png

Do games actually use VSM for soft shadows? It seems that it's impossible to tune to work with all filter sizes at once.

This topic is closed to new replies.

Advertisement