• No results found

Overview of our approach

In document Logarithmic perspective shadow maps (Page 31-35)

1.6.1 Scope

In this thesis we restrict our attention to hard shadows, though our methods may also be useful for algorithms that use shadow maps to generate soft shadows. Because we target real-time applications, we concentrate mainly on scene-independent algorithms that require

only a small number of partitions (<10). These algorithms are the simplest and have the best performance in practice. Specifically, this means that we do not consider algorithms like adaptive shadow maps, although these can produce lower error than scene-independent algorithms. Recently proposed algorithms based on adaptive shadow maps report near real- time performance for simple scenes (Lefohn et al., 2007). But it is difficult to say when graphics hardware will be fast enough that adaptive algorithms can be competitive with the simpler, scene-independent algorithms used on today’s GPUs. LogPSMs aim to provide the same performance as the simpler algorithms, but with lower error.

To establish the benefit of LogPSMs, we first perform an analysis of shadow map error. We seek to minimize the magnitude of the undersampling error that causes jagged shadow edges, commonly referred to as aliasing. Aliasing error can be factored into two parts: perspective aliasing which is due to the tapered shape of the view frustum, andprojective aliasing which is related to the orientation of the surfaces in the scene relative to the light and eye. Minimizing projective aliasing error requires a scene-dependent analysis and the use of adaptive techniques that perform a large number of render passes. Therefore we seek only to minimize perspective aliasing error. In practice, this means that we may not completely eliminate aliasing in most images, but we seek to reduce it significantly while maintaining good performance.

In our analysis we focus primarily on bounding the worst case error. The actual error in the image depends on the position of the shadows inside the view frustum. In an interactive application where the view is unconstrained and the scene geometry is arbitrary, the shadows may appear in any part of the view frustum. Therefore we measure the perspective aliasing error over the entire frustum using the L∞ norm, or max norm. Using this metric we can give scene-independent guarantees on the worst case error.

1.6.2 Logarithmic perspective parameterization

We formulate the LogPSM parameterization as a perspective projection, followed by a log- arithmic transformation that is applied in only one direction. Suppose that the light space y-axis is aligned with the eye’s view direction, and that shadow map coordinates are repre-

sented bysand t. A perspective projection alongy has the following form: sp= a0x+a1 y tp= a2y+a3 y , (1.1)

where a0. . . a3 are constants. This projection can produce a good spacing distribution in s,

but the distribution int can be improved by using a logarithmic parameterization alongy:

tl=b0log(b1y), (1.2)

where b0 and b1 are constants. Our parameterization transforms Equation 1.1 into Equa-

tion 1.2 by applying an affine transformation (a scale and translation) totp obtain 1/(b1y),

applying the log to get log(1/(b1y)), and scaling by −b0 to get b0log(b1y). Our logarithmic

perspective parameterization has the following form:

tlp=c0log(c1tp+c2), (1.3)

where c0, c1, and c2 are constants. The main advantage of this formulation is that the

perspective portion of the parameterization can be handled by the standard graphics pipeline without any modifications. Most importantly we do not have to clip curved primitives. To support the logarithmic transformation, only the rasterizer needs to be modified. (We include triangle setup, which also needs to be modified, as part of the rasterizer.)

Another advantage of our formulation is that it is easy to extend existing perspective warp- ing algorithms to use the logarithmic perspective parameterization. In this thesis we extend three different algorithms to use our parameterization: a single shadow map algorithm similar to light-space perspective shadow maps (LiSPSMs) (Wimmer et al., 2004), a z-partitioning algorithm similar to parallel-split perspective shadow maps (PSSMs) (Zhang et al., 2006a), and a face partitioning algorithm similar to perspective-warped cubemaps (Kozlov, 2004). Each of these algorithms has different performance and error tradeoffs. Like all single shadow map algorithms, our single shadow map LogPSM produces the lowest error when the light direction is perpendicular to the view direction, but reverts to a uniform parameterization as

the light direction approaches the view direction. Addingz-partitioning reduces the error for the bad light configurations but at an added cost. The face partitioning algorithm is slightly more involved, but produces the lowest error over all light directions. In addition, it can be used for both directional lights and omnidirectional point lights for almost the same cost.

We demonstrate the benefit of these algorithms for several environments of varying com- plexity using a fragment program to simulate logarithmic rasterization. Our unoptimized simulator is quite slow but still interactive. With hardware acceleration, however, the Log- PSM algorithms would have performance similar to the existing algorithms upon which they are based.

1.6.3 Logarithmic rasterization

In order to implement logarithmic rasterization on GPUs, we propose several incremental modifications to current hardware architectures. We need to modify the rasterizer, polygon offset, and depth compression. The rasterizer in current high performance GPUs use edge equations to compute which pixels are covered by a primitive. It generally operates in two stages, a coarse stage that identifies potentially covered tiles of pixels, and a fine stage that computes coverage at each pixel. We extend the rasterizer to handle the edge equations for the curved edges generated by the logarithmic transformation. Our logarithmic rasterizer can utilize the same tile traversal and culling optimizations used by current rasterizers. Polygon offset, typically used to avoid self-shadowing artifacts, and depth compression also need to be modified.

Modern GPUs are typically the result of many years of careful optimization and tuning. Our modifications leverage existing hardware designs, which makes them easier to implement at low cost. Rasterizing with curved edge equations requires a modest amount of additional computational power, but can provide significant bandwidth savings. Thus these modifi- cations align well with current hardware trends, where computational power continues to outpace memory bandwidth (Dally & Poulton, 1998).

In document Logarithmic perspective shadow maps (Page 31-35)