Sign in to follow this  

VSM shadowmap blur, to downsample?

This topic is 3593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am currently using the VSM technique to generate my shadows. My shadow map is at the size of 512x512, D3DFMT_G32R32F, and using a kernel size 13 gaussian blur. However the FPS is pretty low at around 60-75fps. World consist of only a torus and a normal mapped floor. Would it increase the speed to downsample the shadowmap then blur it and upsample it again? Or is strongly not advisable to do such a thing? Thanks

Share this post


Link to post
Share on other sites
A few comments:

1) Don't use fps to measure speed: non-linear... has been discussed many times.
2) Don't worry about performance in toy scenes... things interact in such a way that you may be able to get 60-70fps performance (on whatever card you have) with a full scene too. In particular if you're bottlenecked on the blur pass right now it won't get any slower even when you throw a more complicated scene at it.
3) 13x13 blur is pretty big... do you really need that large support for your filter?
4) Don't bother doing a downsample/blur/upsample IMHO... if you're just doing for a wider penumbrae, decrease your blur size, perhaps decrease your shadow map resolution and ideally enable MSAA when rendering your shadow map.

Curiously what card are you testing on?

Share this post


Link to post
Share on other sites
I don't think I can use MSAA, I am unfortuantely still using dx9.

My current card is geforce 8500 which isn't a very fanstastic card it is somehow in my humble opinion comparable between a 7300 to 7600, just with added support for DX10. (In my humble opinion, I don't recommend the 8500 as a good card [headshake])

Currently I am not rendering my shadowmap with FSAA, my texture filters are trilinear. How will reducing blur size give a wider penumbrae? Won't it instead create sharper shadows?

Share this post


Link to post
Share on other sites
Quote:
Original post by littlekid
I don't think I can use MSAA, I am unfortuantely still using dx9.

It should be supported as long as it is supported by the target texture format... which it is on GF8 cards.

Quote:
Original post by littlekid
How will reducing blur size give a wider penumbrae? Won't it instead create sharper shadows?

It won't give you a wider penumbrae... but reducing your shadow map resolution and blur size proportionally will give you similarly "soft" shadows while being significantly cheaper. With such a large blur kernel you're losing all of the high-resolution detail anyways, so you might as well render in a lower resolution.

Share this post


Link to post
Share on other sites
Quote:
Original post by AndyTX
It should be supported as long as it is supported by the target texture format... which it is on GF8 cards.


What do you mean? you mean even with dx9.0, I can use MSAA? Isn't it a dx10 feature only? I have read about CSAA on the nvidia site but isn't it refering to only the original render targets, where I can apply CSAA instead of the typical AA on my scene.

Share this post


Link to post
Share on other sites
Quote:
Original post by littlekid

What do you mean? you mean even with dx9.0, I can use MSAA? Isn't it a dx10 feature only? I have read about CSAA on the nvidia site but isn't it refering to only the original render targets, where I can apply CSAA instead of the typical AA on my scene.


No no, MSAA is very much usable. In D3D9 you'll just have to go through an extra step to use MSAA with Render Target textures. What you'll want to do is create a surface using IDirect3DDevice9::CreateRenderTarget and specify your MSAA settings, and then render your shadow map to that surface. Then, you use StretchRect to copy the surface to the surface of a texture with the same format and dimensions, which you'll then bind as a texture for use as a shadow map. Also make sure you set D3DRS_MULTISAMPLEANTIALIAS to TRUE using IDirect3DDevice9::SetRenderState.

I'm pretty sure the whole GF8 series supports MSAA for the common floating point formats, but you can check yourself using the D3D caps viewer. Go to D3D Device Types->HAL->Adapter Formats and find the back-buffer format you're using. Then check what multi-sample types are supported under your render target format in "Render Format Compatibility".

Share this post


Link to post
Share on other sites
Thanks for the answer MJP, however I am still abit lost. After reading what you wrote, does it now mean that I can perform hardware AA for my deferred rendering technique?

One of the drawbacks that I read up on deferred rendering is lack of hardware AA, and have always thought that this was solved with MSAA. Having always thought that MSAA was a DX10 only feature, hence I thought that to have AA on my deferred renderer was to use dx10.

But from your previous post, it seems I can now perform deferred rendering with AA on dx9(which I will be very happy [smile]). Or am I missing out a important point?

Share this post


Link to post
Share on other sites
Quote:
Original post by littlekid
Thanks for the answer MJP, however I am still abit lost. After reading what you wrote, does it now mean that I can perform hardware AA for my deferred rendering technique?

No, these are very different points. With variance shadow maps you can rendering to a MSAAed shadow texture and use the [b]standard hardware resolve[/i] (i.e. average the samples) to resolve the texture into a "normal" non-MSAAed texture for sampling. DX9 supports all of these features.

However such an approach is not compatible with deferred rendering as you can't simply average the values in the g-buffer (you want to average the end luminance, not the parameters). To properly implement MSAA with deferred rendering you need to be able to sample the individual samples of a MSAAed texture directly in the pixel shader, which is only supported in Direct3D 10.

In any case, there's lots of discussion about MSAA+Deferred rendering in other threads. All you need to know for implementing VSM+MSAA is to create an MSAAed depth buffer and texture for your shadow map, render to it, then "resolve" it (using StretchRect in DX9 IIRC) to a non-MSAAed texture which you then use for sampling.

Share this post


Link to post
Share on other sites

This topic is 3593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this