Monday, 12 April 2010

High Quality GPU soft shadows

I recently got around to trying out a high quality GPU shadow method. Whilst I'm happy with the way final gather is working it's not very good at accurate shadows. The limited number of FG rays means the shadows tend to be overly soft. Things improve with an increased ray count but it hurts render times.

The technique I'm using is a pretty straightforward extension of regular shadow mapping. It involves rendering multiple shadow maps from offset positions and averaging the results. For the sphere area light seen here, 256 randomly jittered offset vectors were generated and used to render multiple depth cube maps. The quality of the shadow map increases with the number of samples used and larger lights require more samples.

Shown below is a spherical area light. Other types of area light sources such as disc or rectangle lights are also possible.

Render times:

Sponza 13 lightmaps ~1min 30s
Cornell - Spheres 8 lightmaps ~0min 55s
Cornell - Robot1 8 lightmaps ~0min 49s
Cornell - Robot2 8 lightmaps ~0min 49s

> Shadow map for all scenes rendered in roughly 2 seconds.
> Each lightmap is 512x512
> Roughly 2600 final gather samples used in all scenes.

No comments:

Post a Comment