• No se han encontrado resultados

III. METODOLOGÍA

III.5. Descripción de instrumentos o herramientas

We now consider how to obtain the lowest error on current hardware without logarithmic rasterization. We consider combinations of perspective warping, face partitioning, and z- partitioning. Face partitioning extends the benefits of warping to all light directions. To get further error reductions, z-partitioning must be applied to the faces. z-partitioning can also be applied directly to the view frustum without using face partitioning. Which approach gives the greatest error reduction for the least number of shadow maps? To analyze the effects of each type of partitioning on aliasing error we consider two light directions relative to the viewer: light overhead (γ = 90◦), and light behind (has the same error asγ = 0).

Because z-partitioning splits the view frustum into subfrusta, we will use the same equa- tions for base error distribution that we used in Section 5.2 where we used a light image plane oriented perpendicular to the light direction. We also we moved the cosφl and We= 2 tanθ terms intoMeside

t . To convert from error quantities in t on side faces to the error into terms of the t direction for frusta we multiply by cosφl/(2 tanθ). The base storage factor S can be converted by multiplying by the same factor. After multiplying S by cosφl/(2 tanθ), the result differs fromS on faces by a factor of cosφlcos2θ. Because we have explicitly computed S for all the parameterizations, we will perform the conversion using this factor. From Figure

5.38 we can see that the cosφlterm relative to the face becomes cosθand cos(90◦−θ) = sin(θ) for the light overhead and behind, respectively.

Light overhead. With the light overhead, only one face is visible to the light. Converting from face error values we get:

Sover=Ssidecos3θ. (5.79)

Applying this equation toSside

un,k (Equation 5.55) we obtain the base storage factor forZPwith kpartitions and no warping:

Sover

ZP =k(fe/ne)1/k

(fe/ne)1/k−1

2 tanθ . (5.80)

Likewise, fromSside

p,k (Equation 5.56) we can compute the base storage factor forz-partitioning with perspective warping:

Sover

ZP+P =k

(fe/ne)1/k−1

2 tanθ . (5.81)

For this light position, FP+ZP+P gives the exact same results asZP+P:

Sover

FP+ZP+P= SZPover+P. (5.82) For a logarithmic perspective parameterization, the storage factor can be computed fromSside

lp (Equation 5.57):

Sover

LogP= SFPover+LogP=

log(fe/ne) 2 tanθ . This provides a baseline for the comparisons.

Light behind. Figure 5.39 shows the view frustum as seen from a light behind the viewer. A ZP scheme cannot use warping because the view frustum is square. A critical resolution shadow map will have the same texel spacing as the image. Therefore the storage factor is

cne cfe

2cne 2cfe

Figure 5.39: View frustum as seen by the light behind the viewer. The width of the near and far planes are proportional tone andfe, respectively. (c= tanθ).

simply the ratio of the area covered by the shadow map to the area covered by the image:

Sbehind ZP+P = SZPbehind= (2 tanθfe)2 (2 tanθne)2 = (fe/ne)2 with k= 1 =k(fe/ne)2/k with k≥1. (5.83)

If we add face partitioning, we can use warping. We use a shadow map for each of the four side faces and the near face. The base storage factor for end faces is 1. The conversion from face error values for the light behind is given by:

Sbehind= 4Ssidesinθcos2θ+ 1. (5.84)

Applying this equation toSside

p,k we get:

Sbehind

FP+ZP+P= 2k((fe/ne)1/k−1) + 1. (5.85) The storage factor forFP+LogPis similar:

Sbehind

FP+LogP= 2 log(fe/ne) + 1. (5.86) Figure 5.40 shows ZP, ZP+P, and FP+ZP+P for a varying number of shadow maps. Even ZP without warping does better than FP+ZP+P in the overhead case. Since we must use a fixed number of z-partitions over all light directions in order to avoid popping, theFP+ZP+P scheme gets only onez-partitioning for every four shadow maps. For large

1 4 8 12 16 20 24 101 102 103 104

Number of shadow maps

Storage factor FP+ZP+P overhead FP+ZP+P behind ZP overhead ZP & ZP+P behind ZP+P overhead LogP overhead

Figure 5.40: Storage factor for varying number of shadow maps. The storage factor is shown for the light overhead and behind the viewer for various combinations of z- partitioning (ZP), face partitioning (FP), and perspective warping (P). The storage factor for a single shadow map with a logarithmic perspective parameterization LogPis shown as a baseline. (View frustum parameters: fe/ne = 1000and θ= 30◦)

values of (fe/ne) we have:

Sover

ZP ∼k(fe/ne)2/k (5.87) Sover

FP+ZP+P ∼k(fe/ne)4/k, (5.88) where k is the number of shadow maps. The storage factor decreases more rapidly for ZP than forFP+ZP+P as the number of shadow maps increases.

With the light behind, the error forZPschemes decreases rapidly and then begins to grow slowly. This growth is caused by the significant amount of overlap of the shadow maps that occurs with this light direction. In fact, ask→ ∞, Sbehind

ZP diverges to∞. The FP+ZP+P scheme has very little overlap and as the number of shadow maps increases, it eventually has lower error than the ZP schemes and converges to the same error as Sbehind

FP+LogP. Figure 5.41 shows where the cross over occurs between the two schemes.

Based on our analysis, z-partitioning with warping (ZP+P) is the best scheme to use for rendering shadows with a low number of shadow maps in scenes with a high depth range. Most of the benefit comes from thez-partitioning. Over all light directions, the maximum error is

1 4 8 12 16 20 24 101 102 103 104 105

f

e

/ n

e

Number of shadow maps

ZP / ZP+P

FP+ZP+P

cros s ov

er

Figure 5.41: Lowest error for light behind. This graph shows the parameter values for which thez-partitioning (ZP, ZP+P) schemes and face partitioning (FP+ZP+P) yield the lowest error. z-partitioning is the best scheme for high depth range with few shadow maps (blue region).

not affected much by the warping because it cannot be used in the high error configurations where the light direction is aligned with the view vector. However, warping does reduce the average maximum error. The effect of warping is diminished with an increased number of partitions because the depth ratio of each partition decreases.

We have analyzed only two light directions. Closed form expressions for the error in the general case are difficult to formulate because of the complex operation of fitting a warping frustum with varying parameters to an arbitrarily oriented view frustum. Figure 5.42 shows the maximum storage factor over all light directions computed by a dense sampling of light directions on the hemisphere. For all combinations of warping, partitioning, and number of partitions, we see that the worst case S is within a factor of 2–3 times of that which we computed analytically for the light behind case.