PDA

View Full Version : Alias-Free Shadow Maps



rexguo
08-29-2009, 09:53 PM
Hey folks,

Has anyone tried implementing this shadow technique on
modern GPUs? It's a paper from 2004 Eurographics and describes
a way to produce alias-free shadows (i.e. no stair-stepping
or moire artifacts) without using ray-tracing. The problem
I see (and described in the paper too) is that the irregular
data structure needed to implement this makes it impossible
(perhaps due to my lack of imagination) to implement it on
OpenGL + GLSL. Maybe a combination of OpenGL + CUDA does the
trick?

Paper and slides are here:
http://www.tml.tkk.fi/~timo/publications/aila2004egsr_paper.pdf
http://www.tml.tkk.fi/~timo/publications/aila2004egsr_slides.ppt

Here's the outline of the technique:



In this paper we abandon the regular structure of shadow maps. Instead, we transform the visible pixels P(x, y, z) from screen space to the image plane of a light source P′ (x′ , y′ , z′ ). The (x′ , y′ ) are then used as sampling points when the geometry is rasterized into the shadow map. This eliminates the resolution issues that have plagued shadow maps for decades, e.g., jagged shadow boundaries. Incorrect self-shadowing is also greatly reduced, and semi-transparent shadow casters and receivers can be supported. A hierarchical software implementation is outlined."


Clearly, the shadow terms are needed only for the visible pixels of the screen-space image. We compute exactly that by transforming the visible pixels to the image plane of the light source, and do not discretize the projected coordinates. The projected points are then used as sampling points when the geometry is rasterized from the light source. This eliminates the concept of shadow map resolution. Resolution mismatch problems are completely eliminated, and incorrect self-shadowing is greatly reduced.

zeoverlord
08-30-2009, 03:46 AM
not the way he proposes that we do it as it requires that you use a non rectangular grid for rendering on, and that's clearly not the way hardware works, and frankly i think you have to do some kind of raycasting here for it to work.
it would be possible though if we had and could render to a vectorgraphics texture, but sadly that is not possible.

There is a method that can do some of this, it's called stencil volume shadows and is mostly aliasing free, it's slower though and requires several passes.

Both of these methods give sharp edges and clearly that's not always desirable, so you have to use PCF or something like it and that clearly makes aliasing a non issue.

Brolingstanz
08-30-2009, 08:01 AM
There's a spin-off of this back-projection trick mentioned in one of last year's GDC presentations. It uses areas of approximated backprojected geometry for plausible soft shadows though. Perf's not exactly on par with some of the other methods (VSM, CSM, ESM, ...) at this point, but it's very interesting.

Dark Photon
08-30-2009, 05:40 PM
not the way he proposes that we do it as it requires that you use a non rectangular grid for rendering on, and that's clearly not the way hardware works...
This all reminds me of a paper talked about in last year's SIGGRAPH (actually written 2 years ago) by Aaron Lefohn (now on the Intel Larrabee team, formerly Neoptica) and Shubhabrata Sengupta called Resolution-matched Shadow Maps (http://graphics.idav.ucdavis.edu/publications/print_pub?pub_id=919[/url). The paper mentions Aila's alias-free shadow maps.

Similar focus of match the desired screen-space density, but used the GPU to generate the non-uniform shadow map samples at the desired rates. Really cool use of reprogramming the GPU to do something it wasn't originally intended to do. The kind of thing that makes a Larrabee-type system very interesting (hopefully they'll actually pull it off and ship it). Check out the videos if you can find them. PDF here (http://graphics.idav.ucdavis.edu/publications/print_pub?pub_id=919[/url). Excerpt:


This paper presents resolution-matched shadow maps (RMSMs), an improved adaptive shadow map algorithm and novel implementation that both addresses the aliasing problems of shadow map algorithms and allows real-time performance for complex scenes on graphics hardware. Like adaptive shadow maps (ASMs) [Fernando et al. 2001], our technique generates shadow data at the resolution required by the current camera view and stores the data in a quadtree of small shadow map pages. Unlike ASMs, however, RMSMs leverages coherence between image and adaptive-shadow-map space to generate shadows in a single step rather than using iterative refinement. We achieve real-time performance by combining this coherency insight with data-parallel scene analysis algorithms implemented on the GPU. Our technique is up to ten times faster than previous GPU-based adaptive shadow map implementations, performs more predictably, and is guaranteed to produce correct shadows for a given camera view, within the limits of the maximum resolution supported by the quadtree.
...
The practicality of this approach is based on the insight that, for surfaces continuously visible from the eye, adjacent eye-space pixels map to adjacent shadow texels in quadtree shadow space. This means that the number of contiguous regions of shadow texels (which can be efficiently generated with a rasterizer) is proportional to the number of continuously visible surfaces in the scene. Moreover, these regions can be coalesced to further reduce the number of render passes required to shadow an image. The secondary contribution of this paper is demonstrating the design and use of data-parallel algorithms inseparably mixed with traditional graphics programming to implement a novel interactive rendering algorithm.