Variance Shadow Maps Demo (D3D10)

Discussion in 'Rendering Technology and APIs' started by Andrew Lauritzen, Apr 25, 2007.

  1. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

    Joined:
    May 21, 2004
    Messages:
    2,629
    Likes Received:
    1,227
    Location:
    British Columbia, Canada
    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 :)
     
  2. MJP

    MJP
    Regular

    Joined:
    Feb 21, 2007
    Messages:
    566
    Likes Received:
    187
    Location:
    Irvine, CA
    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.
     
  3. Jawed

    Legend

    Joined:
    Oct 2, 2004
    Messages:
    11,714
    Likes Received:
    2,135
    Location:
    London
    http://forum.beyond3d.com/showthread.php?t=39569

    Jawed
     
  4. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

    Joined:
    May 21, 2004
    Messages:
    2,629
    Likes Received:
    1,227
    Location:
    British Columbia, Canada
    Thanks!

    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 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).
     
  5. Reverend

    Banned

    Joined:
    Jan 31, 2002
    Messages:
    3,266
    Likes Received:
    24
    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.

    :)
     
  6. Neeyik

    Neeyik Homo ergaster
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    1,231
    Likes Received:
    45
    Location:
    Cumbria, UK
    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:
     
  7. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

    Joined:
    May 21, 2004
    Messages:
    2,629
    Likes Received:
    1,227
    Location:
    British Columbia, Canada
    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.
     
    #27 Andrew Lauritzen, May 4, 2007
    Last edited by a moderator: May 4, 2007
  8. FearTec

    Newcomer

    Joined:
    May 6, 2007
    Messages:
    1
    Likes Received:
    0
    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

    [​IMG]
     
  9. nAo

    nAo Nutella Nutellae
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    4,400
    Likes Received:
    440
    Location:
    San Francisco
    Congratulations!
     
  10. armchair_architect

    Newcomer

    Joined:
    Nov 28, 2006
    Messages:
    128
    Likes Received:
    8
    Not sure what you installed, but the April 2007 DirectX redist should include that DLL.
     
  11. Sunday

    Newcomer

    Joined:
    Feb 6, 2002
    Messages:
    194
    Likes Received:
    6
    Location:
    GMT+1
    Have you tried just to copy that DLL in the folder where themo is installed?
     
  12. AlexV

    AlexV Heteroscedasticitate
    Moderator Veteran

    Joined:
    Mar 15, 2005
    Messages:
    2,535
    Likes Received:
    144
    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.
     
  13. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

    Joined:
    May 21, 2004
    Messages:
    2,629
    Likes Received:
    1,227
    Location:
    British Columbia, Canada
    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.

    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.

    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'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.
     
  14. jbizzler

    Newcomer

    Joined:
    Mar 24, 2007
    Messages:
    29
    Likes Received:
    1
    Location:
    Warrenville, IL, USA
    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.
     
  15. jbizzler

    Newcomer

    Joined:
    Mar 24, 2007
    Messages:
    29
    Likes Received:
    1
    Location:
    Warrenville, IL, USA
    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!
     
    #35 jbizzler, May 29, 2007
    Last edited by a moderator: May 29, 2007
  16. Rys

    Rys Graphics @ AMD
    Moderator Veteran Alpha

    Joined:
    Oct 9, 2003
    Messages:
    4,182
    Likes Received:
    1,579
    Location:
    Beyond3D HQ
    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).
     
  17. jbizzler

    Newcomer

    Joined:
    Mar 24, 2007
    Messages:
    29
    Likes Received:
    1
    Location:
    Warrenville, IL, USA
    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.
     
  18. Xmas

    Xmas Porous
    Veteran Subscriber

    Joined:
    Feb 6, 2002
    Messages:
    3,344
    Likes Received:
    176
    Location:
    On the path to wisdom
    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.
     
  19. armchair_architect

    Newcomer

    Joined:
    Nov 28, 2006
    Messages:
    128
    Likes Received:
    8
    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.
     
  20. jbizzler

    Newcomer

    Joined:
    Mar 24, 2007
    Messages:
    29
    Likes Received:
    1
    Location:
    Warrenville, IL, USA
    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!
     
    #40 jbizzler, May 30, 2007
    Last edited by a moderator: May 30, 2007
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...