Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logarithmic perspective shadow maps

Similar presentations


Presentation on theme: "Logarithmic perspective shadow maps"— Presentation transcript:

1 Logarithmic perspective shadow maps
Brandon Lloyd1,2 Naga Govindaraju2 Cory Quammen1 Steve Molnar3 Dinesh Manocha1 1University of North Carolina – Chapel Hill 2Microsoft 3NVIDIA

2 Goal Low error shadows for real-time applications
Emphasis on performance The goal of this paper is to provide high-quality shadows for real-time applications. But because shadows computation must ai, physics, animation, and other rendering operations, we place emphasis on performance

3 Standard Shadow Map undersampled aliasing
Shadow maps are commonly use for real-time shadows because they are fairly simple and relatively cheap. The depth buffer rendered from the view point of the light is used to determine if a point is in shadow. Unfortunately, this discrete representation can lead to aliasing errors that result in jagged shadow boundaries. From the viewpoint of the light, the view frustum looks something like this. And we can immediately see that the regions near the viewer are undersampled. In fact, this block is the projection of a single texel from the shadow map. undersampled aliasing

4 Perspective Warping To reduce aliasing, a number of existing methods warp the shadow map using a perspective transformation to increase the number of samples in regions near the viewer.

5 Logarithmic Perspective Warping
In this paper we show, that with an additional logarithmic warping, we can reduce maximum error to levels that are nearly optimal for scene-independent algorithms.

6 Outline Related work Logarithmic perspective warping Error analysis
Experimental results Conclusion In this talk we’ll briefly touch on related work and look at the formulation of the logarithmic perspective parameterization. Much of the paper consists of an extensive error analysis of both our algorithms and others so we’ll look at some of the high level results there, and then finish off with some experimental results

7 Single shadow map warping
Perspective shadow maps (PSMs) [Stamminger and Drettakis 2002] Light-space perspective shadow maps (LiSPSMs) [Wimmer et al. 2004] Trapezoidal shadow maps [Martin and Tan 2004] Single shadow map warping techniques like PSMs and their variants, have about the same performance as a standard shadow. From the viewpoint of an overhead directional light, we can see that they warp the shadow map to better fit the trapezoidal shape of the view frustum …

8 Single shadow map warping
Warping cannot be used for all light directions But when the light moves behind the view frustum, the warping reverts back to a standard shadow map with high error.

9 Face partitioning Perspective warped cube maps [Kozlov 2004]
This problem can be addressed by partitioning the view frustum into regions corresponding to its faces and applying warping to the partitions.

10 z-partitioning Cascaded shadow maps [Engel 2007]
Parallel split shadow maps [Zhang et al. 2006] Separating-plane shadow maps [Mikkelsen 2007] Other algorithms adapt to the shape of the view frustum by partitioning along the z-axis in eye space. z

11 z-partitioning Cascaded shadow maps [Engel 2007]
Parallel split shadow maps [Zhang et al. 2006] Separating-plane shadow maps [Mikkelsen 2007] Warping can also be applied for further error reductions z

12 Adaptive partitioning
Adaptive shadow maps [Fernando et al. 2001] Queried virtual shadow maps [Geigl and Wimmer 2007] Fitted virtual shadow maps [Geigl and Wimmer 2007] Resolution matched shadow maps [Lefohn et al. 2007] Tiled shadow maps [Arvo 2004] Multiple shadow frusta [Forsyth 2006] Adaptive techniques locally refine the shadow map into a number of partitions with varying spatial extent, to increase the sample density only where needed

13 [Aila and Laine 2004; Johnson et al. 2004]
Irregular z-buffer [Aila and Laine 2004; Johnson et al. 2004] GPU implementations [Arvo 2006; Sintorn et al. 2008] Hardware architecture [Johnson et al. 2005] In the limit where each partition of an adaptive technique consists of a single pixel we get the irregular z-buffer, which can completely eliminate aliasing.

14 Methods for better sampling
Scene-independent Single SM warping Face partitioning z-partitioning Scene-dependent Adaptive Irregular + Lower, nearly constant cost – Higher error + Lower error – Higher, variable cost All of these algorithms aim to improve the shadow map sampling distribution. The first three classes are more or less scene independent. They have the advantage of having low, nearly constant performance cost, but they tend to have higher error because they don’t take surface orientation into account. The other algorithms are more accurate because they do address surface orientation, but they can be considerably slower than standard shadow maps.

15 Filtering Percentage closer filtering [Reeves et al. 1987]
Variance shadow maps [Donnely and Lauritzen 2006; Lauritzen and McCool 2008] Convolution shadow maps [Annen et al. 2007] Exponential shadow maps [Salvi 2008; Annen et al. 2008] Another way to address aliasing is to smooth the jagged shadow boundaries by filtering them. To get the best results, filtering can be combined with improved sampling techniques

16 Standard Shadow Map Here is the previous image of a standard shadow map.

17 Standard Shadow Map If we apply filtering, the shadow is smoothed beyond recognition

18 Perspective Warping With perspective warping we get something more desireable

19 Logarithmic Perspective Warping
LogPSM can achieve similar results with less resolution

20 Logarithmic perspective shadow maps (LogPSMs)
Replace perspective warping in scene-independent single shadow map z-partitioning face partitioning Similar performance with less error Similar error with less texture resolution In this paper, we formulate 3 types LogPSMs replace the logarithmic perspective warping of the scene-independent methods with a logarithmic perspective warping. This means that they can potentially deliver the same good perf. as other scene-independent methods, but with less error. Or stated another way, they can deliver the same error as the other methods with less resolution

21 Outline Related work Logarithmic perspective warping Error analysis
Experimental results Conclusion Now let’s look at the formulation of logarithmic perspective warping

22 Perspective warping Not necessarily the best fit to required sampling distribution PSM LiSPSM We begin by looking at perspective warping alone. The problem here is that it does not necessarily give the best fit… For example, with an overhead directional light, a PSM produces a tight fit to the view frustum, giving low error in x, but high error along y. LiSPSMs relax the warping to reduce the error in y, but this increases the error in x high error moderate error y x low error moderate error

23 Logarithmic+perspective warping
high error low error y x Our warping function starts with perspective projection similar to PSMs, but then applies a logarithmic transformation to correct for the high error in y. This gives LogPSMs low error in both directions. Now this warping function causes planar primitives to become curved, so to render a LogPSM we need to use a specialized rasterization. Perspective projection Logarithmic transform

24 Logarithmic rasterization
Brute-force rasterization use a fragment program Slower than standard rasterization disables optimizations z-culling double-speed z-only rendering breaks linear depth compression schemes On current hardware, logarithmic rasterization can be implemented using a fragment program by rendering bounding quads for each warped triangle and discarding fragments that fall outside the curved edges. This method, however, is considerably slower than standard rasterization. Because we write depth, a number of important optimizations are disabled. The resulting curved surfaces also break linear depth compression schemes.

25 Logarithmic rasterization
Hardware rasterization [Lloyd et al. 2007] equivalent to rasterizing on non-uniform grid requires incremental modifications Software rasterization Larrabee [Seiler et al. 2008] Performance comparable to standard rasterization We presented a paper in graphics hardware last year that showed how logarithmic rasterization is equivalent to rasterizing on a non-uniform grid, and could therefore be implemented in hardware with incremental modifications to the rasterizer, while still maintain optimizations like z-culling. Logarithmic rasterization is even easier to implement on architectures like the upcoming Larrabee GPUs that do all rasterization in software. Therefore it should be possible to implement logarithmic rasterization with performance that is comparable to standard linear rasterization. This means that LogPSM should have performance similar to the perspective warping methods upon which they are based.

26 Outline Related work Logarithmic perspective warping Error analysis
Experimental results Conclusion

27 Error analysis Need more analysis for previous methods
little analysis for point lights limited analysis for lights in general position [Tadamura et al. 1999; Zhang et al. 2006] To better understand the error characteristics of all these algorithms we do some theoretical analysis for both LogPSMs and existing methods. There is no theoretical analysis for some of the methods, and for other the analysis is limited. In particular there has been very little analysis for point lights and only limited analysis for lights in general position. In addition we need to look at the combinations of the algorithms.

28 Combinations of algorithms
P - Perspective warping LogP - Logarithmic perspective warping ZP - z-partitioning FP - face partitioning We also need to look at the combinations of algorithms. We have three major categories – single, zp, and fp. In each of these categories we can use no warping, perspective warping, and logarithmic perspective warping. Let’s assume that we allocate the same total amount of shadow map resolution to all of these methods and that the relative performance is going to depend mostly on the number of render passes. If we want an algorithm with low error and high performance, the question becomes single SM Standard P LogP z-partitioning ZP ZP+P ZP+LogP face-partitioning - FP+P FP+LogP

29 Combinations of algorithms
P - Perspective warping LogP - Logarithmic perspective warping ZP - z-partitioning FP - face partitioning single SM Standard P LogP z-partitioning ZP ZP+P ZP+LogP face-partitioning FP+P FP+LogP Unfortunately, the answer is going to be “It depends” and we don’t have time to go into all the details. But what I want you come away with from this part of the talk is a basic intuition for some of the tradeoffs involved and the benefit that LogPSMs can give Which algorithm gives the least error for the fewest shadow maps?

30 Quantifying aliasing error
shadow map light light image plane Let’s look briefly at how we quantify aliasing error. The mapping of texels from the shadow map to the light image plane depends on the warping function, or parameterization. If we trace a beam from the light through two adjacent samples onto a surface in the scene, and a beam from the eye through two adjacent pixels in the image, we can define the aliasing error as the ratio of the projections of the two beams on the surface. Ideally we want this ratio to be 1. The size of these projections depends on a number of factors – pos of light and eye, resolutions of the shadow map and the image, the parameterization, and the orientation of the surface. eye eye image plane

31 Quantifying aliasing error
shadow map light light image plane Scene-independent methods don’t know anything about the orientation of the surfaces, so for these methods we use instead the width of the beams at their intersection point. Now in an real-time application where the user has control of the camera shadows can conceivable occur anywhere inside the view frustum so we want to bound the maximum possible error. eye eye image plane

32 Quantifying aliasing error
shadow map light light image plane Maximum error: over a light ray over the frustum over all light positions In the paper we show that computing the error at the intersection of a light ray with the frustum faces gives a tight lower bound for the maximum error along the entire ray. So we use this as the maximum error metric. Depending on the context, I’ll be using maximum error of a light ray, over the view frustum, and over all light positions. eye eye image plane

33 Near optimal, scene-independent warping
Minimizes maximum error over a face Too complicated for practical use Used as a baseline In the paper we discuss how to compute a warping function that minimizes the maximum error by making it constant over each face.

34 Maximum error over all light positions
Param. End face Side face - s Side face - t Side face - combined Uniform Perspective Log+Persp. Near optimal Here are the results for different face of the view frustum. I am not going to discuss these in detail but I want you to notice that the error depends highly on the far to near plane depth ratio of view frustum. So I’m going to have the most error with something like an outdoor scene where I can see shadows on a surface a foot away from me, on a building 1000 feet aways, and anywhere in between. In particular look at the differences for the combined error in the s and t directions on a side face. If our depth ratio happens to be 1000, perspective warping will have over 100 times much as error as logarithmic perpspective warping. The most important thing to notice is that the logPSM parameterization has the same error bounds as the optimal parameterization. Logarithmic perspective warping is about the best we can do for scene-independent algorithms

35 Error distribution along a face
Uniform LiSPSM PSM LogPSM max error in t max error in s Here is the error distribution in the s and t directions for a directional light above a side face Uniform – max at near plane in both directions LiSPSM minimizes the maximum in t. Still has significant error in s near the viewer PSM – perfect match -> constant in s. In t, the error is high as we approach the far. The error for a LogPSM is lower than the maximum of the other algorithms and the distiribution is uniform. Now let’s move on to single shadow map methods near far near far Uniform LiSPSM PSM LogPSM

36 Maximum error for varying light directions
25 Standard Perspective 20 Log+perspective 15 max error (log2 scale) direction to light Log scale graph of maximum error over the entire view frustum for varying light directions The light direction varies from behind the viewer to directly overhead Standard shadow maps have nearly constant error The error for a perspective warping technique drops off dramatically when the light angle is greater than half the field of view, reaching its minimum when the light is directly overhead Logarithmic perspective warping has similar behavior, but with significantly less error. Note that the function used to ramp off the warping for low angles, that used by LiSPSMs, actually causes the error to exceed that of a standard shadow map. 10 5 view direction 20 40 60 80

37 Maximum error for varying light directions
25 Standard Perspective 20 Log+perspective FP+LogP 15 max error (log2 scale) direction to light In the paper we show how to fix that. So here we can see that the main drawback of single shadow map warping algorithms is that they have a huge range of error. FP+LogP gives low error over all light directions, but uses more than 1 shadow map. 10 5 view direction 20 40 60 80

38 z-partitioning error reduction max error (log2 scale) These graphs show the maximum error for z-partitioning with varying number of partitions. There is a lot to discuss here, but I want to just point out a few things. The graph for 1 partition is of course the same as the one we saw for the single shadow map algorithms. As we increase the number of partitions notice how z-partitioning reduces the maximum error no matter which parameterization we use. With only 2 partitions and no warping the error is already about the same as the lowest error we get with perspective warping on a single shadow map. At 16 partitions we are approaching the same low error that we from LogPSMs that use face partitioning. The number of shadow maps used by these algorithms varies with the light direction, but the average is only 3.8. Notice too that z-partitioning has little effect on a LogPSM when the light is nearly over head because the warping already provides about the lowest error possible. The z-partitoining just reduces the high error for the light behind Finally, I want to point out that the logartihmic warping algorithms provide the lowest error overall. FP uses 1-7 partitions (3.8 average) max error (log2 scale)

39 Least error for fewest shadow maps?
max error (log2 scale) So which algorithm gives the least error for the fewest number of shadow maps? Single shadow with logarithm perspective warping -> near optimal error for the light overhead, but you get high errro for light behind FP requires less than 4 shadow maps on average, and gives low error over all light directions ZP with no warping, which is easier to implement, can give close to the same results, but only for a larger number of partitions FP uses 1-7 partitions (3.8 average) max error (log2 scale)

40 Outline Related work Logarithmic perspective warping Error analysis
Experimental results Conclusion

41 Single shadow map LogPSM
LogPSMs have lower maximum error more uniform error Image resolution: 5122 Shadow map resolution: f/n = 300 Grid lines for every 10 shadow map texels Color coding for maximum texel extent in image These images compare LogPSMs to a perspective warping technique. Here are images from a power plant model, looking over a ledge. Project lines for every 10 shadow map texels. The bottom row is a color coding of the actual aliasing error, not just the scene independent metric. LogPSMs have lower maximum error an more uniform error distribution. LiSPSM LogPSM LiSPSM LogPSM

42 Partitioning schemes Standard FP+P ZP5+P FP+LogP In particular I want you to notice the higher sampling density and correspondingly lower error of the LogPSM Error is easier to see

43 Comparison video Standard shadow maps have adequate sampling in the distance but have high error near the viewer PSMs have high quality near the viewer, but have high in the distance. LSPSM have a better balance between the near and far plane, but can still exhibit aliasing LogPSMs have low error both near the viewer far away Cascade are a discrete approximation of a LogPSM, 5 shadow maps are used here Standard have roughly the same error over all light directions Perspective warping techniques exhibit high error when light moves behind the viewer LogPSM with face partitioning technique to achieve low error over all light directions ZP also has uniform error, but inferior sampling PSM = LiSPSM with PSM parameter Cascaded = ZP5 LogPSM = FP+LogP

44 Point lights Pay particular attention to the shadows near the viewer

45 Point lights Figure out what to look for. Red is bad

46 Limitations of LogPSMs
Not currently supported in hardware Share problems as other warping algorithms: do not handle aliasing error due to surface orientation face partitioning needed for most benefit not as simple as z-partitioning can exhibit shearing artifacts

47 Conclusion LogPSMs Error analysis Single shadow map z-partitioning
face partitioning Error analysis LogPSMs are close to optimal for scene-independent algorithms LogPSMs achieve low error with few shadow maps c

48 Future work Other error metrics [Zhang et al. 2007]
Combine with scene-dependent algorithms LiSPSM + adaptive [Giegl and Wimmer 2007] LiSPSM + irregular [Sintorn et al. 2008]

49 Acknowledgements Aaron Lefohn and Taylor Holliday for town model
Ben Cloward for robot model David Feng and Nico Galoppo Funding agencies NVIDIA University Fellowship NSF Graduate Fellowship ARO, NSF, DARPA/RDECOM, Disruptive Technology Office

50 Questions

51 Face partitioning Low error over all light positions
Omnidirectional lights Based on our error metric we will start by looking at the face partitioning algorithms. Face partitioning provides low error over all light positions for both directional and point lights. It also supports omnidirectional lights such as this one inside the view frustum.

52 z-partitioning f n In effect reduces f/n
In effect reduces f/n Now let’s talk about z-partitioning Recall that the error of the various algorithms depends strongly on the far to near plane distance ratio. The effect of z-partitioning is to reduce this ratio by partitioning the view frustum into smaller pieces

53 z-partitioning f n In effect reduces f/n
Costly for omni- directional lights z-partitioning can be combined with face partitioning to reduce error for omni-directional lights, but this is expensive because the z-partitioning has to be applied to several faces. n

54 Future work Incorporate rough scene information
use a ‘pseudo-near plane’ [Lloyd 2007] conflicting ??? – users want to set it as close as possible to avoid clipping geometry. Shadows far away as possible. higher error pseudo-near plane low error

55 Scene-independent maximum error
Standard FP+P ZP5+P FP+LogP

56 Handling shear

57 Handling shear


Download ppt "Logarithmic perspective shadow maps"

Similar presentations


Ads by Google