Variance Shadow Maps Demo (D3D10)

Andy gets a shout out from the Inq - http://www.theinquirer.net/default.aspx?article=39224

party0011.gif
Wait... is that a good thing? I feel more like I should be insulted ;)

That said, the article is less offensive to me than most, although their comments about "techy information" are a bit bizarre; were they honestly surprised that I was going to discuss the technical parts when it's new research, and posting a technical site like B3D?? Sigh :)
 
Nice job Andy, the demo looks beautiful!

The SAVSM's look great, although I'm more than happy with the results I've been getting with just standard VSM + 4x MSAA + 5x5 Blur (great shadow quality with minimal swimming, and good performance on my 8800 GTS). Fits in nicely with deferred rendering, too. I may try out something similar to your parallel-split VSM implementation, as I've been having a bit of trouble getting the shadows to look good for large outdoor scenes with directional lighting from the sun.
 
Nice job Andy, the demo looks beautiful!
Thanks!

The SAVSM's look great, although I'm more than happy with the results I've been getting with just standard VSM + 4x MSAA + 5x5 Blur (great shadow quality with minimal swimming, and good performance on my 8800 GTS). Fits in nicely with deferred rendering, too.
Yeah definitely. For constant-sized minimum filter widths (i.e. constant edge softness), blurred VSMs look amazing and are very fast, especially with 4x MSAA. The only reason that you would want to move to SAVSMs is if you want a variable minimum filter width (i.e. plausible soft shadows algorithm), or perhaps if you're doing gigantic blurs (which *can* happen with PSSM, but are pretty easily avoided). In any case the source will all be available with Gems 3 and people are free to mix and match the techniques that suit their applications best.

I may try out something similar to your parallel-split VSM implementation, as I've been having a bit of trouble getting the shadows to look good for large outdoor scenes with directional lighting from the sun.
I highly recommend looking into PSSM, as it's very simple to implement and tweak and has great results even compared to perspective warping techniques (although the two can actually be used together). Works very nicely with VSMs as well since the latter can actually hide a lot of the artifacts of PSSM (visible edge splits, swimming on camera movement, etc).
 
Although I have no idea how this demo looks like (still on XP with a NV45), I have to commend you Andy on your VSM work. Just thought I'd drop a reminder of my post almost exactly one year ago.

:)
 
That said, the article is less offensive to me than most, although their comments about "techy information" are a bit bizarre; were they honestly surprised that I was going to discuss the technical parts when it's new research, and posting a technical site like B3D?? Sigh :)
Wily Ferret must going through some kind of menopausal phase at the moment, as he comes across as being rather snappy and bitter about anything he reports on right now. :sly:
 
Wily Ferret must going through some kind of menopausal phase at the moment, as he comes across as being rather snappy and bitter about anything he reports on right now. :sly:
Alright, if it isn't just that one article, I'll cut them a bit of slack ;)

In other news, my poster/demo won the I3D 2007 student poster competition :D I'll be making a small site soon that links a lot of the new VSM stuff including the demo, posters, etc.
 
Last edited by a moderator:
Hello

I have Vista Business with DX 10 and an XFX 8800GTX 768MB Video card.

I have also installed the DX9.0C redist runtimes and I get the following error

vsmdxerror.jpg
 
Hello

I have Vista Business with DX 10 and an XFX 8800GTX 768MB Video card.

I have also installed the DX9.0C redist runtimes and I get the following error

vsmdxerror.jpg

Have you tried just to copy that DLL in the folder where themo is installed?
 
Andy, did you get to toy with an 2900XT?Hardware PCF seems to be unreasonably slow(which is odd) and the INT32 mode doesn`t quite work(it produces gibberish). I`m asking because I`m curious as to how you perceive the competing architectures, rather than getting a fix for the bugs.
 
Andy, did you get to toy with an 2900XT?
No I haven't had the chance yet. Although I'd really like too, I can't justify building another computer right now on a grad student budget :(. I suspect we'll have some at work soon though so if I can get one on a Vista machine I'll have a chance to mess around with it.

Hardware PCF seems to be unreasonably slow(which is odd)
That does seem odd... no idea there - I'm just using the standard SampleCmp mode in D3D10. I could certainly implement it w/o hardware support of course (originally I did, so I can dig that up) or with Fetch4 if that's supported in D3D10.

... and the INT32 mode doesn`t quite work(it produces gibberish).
The only thing I can think of here is that I do rely on the integer overflow mode to be wraparound, although someone told me that it's spec'ed that way in D3D10 so I figured it was safe. I'd be happy to hear whether that's true (and more about R600's int32 overflow behaviour) from someone at AMD though.

I`m asking because I`m curious as to how you perceive the competing architectures, rather than getting a fix for the bugs.
I'll reserve judgment until I've had a chance to play with R600, but I will say that I've been nothing but happy with the G80 (other than my brief geometry shader testing, but TBH I don't care that much about the GS). R600 seems a bit weak on the texture filtering size (particularly fp32) which is bad for standard Variance Shadow Maps, but if it supports int32 texture filtering, that will give a small speed boost to the SAVSM implementation. I'd also like to test the fp32 MSAA performance which the G80 does fairly well and is also really nice for VSM.

I don't see many of the R600-specific features being useful for VSM but I'd be happy to be corrected on that point :) That said, R600 seems pretty geared towards heavy math (particularly vectorized) which VSM doesn't do at all. Texture fetching, filtering and to some extent memory bandwidth will dictate the speed of VSM for the most part.

Unrelated to VSM performance though, I'm hoping R600 will have something to offer over G80, perhaps as it initially seems in the geometry shader department. That said, I feel for AMD as G80 is a pretty solid architecture with no obvious flaws (to me), and is going to be pretty tough to compete with.
 
In my own implementation, when I try to implement AA, the CreateTexture2D function fails.

This works:
Code:
D3D10_TEXTURE2D_DESC td;
td.Width              = 512;
td.Height             = 512;
td.MipLevels          = 0;
td.ArraySize          = 1;
td.Format             = DXGI_FORMAT_R32G32_FLOAT;
td.SampleDesc.Count   = 1;
td.SampleDesc.Quality = 0;
td.Usage              = D3D10_USAGE_DEFAULT;
td.BindFlags          = D3D10_BIND_SHADER_RESOURCE | D3D10_BIND_RENDER_TARGET;
td.CPUAccessFlags     = 0;
td.MiscFlags          = 0;

HR(pd3dDevice->CreateTexture2D(&td, NULL, &g_pShadowMap));
But when I change the SampleDesc Count and Quality to 4 and 4 for 4xAA, CreateTexture2D fails. Do I need mipmapping as well? I've never toyed around with AA before.
 
Okay, I see. I need to set MipLevel to 1. But then creating the RTV fails. And I'm going to guess the SRV after that fails too.

Edit: I should really do more research before posting. D3D10_RTV_DIMENSION_TEXTURE2DMS.

Edit2: Now i either get "The view dimension declared in the shader code does not match the view type bound to slot 0 of the Pixel Shader unit. [ EXECUTION ERROR #354: DEVICE_DRAW_VIEW_DIMENSION_MISMATCH ]" or if I change the Texture2D in my shader code to Texture2DMS, then it doesn't compile, and for whatever reason, when I use DXUT, I don't get output on why it doesn't compile. The documentation on DX10 AA is so crappy!
 
Last edited by a moderator:
Try explicitly setting td.Texture2D.MipSlice = 0 after setting td.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS, since I remember having to do that in some code of my own recently for it to work with multisampling.

Also make sure your shadow map format supports multisampling on your device too, I guess (it should do, but there might be some combination of things that's stopping that for some reason).
 
No, I think the issue is you can't "sample" a multisample texture. Everywhere I go, I've seen the "load" function do it in HLSL, but I don't know how to use it. Using it clears up the FX failing to compile, but it doesn't quite sample the way I expect it to.
 
Are you using it like this?
Code:
Texture2DMS<float, NUM_SAMPLES> tex;
float firstSample = tex.Load(coords, 0);

I don't think you get 5 quality levels for 4-sample multisampling, so setting quality to 4 might fail though.
 
I don't think you get 5 quality levels for 4-sample multisampling, so setting quality to 4 might fail though.

IIRC Nvidia uses sample count and quality to select their CSAA modes. The sample count is the number of color and Z samples actually stored in the framebuffer, and the quality is the total number of coverage samples. So Count=4 and Quality=4 is just plain 4xMSAA, (4,16) corresponds to the 16x mode, and (8,16) is 16xQ. I'm not sure what they do if the (Count,Quality) pair doesn't correspond to one of the modes they support directly, probably just round Quality up or down to the nearest supported level.
 
Oh oh oh, I figured it out. Load wants coordinates in integers. So you multiply the coordiates you want by the textures dimensions:

Code:
Texture2DMS<float2, 4> Texture;
//...
//Inside my VSM filter, where tex is the coordinates of I want to sample
float2 moments = Texture.Load(int3(tex.x * 512, tex.y * 512, 0), 0).xy;

But for whatever reason, the shadow appears more aliased.
Please help Andy!
 
Last edited by a moderator:
Back
Top