<%BANNER%>

Efficient High-Quality Shadow Mapping

Permanent Link: http://ufdc.ufl.edu/UFE0045080/00001

Material Information

Title: Efficient High-Quality Shadow Mapping
Physical Description: 1 online resource (26 p.)
Language: english
Creator: Bhandare, Sagar Shankar
Publisher: University of Florida
Place of Publication: Gainesville, Fla.
Publication Date: 2012

Subjects

Subjects / Keywords: shadows
Computer and Information Science and Engineering -- Dissertations, Academic -- UF
Genre: Computer Engineering thesis, M.S.
bibliography   ( marcgt )
theses   ( marcgt )
government publication (state, provincial, terriorial, dependent)   ( marcgt )
born-digital   ( sobekcm )
Electronic Thesis or Dissertation

Notes

Abstract: Shadow mapping is a well-known technique for introducing hard shadows to a scene. It suffers, however, from severe aliasing artifacts such as magnified aliasing of the shadow boundaries. The thesis represents an extension, including an implementation, of light frustum adjustment to improve the quality of the shadows while maintaining its prime advantage of speed. The thesis improves the technique within a real-time animation environment.
General Note: In the series University of Florida Digital Collections.
General Note: Includes vita.
Bibliography: Includes bibliographical references.
Source of Description: Description based on online resource; title from PDF title page.
Source of Description: This bibliographic record is available under the Creative Commons CC0 public domain dedication. The University of Florida Libraries, as creator of this bibliographic record, has waived all rights to it worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
Statement of Responsibility: by Sagar Shankar Bhandare.
Thesis: Thesis (M.S.)--University of Florida, 2012.
Local: Adviser: Peters, Jorg.

Record Information

Source Institution: UFRGP
Rights Management: Applicable rights reserved.
Classification: lcc - LD1780 2012
System ID: UFE0045080:00001

Permanent Link: http://ufdc.ufl.edu/UFE0045080/00001

Material Information

Title: Efficient High-Quality Shadow Mapping
Physical Description: 1 online resource (26 p.)
Language: english
Creator: Bhandare, Sagar Shankar
Publisher: University of Florida
Place of Publication: Gainesville, Fla.
Publication Date: 2012

Subjects

Subjects / Keywords: shadows
Computer and Information Science and Engineering -- Dissertations, Academic -- UF
Genre: Computer Engineering thesis, M.S.
bibliography   ( marcgt )
theses   ( marcgt )
government publication (state, provincial, terriorial, dependent)   ( marcgt )
born-digital   ( sobekcm )
Electronic Thesis or Dissertation

Notes

Abstract: Shadow mapping is a well-known technique for introducing hard shadows to a scene. It suffers, however, from severe aliasing artifacts such as magnified aliasing of the shadow boundaries. The thesis represents an extension, including an implementation, of light frustum adjustment to improve the quality of the shadows while maintaining its prime advantage of speed. The thesis improves the technique within a real-time animation environment.
General Note: In the series University of Florida Digital Collections.
General Note: Includes vita.
Bibliography: Includes bibliographical references.
Source of Description: Description based on online resource; title from PDF title page.
Source of Description: This bibliographic record is available under the Creative Commons CC0 public domain dedication. The University of Florida Libraries, as creator of this bibliographic record, has waived all rights to it worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
Statement of Responsibility: by Sagar Shankar Bhandare.
Thesis: Thesis (M.S.)--University of Florida, 2012.
Local: Adviser: Peters, Jorg.

Record Information

Source Institution: UFRGP
Rights Management: Applicable rights reserved.
Classification: lcc - LD1780 2012
System ID: UFE0045080:00001


This item has the following downloads:


Full Text

PAGE 1

EFFICIENTHIGH-QUALITYSHADOWMAPPING By SAGARBHANDARE ATHESISPRESENTEDTOTHEGRADUATESCHOOL OFTHEUNIVERSITYOFFLORIDAINPARTIALFULFILLMENT OFTHEREQUIREMENTSFORTHEDEGREEOF MASTEROFSCIENCE UNIVERSITYOFFLORIDA 2012

PAGE 2

c r 2012SagarBhandare 2

PAGE 3

Tomyparents 3

PAGE 4

ACKNOWLEDGMENTS Iwouldliketothankmychairadvisor,Dr.J ¨ orgPetersforguidingmethroughallthe researchwithvaluableadvice,supportandpatience.Iamth ankfultomysupervisory committeemembers,Dr.BenjaminLokandDr.JeffreyHoforthe irfeedback.Finally,I wouldliketothankmyparentsfortheirsupportandaffectio n. 4

PAGE 5

TABLEOFCONTENTS page ACKNOWLEDGMENTS ..................................4 LISTOFTABLES ......................................6 LISTOFFIGURES .....................................7 ABSTRACT .........................................8 CHAPTER 1INTRODUCTION ...................................9 1.1Motivation ....................................9 1.2iPASS ......................................10 1.3Overview ....................................10 2BACKGROUND ...................................11 3OPTIMIZATIONSTOSHADOWMAPPING ....................14 3.1FocusonVisiblePixels ............................14 3.2FocusonVisibleShadowedPixels ......................16 3.3UniformDepthValues .............................17 3.4NearandFarPlanes ..............................18 4IMPLEMENTATION .................................19 4.1GeneratingtheControlTexture ........................19 4.2ComputingtheBoundingRectangle .....................19 4.3Post-ltering ..................................20 4.3.1BilinearInterpolation ..........................20 4.3.2PCF ...................................20 4.4Discussion ...................................21 5CONCLUSION ....................................23 REFERENCES .......................................24 BIOGRAPHICALSKETCH ................................26 5

PAGE 6

LISTOFTABLES Table page 3-1Performancecomparison ..............................16 4-1Boundingrectanglecomputation ..........................20 6

PAGE 7

LISTOFFIGURES Figure page 1-1Comparisonofbasicandfrustum-adjustedshadows ...............9 2-1Basicshadowmapping ...............................11 3-1Frustumtightening ..................................15 3-2Increasingshadowquality ..............................16 4-1Filters .........................................21 4-2Galleryof ElephantsDream .............................22 7

PAGE 8

AbstractofThesisPresentedtotheGraduateSchool oftheUniversityofFloridainPartialFulllmentofthe RequirementsfortheDegreeofMasterofScience EFFICIENTHIGH-QUALITYSHADOWMAPPING By SagarBhandare December2012 Chair:J ¨ org,Peters Major:ComputerEngineering Shadowmappingisawell-knowntechniqueforintroducinghar dshadowstoa scene.Itsuffers,however,fromseverealiasingartifacts suchasmagniedaliasingof theshadowboundaries. Thethesisrepresentsanextension,includinganimplement ation,oflightfrustrum adjustmenttoimprovetheshadowqualitywhilemaintaining itsprimeadvantageof speed.Thethesisimprovesthetechniquewithinareal-time animationenvironment. 8

PAGE 9

CHAPTER1 INTRODUCTION Besidesfocusandperspectivedistortion,shadowsprovidei mportantvisualcues towardsinterpretingdepthandactioninmoviescenes.Shado wsareavitalcomponent fordepthperceptioninanyscene.Theydenetherelationsh ipofobjectswiththelight sourceandwitheachother. 1.1Motivation A B Figure1-1.The Emo modelin ElephantsDream [ BlenderFoundation 2006 ]rendered usingiPASS(see 1.2 )andshadowmapping.A)Basicshadowmapping.B) Shadowmappingwithlightfrustrumadjusted. Shadowmappingisawell-knownandwidelyusedtechniqueinre al-timeapplications tointroduceshadowstoascene.Itisatopicofintensiveres earchwithhundreds ofpaperspublishedonit(seeChapter 2 foranoverviewoftheliteratureuptilnow). Thisthesis'aimsaretwofold:A)reducemagniedaliasingof shadowboundariesin conventionalshadowmapping,andB)provideanefcientGPUim plementationofthe methodwithreal-timeanimation. 9

PAGE 10

1.2iPASS AbriefoverviewofiPASSisrequiredsincethedevelopmentoft histhesishas beendoneinconjunctionwithit.EfcientPixel-AccurateRend eringofCurvedSurfaces (iPASS)[ Yeoetal. 2012 ]isatechniquetodetermineoptimalGPUtessellationfactor s sothatsmoothsurfacesarerenderedwithnonoticeablepara metricdistortionor polyhedralartifacts.Itsprimaryadvantageoverthecommo nlyusedReyesrendering framework[ Cooketal. 1987 ]isitsreal-timeperformance,Reyesbeingthecurrent industrystandardforrenderingsmoothsurfacesincommerc ialanimationmovies. iPASS,thus,raisesthepossibilityofachievingcinematic-q ualityanimationinan interactivesetting. 1.3Overview Chapter 2 describestheproblemandpriorworkonshadowmapping.Chap ter 3 explainsthekeyideasbehindtheoptimizations.Thesearen amely,A)Focusonvisible pixels,B)Focusonvisibleshadowedpixels,C)Uniformdepth valuesandD)Nearand farplaneadjustment.AnefcientGPUalgorithmandanimpleme ntationaredeveloped inChapter 4 10

PAGE 11

CHAPTER2 BACKGROUND Shadowmapswereintroducedin1978[ Williams 1978 ].Shadowmapsare essentiallydepthmapsfromthelightsource.Initiallythe sceneisrenderedfromthe viewpointofthelightsourceanddepthinformationofthecl osestfragmentforeachpixel isrecordedinatexture.Duringthenalrendering,eachcam era-visiblepixelisprojected backintolight-spaceandadepthcomparisonisperformedag ainstthetexture.Ifthe pixeldepthisgreaterthanthedepthvaluestoredinthetexe l,thepixelisinshadow, otherwiseitislit. Becausetheprojectionofcamera-visiblepixelsdoesnotcon formwiththesampling pointswhereshadowmapdepthwasrecorded(seeFig. 2-1 ),weseetwokindsof aliasingartifacts:jaggedshadowboundariesandincorrec tselfshadowing.Infact,for theabovemethod,noniteresolutionwouldcompletelygetr idoftheseproblemssince theproblemisnottheresolutionitselfbutthemismatchbet weenshadowmapsample andquerylocations. nr nn rnn n n n Figure2-1.Shadowmapsandaliasing 11

PAGE 12

Toaddresstheproblem,[ AilaandLaine 2004 ]and[ Johnsonetal. 2005 ]proposed samplingirregularlyduringshadowmapgeneration.Thesce neisrstrenderedfromthe cameraandallvisiblepixelsareprojectedintolight-spac e.Theselight-spacelocations arethelocationswhichwillbequeriedlateron.Theshadowm apisthengenerated bysamplingatexactlythesepoints.Duetolackofhardwares upportforirregular sampling,aCPUpipelinewasused.Furtherworkby[ Sintornetal. 2008 ]resultedina hardwareimplementation,andalaterextensionby[ Panetal. 2009 ]providedefcient anti-aliasing. Alargenumberofmethodsreparameterize,warportransform ,thescenesothat highersamplingdensitiescanbeobtainedwheredesired.Th erearemultiplewaysto dothis.PerspectiveShadowMaps[ StammingerandDrettakis 2002 ]applyaglobal transformationalongthe z -axistoawardhighersamplespacetoobjectsclosetothe camera.Alogarithmictransformationalong z -axisprovidesanoptimalsamplerate asshownby[ Wimmeretal. 2004 ],howeveritisimpracticalbecauselogarithmic rasterizationisrequired.Otherpracticalwarpingscheme storedistributesamples towardsthenearplane[ ChongandGortler 2004 ; Chong 2003 ; MartinandTan 2004 ; Wimmeretal. 2004 ]usedifferentperspectivetransformations.Arecenttech niqueby [ Rosen 2012 ]triestoadaptthewarpinglocallyaccordingtosceneconte nttoproduce asinglewarpedshadowmap.Arectilinearwarpinggridisuse dheretomagnifyareas ofinterestandminifytheotherpartsofascene.However,th ismethodassumesthatthe sceneprimitivesaresmallenough,sinceiftheyarenotthen aprimitive,sayatriangle, spanningacrossmanygridsshouldnotremainatriangleafte rthewarpbutitisstill rasterizedincorrectlyasatriangle. Accordingto[ Eisemannetal. 2012 ],“Whilewarpingworksverywellinsome congurations,especiallyifthelightisoverhead,therea reothercongurationswhere warpingdegeneratestouniformshadowmapping.Abetteralt ernativeistousemore thanoneshadowmap.”Thebasicideahereistosubdividethev iewfrustrumalong 12

PAGE 13

z-axisandrenderaseparateshadowmapforeachpartition.[ Engel 2006 ; Lloydetal. 2006 ; Zhang 1998 ]approachtheproblemalongtheselines.Ithasthesamespir itof reparameterizationalongz-axis,howevernoweachpartiti onhasaconstantsampling density.Theintentionistomatchthevisiblepixeldensity totheshadowmaptexel density.Thisdensitydecreasesaswemoveawayfromthecame raalongthez-axis. Thesesetofapproachesgivemoreconsistentresultsthangl obalreparameterization butsufferfromotherproblemssuchassuddenjumpsinshadow qualityalongthe boundariesofthepartitions. Theabovemethodsofshadowmappingarescene-independent. Adifferentclass ofalgorithmsrelyonsceneanalysisandusethatdatatoren etheshadowmapinan optimalway.AdaptiveShadowMaps(ASM)[ Fernandoetal. 2001 ]storeatreenode ineachtexeloftheshadowmapwitheachnodestoringmultipl esamples.Thenumber ofsamplesorrenementaredecidedbasedonthecameraviewa ndthecriteriaused forimportancesampling.[ Arvo 2004 ; GieglandWimmer 2007 ; Lefohnetal. 2007 ]all usesimilarideologytoadjusttheshadowmapresolution.Th etrade-offwithrespectto warpingmethodsisanadditionalsceneanalysisstep.Butthe semethodsgivebetter resultsingeneralcases. Shadowraycastinghasalsobeeninvestigatedforreal-times hadows.Interms ofshadowquality,shadowraycastingisconsideredthebenc hmarkmethodforhard shadowsandisapreferredchoiceforofinerendering.Itdo esnotsufferfromtheabove aliasingproblems,however,aswithclassicalray-tracing ,itisnotsuitableforreal-time applications.[ Herteletal. 2009 ]usesahybridGPUpipelinethatperformsrasterization forpixelsthatdonotfallonshadowboundariesandthenswit chestoray-castingfor theuncertainpixelsontheshadowboundaries.[ OlssonandAssarsson 2011 ]and [ ChristianLauterbachandManocha 2009 ]employsimilarhybridstrategiestospeedup shadowray-casting.Theapproachstillremainsprohibitiv eforreal-timeapplications. 13

PAGE 14

CHAPTER3 OPTIMIZATIONSTOSHADOWMAPPING 3.1FocusonVisiblePixels Alightfrustumthatisnotwell-adjustedtocurrentcamerav iewcanleadto hugewastageofavailableresolutionandprecision.Andsowe adjustthelight frustumtofocusonlyonthatpartofscenewhichiscurrently visiblefromthecamera, [ Brabecetal. 2000 ].Thissimpleideacanleadtoalotofimprovementinshadow qualityasgreaternumberofsamplesaregiventopartsofsce newhicharevisible(Fig. 3-1 ). Tostartoff,weensurethattheinitiallightfrustumcovers allofthescene.Then werenderthescenefromcameraandstoreprojectedlight-sp acepositions ( x 0 ;y 0 ) in atexturecalled controltexture .Thecontroltextureisthenanalysedandabounding rectangleisconstructedbasedonmin-maxvaluesofthestor ed ( x 0 ;y 0 ) .Thebounding rectangleindicateswhatpartofthescenetofocusonwhenge neratingtheshadowmap. Thetransformationneededforthisis T :=[ x 0min ;x 0max ] 7! [ 1 ; 1] ; [ y 0 min ;y 0 max ] 7! [ 1 ; 1] Thatis,theareainsidetheboundingrectangleismagniedt ocovertheentireimage planeoftheshadowmap.Thealgorithmcanbegivenas:1.Renderthescenefromcameraandoutputlight-spaceposit ions ( x 0 ;y 0 ) tocontrol texture C 2.Computetheboundingrectangle B :=[( x 0min ;y 0 min ) ; ( x 0max ;y 0 max )] 3.Renderthescenefromlightsourceandapplycomputedtran sformation T post-projectionwhilerenderingtotheshadowmap S 4.Applythesametransformationwhileperformingshadowmap querieson S Notethattheinitialrenderingfromcameracanbeasimpledr yrun,i.e.withoutany associatedshading/evaluationperformed.Allthatisneede darelight-spacecoordinates oftheprimitives.Alternatively,itcanalsobeusedasthein itialdeferredrenderingpass 14

PAGE 15

n r rn rnn A n r rn rnn B n r rn rnn C Figure3-1.Shadowsbecomenerastheimageplaneoftheshado wmapshrinks.A) Nofrustumadjustment.B)Frustumrestrictedtotheportiono fscenevisible fromtheeyeandC)Frustumrestrictedtoshadowedportionof scene whereallrequiredshadingdataarestoredalongwiththelig ht-spacepositions,the boundingrectangleiscomputedandshadowmapgenerated,an dthenanalshading passisexecuted. Theboundingrectangleneedstoberecomputedwheneitherth elightorthe cameramoves. 15

PAGE 16

3.2FocusonVisibleShadowedPixels Sincenotallvisiblepixelswillbeshadowed,wecantightent helightfrustumso thattheshadowmapcoversonlythosevisiblepixelsthatwil lreceiveshadow(Fig. 3-1 ).Thisextensionofthepreviousmethodcanimproveshadowq ualityfurther.The methodrequiresanextrarenderingpass.Beforecomputingth eboundingrectangle,we generateanothershadowmapfromthelightandthenquerythi sshadowmapbefore weoutputtothecontroltexture.Pixelpositionsclearlyinf rontoftheshadowmapare ignored.Thisisagoodestimatetoensurethatonlyshadowed pixelscontributetothe boundingrectanglecomputation. Wenowreplacetherststepofpreviousalgorithmwiththefo llowingsteps: 1.Renderthescenefromlightsourceandrecordshadowmap S 0 2.Renderthescenefromcameraandoutputlight-spaceposit ions( x 0 y 0 )tothe controltexture,discardingpixelswhosepositionsareinf rontof S 0 A B C D Figure3-2.Resultswith Proog modelfrom ElephantsDream .A)Nofrustumadjustment. B)FocusonvisiblepixelsandC)Focusonvisibleshadowedpix els.Shadow mapcontentsinlower-leftofeachimage.D)Magniedviewof redsquare MethodBasicFrustum1Frustum2 Avg.performance240220190 Table3-1.Performancecomparison.Thetermaverageimplie saverageframe-rate duringanimation.Figuresarein framespersecond ( fps ) 16

PAGE 17

Inotherwords,wearelookingforsampleswhichhaveashadow caster-receiver relationship.Thisviewpresentsuswithanalternativeapp roach.Wecanobviatethe additionaldepthmapgenerationtodetermineshadowedpixe ls.Forthis,weneedto maintainabufferindexedbylight-spacelocationstokeepa countofhowmanyvisible pixelsmaptothesamelocationintheshadowmap.Alllocation swithtwoormore samplessufcientlyseparatedwillsatisfytheshadowcast er-receiverrequirement. Themaindrawbackofthisapproachisthatensuringsynchron izationoftherequired accessestothebufferandatomicityoftheseaccesseshasto bedonefromthepixel shaderwhichiscomplicatedandanon-idealsetup. Thismethod,however,cangiveusthesmallestpossibleligh tfrustumdimensions (oftheprojectionplane)forascene. 3.3UniformDepthValues Perspectiveprojectionresultsindepthvalueswhichareno n-uniformly (1 =z ) distributed.Whileitmakessenseforthecameraviewtogiveh igherprecisiontocloser objectsandvice-versa,samemaynottrueforthelightview. Sometimes,thelightsource maybefarawayfromcamerawhereastheobjectsclosetocamer agenerallyrequire greatershadowdepthprecision.Usinguniformlyspaceddep thvaluesisabetterchoice, sincewethengetequalprecisionatalldepthsinthelightfr ustum.[ Brabecetal. 2000 ] Perspectivetransformationcanbewrittenas ( x p ;y p ;z p ;w p ) T = M LightProj ( x v ;y v ;z v ;w v ) T ,where ( x p ;y p ;z p ;w p ) areprojectedcoordinatesand ( x v ;y v ;z v ;w v ) areviewspacecoordinates.Insteadofapplyingthisprojec tiontothe z component,a uniformlyvaryingvalueof z in [0 ; 1] canbecomputedas, z l = z v + near far near Wereplacethepost-projection z p with z l .Tooffsettheperspectivedivisionthattakes placeduringrasterization,wealsopre-multiply z l withthehomogenuouscoordinate w p toget z 0 = z l w p .Finally ( x p ;y p ;z 0 ;w p ) aresenttotherasterizer. 17

PAGE 18

3.4NearandFarPlanes Whilethersttwooptimizationsconcernthemselveswithobt ainingatightfrustum along x and y axesinlightspace,thiscanbedonealongthe z -axisaswell.Instead ofsettingarbitraryvaluesfornearandfarplanesofthelig htfrustum,ifwesetthem suchthattheytightlyboundthevisibleportionofthescene ,areducedrangefordepth valuesisobtained.Thisgivesusagreatersamplingdensity alongthe z -axis.Objects beyondthefarplanearenotofinterestsincetheywouldnotb evisibleincameraview anyhow.Asforobjectscloserthanthenearplane,specialhan dlingisrequiredsince theseobjectsmaycastashadowonthescene.Depthclippingf ortheseneedstobe disabledtoavoidclippingthemaway.Thedepthforallsucho bjectscanbesettozero afterprojectiontoensuretheyareincludedinshadowcompu tationsandthattheycasta shadowonthescene.[ Brabecetal. 2000 ] Computationoftheseboundscanbedoneintandemwiththecon troltexture methodexplainedbefore,onlydifferencebeingthatnowwec omputeaboundingbox with z -extentinsteadofaboundingrectangle. 18

PAGE 19

CHAPTER4 IMPLEMENTATION 4.1GeneratingtheControlTexture Step1fromthealgorithminsection 3 mentionsthecontroltexture.Thecontrol texturecontainstheprojectedlightspacepositionsofthe visiblepixels.Thesepositions areusedtodeterminetheboundingrectangle.Togenerateth istexture,werstsetthe viewpointtothecurrentcameraandpassdownthelightspace positionfromthevertex shadertothepixelshaders,similartothenalrenderingpa ss.Thepixelshaderonly outputsthesamplepositionstothecontroltexture. Whenwewanttonarrowourfocustojusttheshadowedpixels,th enadepth comparisonisperformedwithapreviouslycomputedshadowm apandthepixelis discardedifthecomparisonsucceedsi.e.ifthepixelisinf rontoftheshadowmap. Otherwise,thepositionisrecordedinthecontroltexture. 4.2ComputingtheBoundingRectangle ADirectX11ComputeShaderkerneldeterminestheboundingre ctangle. TheComputeShaderisanewshaderstageintroducesinDirectX 11thatoffers general-purposecomputationsontheGPU.Itcanworkonarbit rarydatainputthrough readableresources(buffers,textures)andtheoutputcanb ewrittentowriteable resources.Multiplethreadgroupscanbeexecutedwitheach threadgroupconsisting amaximumof1024threads. Synchronizationandcommunicationbetweendifferentthrea dgroupsiscostlywhen comparedtosynchronizationwithinathreadgroup.Moreove r,forourapplication,the controltextureoverwhichourComputeShaderkernelwillrun isoflimitedresolution, say1024x1024.Asaresult,nospeedupwasobtainedbydispatc hingmultiple threadgroupsinsteadofasingleone.Hencethecomputation oftheboundingrectangle isperformedusingjustonethreadgroup.Eachthreadcompute sitslocalboundsfrom disjointgroupsof t = d width height 1024 e texelsandthenatomicallyupdatestheboundsshared 19

PAGE 20

byotherthreadsinthethreadgroup.Finally,oneofthethre adswritesittoanoutput bufferafterallothershavenished. BoundingrectangleDisabledEnabled-CPUEnabled-GPU Avg.performance18470152 Table4-1.Effectofboundingrectanglecomputationonperfo rmance.Thetermaverage impliesaverageframe-rateduringanimation.Figuresarei n framesper second ( fps ) 4.3Post-ltering Althoughshadowmapsarestoredastextures,conventionalte xtureltering techniquescannotbedirectlyappliedtothem.Thisisevide ntsincetheoutputofa shadowmapisacomparisonoperationandanylteringofdept hvaluesthemselves willproduceincorrectcomparisonresults.Instead,whatw ecanlteraretheresults ofthesecomparisonoperationstogiveusasmoothgradientf romshadowedportions tounshadowedones.Notethattheselteringtechniquesare notequivalenttosoft shadowsbutmerelyinterpolateoraverage.4.3.1BilinearInterpolation Forbilinearinterpolation,wegetthefourclosesttexelva luestoasamplelocation inasinglefetchoperationusingtheHLSL Gather statement.The4-tupleisthen comparedwiththesampledepthtogetfourcomparisonresult s.HLSLalsoprovides GatherCmp statementtoperformbothfetchandcompare4-texelvaluesu singasingle instruction.Thecomparisonresultsaretheninterpolated bilinearlyacross u and v axes toobtainasmoothlyvaryingshadowfactor.4.3.2PCF Whilebilinearinterpolationissmooth,ithasaverylimited lterareaandhence onlysmoothsoutjaggededgeboundariestoasmallextent.To obtainasmoother gradationofshadowfactorsatshadowboundaries,wemakeus eofPercentageCloser Filtering(PCF)proposedby[ Reevesetal. 1987 ].An n n tapPCFlteraverages thecomparisonresultsoveran n n regulargridofsamples.Theoutputisafraction 20

PAGE 21

A B C D Figure4-1.Filterquality.A)Pointsampling.B)Bilinearsamp ling.C)PCF5x5samples andD)Magniedviewofredsquare denotingthepercentageofneighboringtexelsthesamplepa ssesthedepthtestagainst andthisfractionisusedastheshadowfactor.Gaussianweig htedaveraginggives smoothershadows. 4.4Discussion WeusedanNVidiaGeForceGTX690graphicscardandwithIntelC ore2Quad CPUQ9450at2.66GHzwith4GBmemorytorenderanimatedframes fromthe open-sourcemovie ElephantsDream .Theimplementationonwhichtheperformance numbersarebasedincludediPASS,ApproximateCatmull-Clarks ubdivision(ACC) [ LoopandSchaefer 2008 ],SkeletalanimationandTexturemappingwhichenable cinematicqualityrenderingofthemovieinreal-time.Thef rameworkofimplementation wasDirectX11withtheassociatedHigh-LevelShaderLanguag e(HLSL).Figure 4-2 showsscreenshotsoftheimplementation. 21

PAGE 22

Figure4-2.Fourscenesfrom ElephantsDream fromdifferentviewpoints. 22

PAGE 23

CHAPTER5 CONCLUSION Inconclusion,thisthesisprovidesanefcientGPUimplemen tationofvarious optimizationstobasicshadowmapping.Theoptimizations, whichechotheideaof makingmaximaluseoftheavailableresolutionandprecisio n,aresimpletoimplement, reducethealiasingofshadowboundariesandallowforsomea mountofdynamic renementofshadowswithchangesinthecameraviewandthes cene.Theefciency ismainlyderivedfromofoadingtheboundingrectanglecom putationfromtheCPUto theDirectX11ComputeShader.Thisminimizestheperformance dropincurredfrom thissceneanalysiswhichwouldotherwisebeofahighmagnit ude.Anextensiontothe existingideaoffrustumadjustmentisalsogiventhatcanpr ovidethetightestpossible lightfrustumforsomescenes.Areal-timedemonstrationof theimplementationrunsat aboveinteractiverates,ca.150fps. 23

PAGE 24

REFERENCES A ILA ,T. AND L AINE ,S.2004.Alias-FreeShadowMaps.A.KellerandH.W.Jensen, Eds.EurographicsAssociation,Norrk ¨ oping,Sweden,161–166. A RVO ,J.2004.Tiledshadowmaps.240–247. B LENDER F OUNDATION .2006.Elephantsdream. http://orange.blender.org B RABEC ,S.,A NNEN ,T., ANDPETER S EIDEL ,H.2000.Practicalshadowmapping. JournalofGraphicsTools7 ,9–18. C HONG ,H.Y. AND G ORTLER ,S.J.2004.Alixelforeverypixel.In Proceedingsofthe FifteenthEurographicsconferenceonRenderingTechniques .EGSR'04.Eurographics Association,Aire-la-Ville,Switzerland,Switzerland,167–17 2. C HONG ,H.Y.-I.2003.Real-timeperspectiveoptimalshadowmaps. Tech.rep. C HRISTIAN L AUTERBACH ,Q.M. AND M ANOCHA ,D.2009.Fasthardandsoftshadow generationoncomplexmodelsusingselectiveraytracing.T echnicalreport.January. C OOK ,R.L.,C ARPENTER ,L., AND C ATMULL ,E.1987.Thereyesimagerendering architecture. SIGGRAPHComput.Graph.21, 4(Aug.),95–102. E ISEMANN ,E.,A SSARSSON ,U.,S CHWARZ ,M.,V ALIENT ,M., AND W IMMER ,M.2012. Efcientreal-timeshadows.In ACMSIGGRAPH2012Courses .SIGGRAPH'12. ACM,NewYork,NY,USA,18:1–18:53. E NGEL ,W.2006.Cascadedshadowmaps.In ShaderX5:AdvancedRendering Techniques .CharlesRiverMedia,Hingham,MA,USA,197–206. F ERNANDO ,R.,F ERNANDEZ ,S.,B ALA ,K., AND G REENBERG ,D.P.2001.Adaptive shadowmaps.In Proceedingsofthe28thannualconferenceonComputergraphi cs andinteractivetechniques .SIGGRAPH'01.ACM,NewYork,NY,USA,387–390. G IEGL ,M. AND W IMMER ,M.2007.Fittedvirtualshadowmaps.In Proceedingsof GraphicsInterface2007 .GI'07.ACM,NewYork,NY,USA,159–168. H ERTEL ,S.,H ORMANN ,K., AND W ESTERMANN ,R.2009.Ahybridgpurendering pipelineforalias-freehardshadows. EUROGRAPHICSASSOCIATION,GENEVA 59–66. J OHNSON ,G.S.,L EE ,J.,B URNS ,C.A., AND M ARK ,W.R.2005.Theirregular z-buffer:Hardwareaccelerationforirregulardatastruct ures. ACMTrans.Graph.24, 4 (Oct.),1462–1482. L EFOHN ,A.,S ENGUPTA ,S., AND O WENS ,J.D.2007.Resolutionmatchedshadow maps. ACMTransactionsonGraphics26, 4(Oct.),20:1–20:17. 24

PAGE 25

L LOYD ,B.,T UFT ,D., EUI Y OON ,S., AND M ANOCHA ,D.2006.Warpingandpartitioning forlowerrorshadowmaps. L OOP ,C. AND S CHAEFER ,S.2008.Approximatingcatmull-clarksubdivisionsurface s withbicubicpatches. ACMTrans.Graph.27, 1(Mar.),8:1–8:11. M ARTIN ,T. AND T AN ,T.S.2004.Anti-aliasingandcontinuitywithtrapezoidals hadow maps.In RenderingTechniques ,A.KellerandH.W.Jensen,Eds.Eurographics Association,153–160. O LSSON ,O. AND A SSARSSON ,U.2011.Improvedrayhierarchyaliasfreeshadows. TechnicalReport2011:09,ISSN1652-926X,DepartmentofCompu terScienceand Engineering,Gothenburg,Sweden.May. P AN ,M.,0004,R.W.,C HEN ,W.,Z HOU ,K., AND B AO ,H.2009.Fast,sub-pixel antialiasedshadowmaps. Comput.Graph.Forum28, 7,1927–1934. R EEVES ,W.T.,S ALESIN ,D.H., AND C OOK ,R.L.1987.Renderingantialiased shadowswithdepthmaps. SIGGRAPHComput.Graph.21, 4(Aug.),283–291. R OSEN ,P.2012.Rectilineartexturewarpingforfastadaptivesha dowmapping.In ProceedingsoftheACMSIGGRAPHSymposiumonInteractive3DGraph icsand Games .I3D'12.ACM,NewYork,NY,USA,151–158. S INTORN ,E.,E ISEMANN ,E., AND A SSARSSON ,U.2008.Samplebasedvisibilityfor softshadowsusingalias-freeshadowmaps.In ProceedingsoftheNineteenthEurographicsconferenceonRendering .EGSR'08.EurographicsAssociation,Aire-la-Ville, Switzerland,Switzerland,1285–1292. S TAMMINGER ,M. AND D RETTAKIS ,G.2002.Perspectiveshadowmaps.In ACM TransactionsonGraphics .557–562. W ILLIAMS ,L.1978.Castingcurvedshadowsoncurvedsurfaces.In InComputer Graphics(SIGGRAPH78Proceedings) .270–274. W IMMER ,M.,S CHERZER ,D., AND P URGATHOFER ,W.2004.Lightspaceperspective shadowmaps.In RenderingTechniques2004(ProceedingsEurographicsSymposiumonRendering) ,A.KellerandH.W.Jensen,Eds.Eurographics,Eurographics Association,143–151. Y EO ,Y.I.,B IN ,L., AND P ETERS ,J.2012.Efcientpixel-accuraterenderingofcurved surfaces. Interactive3Dgraphics Z HANG ,H.1998.Forwardshadowmapping.In RenderingTechniques98,Eurographics .Springer-VerlagWien,131–138. 25

PAGE 26

BIOGRAPHICALSKETCH SagarBhandarewasborninBelgaum,India.HereceivedhisBachel orof EngineeringdegreefromUniversityofPunein2010.Hisworkdu ringhismaster's degreefocusedoncomputeranimation,highqualityreal-ti merenderingandGPU techniques. 26