Sie sind auf Seite 1von 11

REALTIMESHADOWMAPPING

LeonClark
06015581
WordCount:5100

ABSTRACT

Incomputergraphics,shadowmappingisoneofthemostwidelyusedtechniquesforrenderingshadowsinreal
time.Thespeedandversatilityofshadowmappinghavemadethisthecase.However,duetothevastamount
of research on the subject it is often difficult to determine which shadow mapping method is best suited to a
particularapplication.Therefore,thispaperprovidesabroadoverviewofthefield,withafocusonalgorithms
thatcanprovidehighqualityshadowsinrealtime.Assessmentsaremadeofthesealgorithms,andguidelines
presentedforchoosingthebestmethodsappropriatetotheneedsofthereader.

1.INTRODUCTION

Shadows are an important aspect of computer


graphics that help to convey depth, and therefore
realism, in computer generated imagery. The two
mostpopularapproachesforrenderingshadowsin
real time are shadow mapping and shadow
volumes. Of these techniques, shadow mapping
hasseenthemostwidespreaduseduetoitsspeed
and versatility (Brabec, et al., 2002a).
Nevertheless,shadowmappingpresentsanumber
ofchallenges,whichavastamountofresearchhas
soughttoovercome.Inthefollowingsections,this
paper presents the most common problems
associated with shadow mapping and the varied
techniques proposed to solve them. The final
sections then present general guidelines for
selecting the most suitable shadow mapping
method.

2.SHADOWMAPPING

Shadowmappingbuildsupontheobservationthat
asurfacemustbevisibletoalightsourceinorder
to receive illumination from the light source
(Williams, 1978). To facilitate the visibility test a
scene is first rendered from the position of a light
source,storingonlythedepthvaluesoftheclosest
visible surfaces. The resulting image is known as
the depth/shadow map (Eisemann, et al., 2011).
Next the scene is rendered from an observers
viewpoint. During this stage the position of each
fragment
1
is transformed into light space
2
, after
whichafragmentsdistancetothelightsourcecan
be compared with the corresponding depth value
intheshadowmap.Ifafragmentsdistancetothe
lightsourceisgreaterthanthestoreddepthvalue
it must lie in shadow and can be shaded
accordingly.

Figure1:Renderingashadowmap(left),and
samplingashadowmap(right).

A major benefit of shadow mapping is that it can


be implemented using scanline rasterisation on
standard graphics hardware (Eisemann, et al.,
2011). It therefore does not depend directly on
scenecomplexityorgeometricrepresentationand
has significant potential for acceleration. On the
otherhand,asanimagebasedtechniqueitsuffers
fromanumberofproblems,themostimportantof

1
Afragmentrepresentstheportionofageometric
primitive that is visible to a pixel in eye space
(AkenineMller,etal.,2008).

2
A space is a boundless threedimensional region
witharelativepointoforigin(Weisstein,1999).
which are the handling of omnidirectional light
sources (Section 2.1), aliasing (Section 2.2), and
depth value precision (Section 2.4) (Scherzer, et
al.,2011).

2.1OMNIDIRECTIONALSHADOWMAPS

Rendering a 3D scene necessarily involves


projecting geometry from 3D space to the 2D
plane for rasterisation (Gascuel, et al., 2008). The
projection step is typically accomplished using
linear transformations, which current graphics
hardware is well adapted to perform. However,
suchlinearprojectionshavealimitedfieldofview.
Rendering a hemispherical field of view requires
the use of either a single nonlinear projection, or
thecombinationofmultiplelinearprojections.

The conventional approach to omnidirectional


shadow maps is cube mapping (Eisemann, et al.,
2011). Here the scene is rendered six times using
linear projection, with eachmap representing one
sideofacubecentredonthelightsource.Modern
graphics hardware can perform a single texture
lookup on the resulting cube map, but due to the
number of times the scene geometry must be
processeditisexpensivetoproduce.

Another solution is to use parabolic mapping,


which belongs to a class of nonlinear projections
(Gascuel, et al., 2008). In this case only two
renderings are required to capture an
omnidirectionalfieldofview,witheachprojecting
one halfuniverse to a disk. While more expensive
to compute than linear projections, the reduced
number of rendering passes can make this
technique more efficient than cube mapping.
However, due to the nature of nonlinear
projections the output map may contain
distortions,whichwillaffectshadowaccuracy.

A third approach called tetrahedron mapping


(Liao, 2010) follows from the observation that a
tetrahedron is the polyhedron with the lowest
number of faces that encloses a point (Eisemann,
etal.,2011).Consequently,atetrahedronmapcan
be constructed from just four scene renderings
using linear projection, and can take advantage of
the same hardware features as cube mapping.
Results published by Liao (2010) suggest that
tetrahedronmapshavethesameaccuracyascube
maps while requiring much less compute time to
produce. On the other hand, this technique has a
greater memory footprint than cube mapping,
which could be a limiting factor in memory
constrainedenvironments.
2.2ALIASING

Aliasing in shadow mapping is an unwanted visual


artefactoftencharacterisedbyjaggedorflickering
edges at shadow boundaries (Scherzer, et al.,
2011).Ithasthreemaincausesknownassampling
error,reconstructionerror,andtemporalaliasing.

Ashadowmapissaidtocontainsamplingerrorsif
there does not exist a 1:1 mapping between all
shadowmapsamplesandfragmentsineyespace.
For any given area of the scene, if the ratio of
samples to fragments is less than one the map is
undersampled. Where the opposite is true, the
mapisoversampled.

Reconstructionerrorisrelatedtotheshadowmap
visibilitytest.Duetothenonlinearityofthetest,it
isnotpossibletoperformlinearfiltering
3
ofdepth
values. Only nearestneighbour lookup, or point
filtering, is possible when querying visibility. In
oversampled areas this can cause aliasing due to
information loss. Conversely, undersampled areas
may appear magnified in the scene leading to
oversized staircase artefacts (Eisemann, et al.,
2011).

Temporal aliasing is caused by variations in


samplingdensityovertime(Scherzer,etal.,2011).
More specifically, if the distribution of samples
projected to a surface should differ from one
frame to the next any shadows cast there may
appeartoflickerandchange.

Inordertoeliminatealiasingasaresultofshadow
mapping most publications focus on reducing the
samplingerror,sincethisinturnwillminimisethe
other two types of error. In addition more
advanced filtering techniques may be used at the
cost of increased rendering time (Section 2.3.2).
Whilefilteringcancombataliasinginoversampled
areas, it may also lead to excessive blurring of
shadow boundaries in undersampled areas
(Eisemann, et al., 2011). Therefore, the main
priority of any shadow mapping method is to
reduceundersampling.

3
In signal processing a filter is a method used to
reconstructacontinuoussignalfromadiscreetset
ofsamples(AkenineMller,etal.,2008).
2.3SAMPLINGERROR

As first observed by Stamminger and Drettakis


(2002) sampling error can be split into two
components, these being projection aliasing and
perspectivealiasing.

Figure2:Theorientationofasurfacecausing
projectionaliasing(left),perspectivealiasing
causedbyforeshortening(right).

Projectionaliasingiscausedbytheorientationofa
surface relative to the light source and the
observer (Lloyd, et al., 2006). When a surface is
near parallel to the light direction, yet near
perpendicular to the eye view, it may receive
fewer depth samples than are required in eye
space. In this case, the area is undersampled.
Naturally, where the opposite is true the area is
oversampled. Since this is a local phenomenon it
can only be treated by locally adaptive sampling
methodsbasedonsceneanalysis(Sections2.3.1.5
2.3.1.6).

Perspective aliasing, on the other hand, is due to


the perspective projection of an observer. A
property of this projection, known as perspective
foreshortening, leads to objects becoming smaller
or larger as their distance to the observer
increases or decreases respectively (Dunn &
Parberry, 2002). A consequence of this is that
nearby surfaces may become undersampled, and
distant surfaces oversampled, when the direction
oftheforeshorteningeffectoccursalonganaxisof
the shadow map (Scherzer, et al., 2011). The
effects of perspective aliasing are therefore highly
noticeable in a scene. Unlike projection aliasing
however, perspective aliasing is a global
phenomenon and can be mitigated using both
globally adaptive (Sections 2.3.1.2 2.3.1.3) and
locallyadaptivetechniques.

2.3.1MINIMISINGSAMPLINGERROR

Owingtothepopularityofshadowmappinginreal
time rendering, many approaches have been
proposed to address the problem of sampling
error (Scherzer, et al., 2011). These can be split
into four categories, which are fitting, warping,
partitioning, and irregular sampling based
methods. It is important to note that for
implementation purposes these are not mutually
exclusive, and many may be combined for greater
effect.

2.3.1.1FITTING

Fitting or focusing techniques, first described by


Brabec et al. (2002a), are some of the simplest
methods for minimising sampling error. As a
globally adaptive technique, fitting adjusts a
shadow map to encompass only the parts of the
scenewhicharevisibletotheobserver.Indoingso
the available sampling density for visible surfaces
is maximised, whilst preventing the wasting of
samples on invisible areas. This is particularly
useful for large outdoor environments where only
a small subset of the scene may be visible at any
onetime.

Fitting a shadow map to a scene necessitates the


definitionofavolumecontainingallrelevantscene
geometry. This volume is known as the focus
region (Stamminger & Drettakis, 2002). The first
step to finding the focus region is to calculate the
convexhullMoftheviewfrustum
4
Fandthelight
source position | (for directional lights the
position |isinfinitelydistant).Next,thevolume M
is intersected with the scene bounding box S, and
the light frustum L, giving the focus region H
(Figure3).Finallythelightfrustumcanbemodified
tocoveronlythefocusregion.

Figure3:Computingthefocusregion.

4
A frustum is the portion of a solid which lies
between two parallel planes cutting the solid.
(Weisstein, 1999) In 3D computer graphics this
typicallyreferstothepyramidalfrustumenclosing
aperspectiveviewspace.

Although the above geometric approach to fitting


is inexpensive it is not necessarily the most
optimal.Forexample,ifanearfieldobjectwereto
obscure more distant parts of the scene the focus
region could still contain invisible geometry. To
counter this it is possible to use the visibility
information of an observer at the expense of
additionalrenderingtime(Eisemann,etal.,2011).
Online occlusion culling techniques such as
coherent hierarchical culling (CHC) (Mattausch, et
al., 2008) can be used to quickly test the visibility
of objects in the scene. Still greater accuracy can
be achieved by calculating the sample distribution
of a scene using a depthonly render pass
(Lauritzen, et al., 2011). Whether such techniques
can increase quality sufficiently as to justify their
cost is dependent on the scene and application. It
isthereforeadvisabletoperformadequatetesting
whenconsideringtheiruse.

Unfortunately fitting can also cause significant


temporal aliasing, owing to the fact that the
sample distribution is altered according to the
view of the observer. It is important therefore to
ensure that a good reconstruction filter is used
when employing this technique (Section 2.3.2)
(Scherzer,etal.,2011).

2.3.1.2WARPING

Warpingalgorithmsareaclassofgloballyadaptive
techniques that alter the parameterisation of a
shadow map in order to counteract perspective
aliasing. In standard shadow mapping the
perspectiveprojectionofanobserverisappliedto
thesceneafterashadowmaphasbeenrendered.
This leads to a higher sample distribution for
distant parts of the scene as opposed to those
close to the centre of projection. Warping
algorithms instead apply a perspective
transformationtothescenebeforerenderingitto
the shadow map, thereby concentrating more
samplesnearthecentreofprojection.

Figure4:Warpingappliedtoaperspectiveview
space P.

The first of these algorithms is known as


perspective shadow mapping (PSM) (Stamminger
& Drettakis, 2002). With PSM the perspective
projection of the observer is applied to both the
scene and the light source before rendering a
shadow map. This warping process comes at
almost no performance cost when compared with
standardshadowmapping,whilealsobeingsimple
toimplement(Lloyd,etal.,2006).However,rather
than minimise the sampling error over the entire
depth range PSM merely inverts the error caused
byperspectivealiasing.Inadditiontheperspective
transformation,whenappliedtoalightsource,can
change the direction and/or type of the light in
certain circumstances. This places further
requirements on the software to handle such
boundarycases.

An improvement to PSM called light space


perspectiveshadowmapping(LiSPSM)avoidsmost
of the problems inherent in the PSM algorithm
(Wimmer, et al., 2004). Rather than employ the
perspective transformation of an observer for the
warpingstepLiSPSMconstructsanewperspective
transformation in light space. The advantage of
this is that all lights are treated as the same type,
and their direction does not change following
transformation. Furthermore, by decoupling the
warping transformation from the observerLiSPSM
allows the strength of the warping effect to be
controlled. A stronger warp concentrates more
samples near the centre of projection, much like
the PSM method, while a weaker warp distributes
more samples to the far field as with standard
shadowmapping.

A second approach to address the limitations of


PSM is known as trapezoidal shadow mapping
(TSM) (Martin & Tan, 2004). Although TSM was
proposed independently of LiSPSM, both
techniques produce the same transformation for
the warping step. The major difference between
the two methods is that TSM uses a heuristic to
choose the strength of the warping effect. An
analysis of warping techniques by Lloyd et al.
(2006) demonstrates that PSM, LiSPSM, and TSM
result in the same samplingerror overall, but that
LiSPSM provides the most even distribution of
errorinascene.LiSPSMisthereforethepreferred
methodforwarpinginshadowmapping.

Afundamentallimitationofallwarpingtechniques
is that they address only the perspective aliasing
component of sampling error (Stamminger &
Drettakis, 2002). As such, the quality of these
methods degrades to that of standard shadow
mapping as the view and light directions near
alignment. This, in addition to the fact that
warping is a viewdependent approach, can also
lead to temporal aliasing. As with the fitting
techniques discussed previously, filtering may
improvequalityinthiscase(Section2.3.2).

2.3.1.3GLOBALPARTITIONING

Global partitioning algorithms are another group


oftechniquesthatfocusonminimisingperspective
aliasing (Eisemann, et al., 2011). To do so these
methodsusemultipleshadowmaps,eachofwhich
covers a separate region or partition of the view
frustum. This allows an individual shadow map to
better approximate the ideal sample distribution
of its local area, thereby reducing the perspective
error overall. Currently there are two approaches
to global partitioning known as zpartitioning, and
frustumfacepartitioning.

Figure5:Zpartitioningoftheviewfrustum.

Zpartitioning (Lloyd, et al., 2006), also known as


parallel split shadow mapping (PSSM) (Zhang, et
al., 2006) or cascaded shadow mapping (CSM)
(Engel, 2006), splits the view frustum along the Z
axis and assigns shadow maps of equal resolution
to each sub frusta. This results in higher sampling
densities near the centre of projection where the
frustacoverasmallerarea.Naturally,theopposite
istrueatthefarendoftheviewfrustum.

Asimplisticapproachtozpartitioningwouldbeto
render each shadow map as a separate pass
throughthegraphicspipeline(Zhang,etal.,2007).
While this may be the only option for older
hardware, it is also the least efficient. Instead
Zhangetal.proposerenderingallshadowmapsin
a single pass, using a geometry shader
5
to deliver
the same scene geometry to multiple render
targets. The authors note that this approach
increases efficiency significantly though no exact
measurementsaregiven.

When partitioning the view frustum the obvious


question arises of where to locate the partition
boundaries, or split planes, along theZaxis. A
navesolutionwouldbetopositionthesplitplanes
atequidistantpoints.However,accordingtoLloyd
et al. a better solution is to position the planes at
logarithmically increasing distances from the
centreofprojection(2006).Thishastheeffectthat
allfrustabecomeselfsimilar
6
,therebydistributing
the maximum sampling error equally for all
partitions. In this case, the location of each split
plane | {1, 2, , k -1]isgivenby:

S
|
= z
n
_
z

z
n
]
|
k

(1)

Here k is the number of partitions and the


values z
n
and z

arethedistancestothenearand
farplanesoftheviewfrustumrespectively.

Although logarithmic spacing is theoretically


optimal,Zhangetal.arguethatthisisnotthecase
in practice (2006). The authors point to the fact
that for most scenes the area closest to the near
plane is devoid of geometry. Allocating a high
resolution partition to this area is therefore
inefficient. The authors instead suggest using a
weighted average of the equidistant and
logarithmicdistributionstoextendthecoverageof
the smallest partitions. However, fitting can
circumventthisproblembyprovidingthedistance
to the closest visible geometry. This distance
becomes the pseudo near plane z
n
i
that
substitutes the value z
n
in Eq. 1. In doing so, the
first partition is always located at the start of the
visibledepthrange.

As noted previously, logarithmic spacing allocates


shadow map samples evenly throughout a scene.
While this is advantageous in a general context, a
better solution would be to distribute partitions
according to the sample requirements of the
scene. To achieve this, Lauritzen et al. propose
sample distribution shadow mapping (SDSM). This

5
A shader is a custom program executed by the
graphicshardwareatselectstagesintherendering
pipeline(AkenineMller,etal.,2008).
6
A selfsimilar object will appear approximately
thesameonanyscale(Weisstein,1999).
method performs a scene analysis, using a single
depthonlyrenderpass,tocalculateahistogramof
the required sample distribution. The information
in the depth histogram allows for optimal
placement of the split planes, thereby minimising
the maximum error over the whole depth range.
When comparing SDSM to PSSM the authors note
that for small scenes SDSM has a processing
overhead of up to 1.4ms (milliseconds). In large
scenes however, SDSM was able to reduce
renderingtimebyupto2.3ms.Thisisduethefact
that the scene analysis allows for tighter fitting,
thereby excluding much of the larger scenes
geometryfromtherenderingpass.

In contrast to zpartitioning approaches, frustum


face partitioning methods subdivide the faces of
the view frustum to create the partitions
(Scherzer, et al., 2011). However, an analysis by
Lloyd et al. has shown that for practical
configurations this technique is inferior to z
partitioning(2006).

The primary advantage of global partitioning


techniques over warping methods is that their
quality does not degrade as the view and light
directions near alignment. Global partitioning is
therefore far more robust than warping, but
requires the use of multiple shadow maps at the
expenseofadditionalrenderingtime.

2.3.1.4HYBRIDTECHNIQUES

Since warping and global partitioning techniques


are orthogonal approaches, it is possible to
combine them for greater effect (Scherzer, et al.,
2011). Implementing a hybrid method is a simple
matter of applying warping to the shadow map of
each partition. This can reduce sampling error in
situations where warping is best suited, i.e. when
the light and view directions are perpendicular
(Lloyd, et al., 2006). In addition, due to the
negligible performance impact of warping it is an
obvious candidate for improving the shadow
qualityofglobalpartitioningtechniques.

2.3.1.5LOCALPARTITIONING

Much like global partitioning approaches, local


partitioningtechniquesusemultipleshadowmaps
to reduce sampling error. In this case, however,
local partitioning methods recursively subdivide
the shadow map itself into smaller maps or tiles
(Eisemann, et al., 2011). These tiles are organised
hierarchically using a tree
7
data structure, with
each child node representing a higher resolution
portionoftheparenttile.Thisstructureallowsfor
successiverefinementofshadowmapsatthelocal
scene level, thereby alleviating both perspective
andprojectivealiasing.

The first proposed method of local partitioning is


adaptiveshadowmapping(ASM)(Fernando,etal.,
2001)(Lefohn,etal.,2005).Thistechniquerefines
a shadow map only at shadow boundaries where
thesamplingerrorleadstoaliasing.Todothisthe
algorithm tests each tile for depth discontinuities
in eye space. Subdivision of a tile occurs if a
discontinuous region exists and the resolution of
the tile is lower than that required in eye space.
AlthoughASMcanproducepixelperfectshadows,
the sheer number of rendering passes required,
combinedwiththecostoftheboundarydetection
step, makes this a computationally expensive
technique.

A similar approach to ASM is queried virtual


shadow mapping (QVSM) (Giegl & Wimmer,
2007a). This method also follows an iterative
improvementparadigm.However,insteadofusing
boundary detection QVSM draws each rendered
tile to a shadow result buffer and monitors the
number of changed pixels. Tile subdivision
continuesuntilthenumberofchangesobservedin
the result buffer drops below a specific threshold.
This approach makes QVSM much simpler to
implementthanASM,althoughQVSMstillrequires
ahighnumberofrenderingpassestoconverge.

In order to circumvent the performance penalties


of iterative improvement Lefohn et al. suggest a
simplification of ASM known as resolution
matched shadow mapping (RMSM) (2007). The
authors observe that the boundary detection
approach of ASM is neither efficient nor
guaranteed to provide a correct solution. Instead,
RMSMgeneratesashadowmaphierarchydirectly
to match the resolution required in eye space for
all map regions. This naturally leads to further
memory consumption over ASM, which the
authors note as being 13 times greater. On the
otherhand,RMSMalsoreducedrenderingtimeby
afactorof210.

7
Atreedatastructureisahierarchicalcollectionof
nodes. Each node can be the parent of a number
ofchildnodes.Thenodewithnoparentistheroot
node, and a node with no children is a leaf node
(Knuth,1997).
Anothermethodtocalculatetherequisiteshadow
map resolution directly is fitted virtual shadow
mapping (FVSM) (Giegl & Wimmer, 2007b). This
technique is a noniterative adaptation of QVSM,
much likeRMSM is to ASM.As with RMSM, FVSM
uses a scene analysis to determine the optimal
sampling ratio of the shadow map and construct
themaphierarchyaccordingly.

Incontrasttogloballyadaptivetechniques,suchas
warping and global partitioning, local partitioning
algorithms provide nearperfect sampling of a
scene. This ability however comes at the cost of
significantly increased rendering time. Of the four
methods presented here, RMSM and FVSM
achieve the highest runtime performance. As
noted by Eisemann et al. there is considerable
room for combining the benefits of both
techniques to further reduce computational
overhead(2011).

2.3.1.6IRREGULARSAMPLING

As previously discussed, sampling error occurs


when fragment locations in eye space do not
correspond to sample locations in light space
(Section 2.2). Local partitioning techniques solve
this problem by allocating multiple shadow maps
to successively smaller regions of the scene, but
each shadow map may still contain irrelevant
samples. A far better solution would be to
generate exactly one sample for the location of
each fragment. However, this precludes sampling
the scene uniformly through regular rasterisation,
instead necessitating the use of irregular
rasterisation.

AilaandLaineproposedasoftwaresolutiontothis
problem known as aliasfree shadow mapping
(AFSM) (2004). This method first renders a scene
from the observers point of view, transforming
the position of each visible fragment into light
space. These positions are then stored in a tree
data structure for rasterisation. Next, AFSM
renders the scene from the light source view. If a
rasterisedprimitiveoverlapsaneyespacesample,
themethodcalculatestheexactdepthvalueatthe
sampling point. This of course eliminates all
sampling error, with the added benefit that only
the depth samples required in eye space are
calculated.

Following from AFSM, Arvo suggested a depth


peeling approach to implement aliasfree shadow
mapping on graphics hardware (2007). However,
this requires a high number of rendering passes,
especially for scenes of high complexity. Instead
Sintorn et al. propose using the NVIDIA CUDA
framework for the implementation, and manage
to achieve interactive frame rates (2008). Pan et
al. later improved this approach to increase
performance and allow for subpixel antialiasing
(2009). Nevertheless, irregular rasterisation
remains a difficult problem to solve using current
graphicshardware(Lloyd,etal.,2006).

2.3.2FILTERING

Filteringapproachesinshadowmappingarethose
that allow the visibility test to consider multiple
depthsamplesforasinglequery(Eisemann,etal.,
2011). This can reduce the aliasing effects of
sampling error and soften or blur shadow
boundaries.However,directlyinterpolating
8
depth
values would yield incorrect results, since the
visibilitytestisbinaryinnature.

One of the most commonly used filtering


techniques in shadow mapping is percentage
closer filtering (PCF) (Reeves, et al., 1987). This
method calculates the average visibility of a
fragment by interpolating the results of multiple
visibility tests. The number of samples tested, or
kernel size, determines the smoothness of the
shadow boundary. Larger kernel sizes result in
greater smoothing, but can reduce performance
due to the number of tests performed. Overly
softened shadows may also appear unnatural in a
scene.

Another solution is to reformat a shadow map to


allow for direct sample interpolation. The first
methodtothiseffectisvarianceshadowmapping
(VSM) (Donnelly & Lauritzen, 2006). Instead of
storing the single closest depth value at each
sample, VSM calculates and stores the mean and
variance of a distribution of depths. These values
provideagoodapproximationoftheclosestdepth
and remain meaningful when filtered. On the
other hand, the VSM method can result in
incorrectlightingwheremultipleshadowsoverlap.

To resolve the lighting issues of VSM, Lauritzen


and McCool propose layered variance shadow
mapping (LVSM) (2008). This technique splits the
depth range into multiple layers, which transform
the distribution to provide better accuracy in the
range of the layer. However, the effectiveness of

8
Interpolation is a mathematical method of
calculatingnewdatapointswithinadiscretesetof
samples(Weisstein,1999).
LVSM is dependent on the layer count, a high
number of which has a corresponding negative
effectonperformance.

2.4DEPTHBIASING

Shadowmappingissusceptibletoasecondkindof
visual artefact, after aliasing, known as incorrect
selfshadowing or shadow acne (Scherzer, et al.,
2011). This effect is due to incorrect visibility
testing caused by sample misalignment and depth
value imprecision. It is important to note that
depth samples are valid only for their original
sampling positions. Therefore, other points that
fall into the sample region may receive an
incorrect result for the visibility test. In addition,
depth values have a limited amount of precision,
which can lead to small numerical differences
between sample points and fragment positions.
These imprecisions may further affect the
outcomeofthevisibilitytest.

A simple solution to this problem, and one that is


most commonly used, is depth biasing. This
method adds a small amount of bias to all depth
values,therebymovingsurfacesslightlyawayfrom
thelight.Thisremovesmostsurfaceacne,butcan
also noticeably offset shadows, a phenomenon
known as light leaking. Furthermore, each light
source typically requires a separate userdefined
bias,althoughthishaslittleeffectonperformance
duetohardwaresupport.

As noted by Brabec et al. precision issues are


aggravated for perspective light spaces due to the
foreshortening effect (2002a). In this case, the
sample distribution is nonlinear over the depth
range, leading to higher depth precision near the
centre of projection. Therefore, the authors
propose transforming the Zcoordinates of light
space samples at render time to counteract the
foreshortening effect. This approach distributes
the available depth precision linearly over the
depth range and ensures equal treatment of all
surfaces.

Another solution to shadow acne is seconddepth


shadow mapping (SDSM) (Wang & Molnar, 1994).
Rather than store the depths of the closest visible
surfaces, SDSM stores the next nearest depth
values. This eliminates surface ace but introduces
anumberofrestrictions.Inparticular,onlyclosed
9

9
Closed objects are those where each triangle
edge has one and only one neighbouring triangle
(Eisemann,etal.,2011).
objects are acceptable, and the method must
render all backfacing geometry that the graphics
hardware would otherwise disregard. This last
requirement,inadditiontotheneedformultipass
rendering, leads to a performance penalty for
SDSM. Following from SDSM, Woo proposed a
technique called midpoint shadow mapping
(MPSM) (1992). While this approach can account
for nonclosed geometry, it still suffers from the
sameperformancedrawbacksasSDSM.

3.CONCLUSION

From the material presented in this paper, it is


clear that the choice of implementation for
shadow mapping is highly dependent on the
application requirements.No singletechniquecan
provide best quality and performance in all
situations. Nevertheless, it is possible to derive
some general guidelines, which take into account
thedesiredqualityandperformance.

The simplest approach to shadow mapping is to


combine geometric fitting with lightspace
perspective shadow mapping (LiSPSM). This
provides much better quality than standard
shadowmappingwithalmostnoimpactonspeed.
However, the view dependent nature of LiSPSM
means this technique can degrade to the
resolution of standard shadow mapping in worst
casescenarios.

For higher quality shadows, a combination of the


abovemethodwithzpartitioningisadvisable.The
need to render multiple shadow maps will reduce
performance somewhat, although the number of
partitions is a customisable quantity. As a first
step, logarithmic spacing is the best choice for
distributingthepartitions.Thismethodissimpleto
implement and achieves optimal results in the
average case. Still greater quality is possible with
sample distribution shadow mapping (SDSM).
WhilethesceneanalysissteprequiredbySDSMis
computationally expensive, the benefit of tighter
fitting bounds could improve performance for
complexscenes.

To increase shadow quality further still would


require a locally adaptive approach. Fast local
partitioning techniques such as resolution
matched shadow mapping (RMSM) and fitted
virtual shadow mapping (FVSM) are obvious
candidates in this case. These methods can
produce nearperfect shadows, but do so at the
costofsignificantprocessingtime.

In terms of filtering techniques, percentagecloser


filtering (PCF) has the highest performance for
small kernel sizes and can reduce the effects of
aliasing.Iflargerkernelsizesarerequired,PCFisill
advised, and layered variance shadow mapping
(LVSM)isthenextbestsolution.

For shadow acne, the conventional depth biasing


approach is the most efficient. However, this
method requires configuration for each light
source and may introduce other rendering
artefacts. If a performance penalty is acceptable,
midpoint shadow mapping (MPSM) can provide
muchbetterresultsthandepthbiasing,andunlike
seconddepth shadow mapping (SDSM) has
supportfornonclosedobjects.
BIBLIOGRAPHY

Aila,T.&Laine,S.,2004.AliasFreeShadowMaps.
Strasbourg,France,EurographicsAssociation.
AkenineMller,T.,Haines,E.&Hoffman,N.,2008.
RealTime Rendering. 3rd ed. Wellesley, MA, USA:
AKPeters,Ltd..
Arvo, J., 2004. Tiled Shadow Maps. Hersonissos,
Crete,Greece,IEEEComputerSocietyWashington,
DC,USA.
Arvo, J., 2007. AliasFree Shadow Maps using
Graphics Hardware. Journal of Graphics, GPU, and
GameTools,12(1),pp.4759.
Brabec, S., Annen, T. & Seidel, H.P., 2002a.
Practical Shadow Mapping. Journal of Graphics
Tools,7(4),pp.918.
Brabec, S., Annen, T. & Seidel, H.P., 2002b.
Shadow Mapping for Hemispherical and
OmnidirectionalLightSources.Bradford,Springer.
Buss, S. R., 2003. 3D Computer Graphics: A
Mathematical Introduction with OpenGL.
Cambridge,UK:CambridgeUniversityPress.
Donnelly, W. & Lauritzen, A., 2006. Variance
ShadowMaps.RedwoodCity,ACM,pp.161165.
Dunn, F. & Parberry, I., 2002. 3D Math Primer for
Graphics and Game Development. Plano, TX, USA:
WordwarePublishing,Inc..
Eisemann, E., Schwarz, M., Assarsson, U. &
Wimmer, M., 2011. RealTime Shadows. 1st ed.
Natick,MA,USA:A.K.Peters,Ltd..
Engel, W., 2006. Cascaded Shadow Maps. In: W.
Engel, ed. ShaderX5: Advanced Rendering
Techniques. Rockland, MA, USA: Charles River
Media,Inc.,pp.197206.
Fernando, R., Fernandez, S., Bala, K. & Greenberg,
D. P., 2001. Adaptive Shadow Maps. Los Angeles,
ACM,pp.387390.
Gascuel, J.D., Holzschuch, N., Fournier, G. &
Proche, B., 2008. Fast NonLinear Projections
usingGraphicsHardware.RedwoodCity,ACM.
Giegl, M. & Wimmer, M., 2007a. Queried Virtual
Shadow Maps. Seattle, WA, USA, ACM New York,
NY,USA.
Giegl, M. & Wimmer, M., 2007b. Fitted Virtual
Shadow Maps. Montral, Qubec, Canada, ACM
NewYork,NY,USA.
Jia,N.,Luo,D.&Zhang,Y.,2013.DistortedShadow
Mapping.Singapore,ACM.
Ju, T., Losasso, F., Schaefer, S. & Warren, J., 2002.
Dual Contouring of Hermite Data. ACM
TransactionsonGraphics,July,21(3),pp.339346.
Kim, T.Y. & Neumann, U., 2001. Opacity Shadow
Maps.London,SpringerVerlag,pp.177182.
Knuth, D. E., 1997. The Art of Computer
Programming: Fundamental Algorithms. 3rd ed.
Reading,MA,USA:AddisonWesley.
Lauritzen, A. & McCool, M., 2008. Layered
Variance Shadow Maps. Windsor, Canadian
InformationProcessingSociety,pp.139146.
Lauritzen, A., Salvi, M. & Lefohn, A., 2011. Sample
Distribution Shadow Maps. San Fransisco, ACM,
pp.97102.
Lefohn, A. E., Sengupta, S. & Owens, J. D., 2007.
ResolutionMatched Shadow Maps. ACM
TransactionsonGraphics,October,26(4),p.17.
Lefohn, A. et al., 2005. Dynamic Adaptive Shadow
Maps on Graphics Hardware. Los Angeles, CA,
USA,ACMNewYork,NY,USA.
Liao, H.C., 2010. Shadow Mapping for
OmnidirectionalLightUsingTetrahedronMapping.
In: W. Engel, ed. GPU Pro: Advanced Rendering
Techniques.Natick,MA,USA:A.K.Peters,Ltd.,pp.
455475.
Lloyd, D. B., Govindaraju, N. K., Molnar, S. E. &
Manocha, D., 2007. Practical logarithmic
rasterizationforlowerrorshadowmaps.Sarajevo,
Bosnia, Eurographics Association, AirelaVille,
Switzerland.
Lloyd, D. B. et al., 2008. Logarithmic Perspective
Shadow Maps. ACM Transactions on Graphics,
October,27(4),p.32.
Lloyd, D. B., Tuft, D., Yoon, S.e. & Manocha, D.,
2006. Warping and Partitioning for Low Error
Shadow Maps. Nicosia, Cyprus, Eurographics
Association.
Lokovic,T.&Veach,E.,2000.DeepShadowMaps.
New Orleans, ACM Press/AddisonWesley
PublishingCo.,pp.385392.
Martin, T. & Tan, T.S., 2004. Antialiasing and
Continuity with Trapezoidal Shadow Maps.
Norrkping,Sweden,Eurographics.
Mattausch, O., Bittner, J. & Wimmer, M., 2008.
CHC++: Coherent Hierarchical Culling Revisited.
ComputerGraphicsForum,27(2),pp.221230.
Osman, B., Bukowski, M. & McEvoy, C., 2006.
Practical Implementation of Dual Paraboloid
ShadowMaps.Boston,ACM,pp.103106.
Pan, M. et al., 2009. Fast, Subpixel Antialiased
Shadow Maps. Computer Graphics Forum, 28(7),
pp.19271934.
Reeves, W. T., Salesin, D. H. & Cook, R. L., 1987.
Rendering Antialiased Shadows with Depth Maps.
Anaheim,CA,USA,ACM.
Scherzer, D., Wimmer, M. & Purgathofer, W.,
2011. A Survey of RealTime Hard Shadow
Mapping Methods. Computer Graphics Forum,
30(1),pp.169186.
Sen, P., Cammarano, M. & Hanrahan, P., 2003.
Shadow Silhouette Maps. ACM Transactions on
Graphics,July,22(3),pp.521526.
Sintorn, E., Eisemann, E. & Assarsson, U., 2008.
Sample Based Visibility for Soft Shadows using
Aliasfree Shadow Maps. Computer Graphics
Forum,27(4),pp.12851292.
Sintorn, E., Olsson, O. & Assarsson, U., 2011. An
Efficient Aliasfree Shadow Algorithm for Opaque
and Transparent Objects. ACM Transactions on
Graphics,December.30(6).
Stamminger,M.&Drettakis,G.,2002.Perspective
Shadow Maps. ACM Transactions on Graphics,
July,21(3),pp.557562.
Wang, Y. & Molnar, S., 1994. SecondDepth
Shadow Mapping, Chapel Hill, NC, USA: University
ofNorthCarolina.
Wan,L.,Wong,T.T.&Leung,C.S.,2011.Isocube:
Exploiting the Cubemap Hardware. Visualization
and Computer Graphics, IEEE Transactions on,
13(4),pp.720731.
Weisstein, E. W., 1999. CRC Concise Encyclopedia
of Mathematics. Boca Raton, FL, USA: CRC Press
LLC.
Williams, L., 1978. Casting Curved Shadows on
CurvedSurfaces.Atlanta,ACM,pp.270274.
Wimmer, M., Scherzer, D. & Purgathofer, W.,
2004. Light Space Perspective Shadow Maps.
Norkping,EurographicsAssociation,pp.143151.
Woo, A., 1992. The Shadow Depth Map Revisited.
In:D.Kirk,ed.GraphicsGemsIII.Boston,MA,USA:
AcademicPress,pp.338342.
Zhang,F.,Sun,H.&Nyman,O.,2007.ParallelSplit
Shadow Maps on Programmable GPUs. In: H.
Nguyen, ed. GPU Gems 3. Boston, MA, USA:
AddisonWesleyProfessional,pp.203237.
Zhang,F.,Sun,H.,Xu,L.&Lun,L.K.,2006.Parallel
Split Shadow Maps for Largescale Virtual
Environments. Hong Kong, China, ACM, New York,
NY,USA.

Das könnte Ihnen auch gefallen