Variance Shadow Maps Demo

Discussion in 'Rendering Technology and APIs' started by Andrew Lauritzen, May 2, 2006.

  1. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

    Joined:
    May 21, 2004
    Messages:
    2,629
    Likes Received:
    1,227
    Location:
    British Columbia, Canada
    Just to let you guys know, the demo for variance shadow maps that we showed at GDC is now available (executable and source) at http://www.punkuser.net/vsm/.

    Enjoy!
     
    Geo and Inane_Dork like this.
  2. Bludd

    Bludd Experiencing A Significant Gravitas Shortfall
    Veteran

    Joined:
    Oct 26, 2003
    Messages:
    3,794
    Likes Received:
    1,476
    Location:
    Funny, It Worked Last Time...
    Nice work! I think all shadow techniques in the demo looks good at 1024x1024, though it seems that only the variance maps have some kind of self shadowing or something (or whatever that effect is).
     
  3. DudeMiester

    Regular

    Joined:
    Aug 10, 2004
    Messages:
    636
    Likes Received:
    10
    Location:
    San Francisco, CA
    Nice, I've been following your thread at GameDev.net. :smile: imho, this is the future of shadowing, well unless the IHVs deliever a hardware filter like AF just for shadow maps
     
  4. fellix

    Veteran

    Joined:
    Dec 4, 2004
    Messages:
    3,552
    Likes Received:
    514
    Location:
    Varna, Bulgaria
    Hmm, the FX16 map definitely lacks precision for correct blur filtering, but FP16 is running out of range and just like PCF it hardly covers the narrow occluded surfaces.
    FP32 is about 30% slower here than FP16.
     
    #4 fellix, May 3, 2006
    Last edited by a moderator: May 3, 2006
  5. TheAlSpark

    TheAlSpark Moderator
    Moderator Legend

    Joined:
    Feb 29, 2004
    Messages:
    22,146
    Likes Received:
    8,533
    Location:
    ಠ_ಠ
    Not sure what you just said fellix, but... maybe it has something to do with me getting artifacts at low angles :?:

    I'm using 7800GTs.
     
  6. Simon F

    Simon F Tea maker
    Moderator Veteran

    Joined:
    Feb 8, 2002
    Messages:
    4,563
    Likes Received:
    171
    Location:
    In the Island of Sodor, where the steam trains lie
    Hmm. I tried using mean and std deviation for shadow maps a few years ago but abandoned it due to lack of time. I'm looking forward to reading through your paper when I get the chance.
     
    #6 Simon F, May 3, 2006
    Last edited by a moderator: May 3, 2006
  7. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

    Joined:
    May 21, 2004
    Messages:
    2,629
    Likes Received:
    1,227
    Location:
    British Columbia, Canada
    (I'm assuming that FX16 is shorthand for fixed-point 16-bit... I could be wrong.)

    The fixed-point surface should actually have better precision than floating point, since we effectively waste the exponent bits (our range *is* bounded). The reason why both are included is that fixed-point filters in hardware on ATI, and floating-point filters in hardware on NVIDIA. (Note that for the cases where hardware filtering is unsupported, bilinear is simulated in the shader, although mipmapping and aniso are not for performance reasons.)

    Oh yeah? Well you were on the right track as it turns out that moments *are* the representation that filters linearly.

    Yeah it shouldn't be too hard to work out the few remaining artifacts - we have some ideas, just haven't had the time. I'm also convinced that this is the way to go...

    Hardware PCF working with AF would be nice, but it only solves part of the problem. It still doesn't solve mipmapping (and there's no way to do that efficiently using brute-force PCF) and it still does not allow arbitrary filtering (stuff like multisampling and mipmap LOD bias is very useful for shadow maps too).

    Thanks for the feedback so far.
     
  8. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

    Joined:
    May 21, 2004
    Messages:
    2,629
    Likes Received:
    1,227
    Location:
    British Columbia, Canada
    Yeah that's a bit misleading - as I mention in the README, I couldn't get derivative biasing to work consistently on both NVIDIA and ATI, so I just disabled it for now. PCF should produce effectively the same shadows as VSM, except that it is far more expensive and thus is clamped to relatively small filter kernels (ex. 5x5).
     
  9. fellix

    Veteran

    Joined:
    Dec 4, 2004
    Messages:
    3,552
    Likes Received:
    514
    Location:
    Varna, Bulgaria
    Some shots of mine, without filtering:

    PCF - FX16 - FP16 - FP32 ;

    Brief note: Filter kernels over 5x5 is overkill, at least for the given scene with a single or two spot lights at such a close range.


    p.s.

    Fixed-point format is obviously producing artifacts at low view angles and hi-res shadow maps:
    FX16 - FP16 ;
     
    #9 fellix, May 3, 2006
    Last edited by a moderator: May 4, 2006
  10. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

    Joined:
    May 21, 2004
    Messages:
    2,629
    Likes Received:
    1,227
    Location:
    British Columbia, Canada
    It also depends on the shadow map resolution obviously... you can pick anything from 64x64 to 2048x2048 IIRC.

    That's really odd... I'll have to check that. What card do you have? It's possible that fixed-point just isn't working correctly at all on NVIDIA (I've not tested it much... the idea is to use FP on NVIDIA and FX on ATI). If that's on ATI then I'll have to try and reproduce that.

    Also the numeric artifacts in the fp16 shot (the first one) look odd... nothing like what I'm used to, and there shouldn't be that many of them... in fact they should be practically invisible without blurring.
     
  11. fellix

    Veteran

    Joined:
    Dec 4, 2004
    Messages:
    3,552
    Likes Received:
    514
    Location:
    Varna, Bulgaria
    1024*1024 max here!?

    6800GS (NV42), with the latest WHQL.

    Running across levels of filtering and/or shadow map resolution doesn't affect the artifacts for me.
     
  12. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

    Joined:
    May 21, 2004
    Messages:
    2,629
    Likes Received:
    1,227
    Location:
    British Columbia, Canada
    Oh ok... in any case it's just a constant in the main program naturally. There are some limits of what are renderable in GL though - I don't recall what they are for each vendor.

    Should be just fine then, although as I mentioned, fp16 is the ideal VSM mode for NVIDIA.

    Huh, well I'm not sure then. I know that NVIDIA and ATI have different fp16 formats though, so I may have to retest on NVIDIA after a made a few changes for ATI. In any case, it is possible to eliminate those without much work :)
     
  13. Zengar

    Regular

    Joined:
    Dec 3, 2003
    Messages:
    288
    Likes Received:
    1
    As far as I know nvidia doesn't support two-channel 16bit fixed-point textures natively (thay sould be emulated with usua RGBA8 textures) - at least in OpenGL it is the case. Maybe that's why you get artifacts?
     
  14. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

    Joined:
    May 21, 2004
    Messages:
    2,629
    Likes Received:
    1,227
    Location:
    British Columbia, Canada
    We actually use a 4xRGBA16 since 2xRGBA16 isn't currently renderable (at least in OpenGL) anyways. I honestly haven't done a lot of testing with fixed-point on NVIDIA though so it may not work as expected... that said, use fp16 ;)
     
  15. epicstruggle

    epicstruggle Passenger on Serenity
    Veteran

    Joined:
    Jul 24, 2002
    Messages:
    1,903
    Likes Received:
    45
    Location:
    Object in Space
    Nice job. Enjoyed looking through it.

    epic
     
  16. Geo

    Geo Mostly Harmless
    Legend

    Joined:
    Apr 22, 2002
    Messages:
    9,116
    Likes Received:
    215
    Location:
    Uffda-land
    F9 breaks Fraps? At least it seems to here (X1900XT).

    Nice demo; thanks.
     
  17. Zengar

    Regular

    Joined:
    Dec 3, 2003
    Messages:
    288
    Likes Received:
    1
    Sorry, I meant that nvidia doesn't support any fixed-point precision above 8 bits. There is a pdf somewhere at their page displaying all texture formats nvidia GPUs support. All above RGBA8 are not supported. Fp16 is the correct way
     
  18. fellix

    Veteran

    Joined:
    Dec 4, 2004
    Messages:
    3,552
    Likes Received:
    514
    Location:
    Varna, Bulgaria
    • RGB10
    • RGB12
    • RGB16
    Aren't those per component?
    Info taken from the OGL Extensions Viewer tool.
     
  19. Andrew Lauritzen

    Andrew Lauritzen Moderator
    Moderator Veteran

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