Beruflich Dokumente
Kultur Dokumente
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
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).
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
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).
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
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).
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
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.
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.
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
Figure5:Zpartitioningoftheviewfrustum.
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.
S
|
= z
n
_
z
z
n
]
|
k
(1)
arethedistancestothenearand
farplanesoftheviewfrustumrespectively.
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.
2.3.1.4HYBRIDTECHNIQUES
2.3.1.5LOCALPARTITIONING
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
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.
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.
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.
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
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.