Summed-Area Variance Shadow Maps (Demo)

Well only four texture lookups are really needed (with bilinear filtering), which is quite reasonable I think
true, i was looking at the blurred paths
although I have it on good authority that several next gen games are using PCF filters as big as 7x7 to eliminate aliasing and swimming.
thats insane
Personally I'd much rather get rid of aliasing than have detailed shadows, although getting both is certainly ideal
i favour detailed shadows though, with varience shadows since theyre so expensive to make, i expect u only can do it with a single light ie 99% of the time its the sun, if u look at suns shadows' they are very sharp (no prenumbra), thus detailed shadows are more fitting with reality, also i believe detailed shadows look ascetically better, (simplified example) a person in a room normally doesnt really have a shadow (ie due to the reflected light its so faint) but sticking in one gives the player the person is standing on the ground + not floating in space.
cheers for the mention of the deep shadwmaps (ive never seen them before) they look very nice (but very very expensive)
 
Regarding performance of the shader, I'll have to look into that in more detail. I don't know where it's bottlenecked currently - I can't run NVPerfHUD here (no instrumented x64 driver for G80), but maybe PIX could tell me something.

i favour detailed shadows though
Certainly I want detailed shadows too - don't get me wrong - but not at the cost of having them extremely aliased and ugly. Erring on the side of potentially blurrier but no swimming or aliasing is normally the best for standard textures, and almost always the best for shadows.

cheers for the mention of the deep shadwmaps (ive never seen them before) they look very nice (but very very expensive)
Yeah they're stupidly expensive even in the offline world and have several undesirable characteristics like potentially unbounded storage per-pixel. However eventually the hardware will be able to handle something this complex at interactive rates. Then again there are probably more efficient ways to get "good enough" results for most scenes (ex. VSM or PCF).
 
First of all, you have my admiration and commendations for your continued study/interest in VSM.

However eventually the hardware will be able to handle something this complex at interactive rates. Then again there are probably more efficient ways to get "good enough" results for most scenes (ex. VSM or PCF).
Currently and as has been the case for as long as I remember, the last sentence above really is important in the scheme of it all (rate of progress, economies of scale... both from the HW and SW side). I have become quite enthusiastic about VSM since last year's GDC (i.e. your presentation) however and if time permits I'll write you an email about my thoughts on things that haven't been discussed here so far.
 
[...]and if time permits I'll write you an email about my thoughts on things that haven't been discussed here so far.
Please do! I love to hear feedback and suggestions, which is why I enjoy posting the work publicly.

In other new, my chapter was accepted to GPU Gems 3! :D Look forward to a thorough write-up there, and feel free to give me suggestions in the mean time!
 
  • Like
Reactions: Rys
Please do! I love to hear feedback and suggestions, which is why I enjoy posting the work publicly.

In other new, my chapter was accepted to GPU Gems 3! :D Look forward to a thorough write-up there, and feel free to give me suggestions in the mean time!

Congratulations! You definitely deserve it. :D Keep up the good work!
 
Nice work!

About how to eliminate the light bleeding artifact, I think a simple alpha blending may help:
many games do not render meshes with shadowmap directly. Instead they render the shadowmap into a screen sized, temporary buffer and then put it into the framebuffer at post-processing time. The reason for doing this is that you can do some manipulations on shadows.
Now, when rendering the temporary buffer, set alpha blending operator to multiply or minus, then you wont get bright edges in dark shadow area. Just a quick thought, haven't tested myself.

EDIT: The alpha blending won't work. The shadow edge is not the object edge.
 
Last edited by a moderator:
Only games with kind of very simple lighting equations do that..and yes, it's an hack..just not a very good one imho. The only non-hacky way to eliminate light bleeding is to reconstruct depth values distribution around a texel in a more accurate way.
 
Eww, screen space blur ;)

The only non-hacky way to eliminate light bleeding is to reconstruct depth values distribution around a texel in a more accurate way.
Yup, this is fundamental to note: any algorithm that takes less than N samples from a filter region of size N cannot get the same results as PCF. This is not to imply that PCF is some kind of gold standard, but it's worth noting that since the occluder distribution is actually a step function, some sort of adaptive algorithm that falls back on brute force in complex regions is the only way to get "correct" results. It's interesting to note that SAVSMs have a very obvious and fairly efficient adaptive sampling algorithm. IMHO it isn't worth it for games yet when the simple light bleeding reduction function works quite well, but it'd certainly be worth a look in the offline world.
 
I'm too lazy to look throught this entire thread. I'm just goign to come out and ask it; what kind of blur do you use? I implemented a gaussian blur, but it still didn't look nearly as this demo.
 
Oh, nevermind. This is a "Summed-Area Variance Shadow Map". Is the source available anywhere? This si still so far beyond my implementation in quality.
 
I wish you could edit posts here. No source because GPU Gems 3; got it. What's the timeframe on that being published anyway?
 
I just use a box filter here... nothing fancy. Gaussian is probably overkill. Do note however that the same (or better) quality as this demo can be obtained just by normal VSM blurring. The only thing that SAT's give is per-pixel filter width control, which isn't actually used for anything special in the current demo :)

The next demo will be in D3D10, including "normal" blurred and hardware filtered VSMs as well (i.e. constant filter width), shadow MSAA, better performance for some of the techniques, and some other goodies.

Gems3 is slated to be released at SIGGRAPH this year (August).
 
No, I mean a box filter function - i.e. equally weighted samples over some neighborhood (2x2, 3x3, or much larger - even 50x50 is quite fast with VSMs).

By "normal" blurred VSM I simply mean VSMs using hardware mipmapping, trilinear and anisotropic filtering, but pre-blurring the shadow map to effectively clamp the minimum filter width. This is contrary to summed-area variance shadow maps in which all filter (and clamping) is done in the shader itself, not using hardware filtering at all.
 
Could you send me an email when you either release the source of this or release the D3D10 demo? My address is the MSN one in my profile.

Hardware filtering isn't helping much. It looks like how this demo does with Hardware VSM, which is not better looking than the summed-area one.
 
Hardware filtering isn't helping much. It looks like how this demo does with Hardware VSM, which is not better looking than the summed-area one.
Here's the sequence:

1) Render depth/depth^2
2) Blur using a separable NxN filter to soften edges
3) Generate mipmaps
4) Bind the variance shadow map, and enable trilinear and anisotropic filtering

That will produce comparable results to this demo, where the "softness" slider varies "N". I have exactly this implementation in the D3D10 version - and I can toggle back and forth between it and SAVSM - so I know that it works :) It's also generally much faster than SAVSM, even when N is fairly large (~50). It will eventually cross over, but for constant filter widths and hardware that supports fp32 filtering, summed-area tables are just overkill.
 
Oh, I wasn't combining those correctly. I was trying one at a time, then two, and even then they were in the wrong order. Sweet.
 
Back
Top