Point light shadow mapping and lighting shader - Stack Overflow

文章推薦指數: 80 %
投票人數:10人

There is actually a very in-depth tutorial on shadow mapping with the programmable pipeline, check out Tutorial 16: Shadow mapping. 2022DeveloperSurveyisopen!Takesurvey. Home Public Questions Tags Users Companies Collectives ExploreCollectives Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Collectives™onStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. Learnmore Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. Learnmore Pointlightshadowmappingandlightingshader AskQuestion Asked 8years,1monthago Modified 8years,1monthago Viewed 3ktimes 1 I'mdoingomnidirectionalshadowmappingandonethingIcannotgraspisduringthelightingstage,howdoesonegetthevectortouseinsamplingthecubemap? IntheshadowpassIjustusethedepthvalues,soIneedtobeinthesamespacenow.ButhowdoIknowwhichofthesixviewmatricestouse(asitisoneforeachface)toconverttheworldspacepositionintotheNDCspace? Forexample,usingthisasareference,lookingatthefragmentshaderthereisa"light_view_matrix"-butwhatisit?Lightviewmatrix...ofwhatface?Igeneratedoneforeachfaceduringshadowpass. c++openglshadow Share Improvethisquestion Follow askedApr18,2014at11:31 KaiserJohaanKaiserJohaan 8,7982020goldbadges108108silverbadges194194bronzebadges 1 Ifyoudolightinginworld-space,youdon'tneedtobotherwithanyofthat.Aviewmatrixtransformsfromworld-spacetoview-space,bytheway.Youwouldneedaprojectionmatrixtogoanyfartherthanthat. – AndonM.Coleman Apr18,2014at14:58 Addacomment  |  1Answer 1 Sortedby: Resettodefault Highestscore(default) Datemodified(newestfirst) Datecreated(oldestfirst) 2 Thereisactuallyaveryin-depthtutorialonshadowmappingwiththeprogrammablepipeline,checkoutTutorial16:Shadowmapping AquoteonthesiteaboutPointlights: Pointlights Samething,butwithdepthcubemaps.Acubemapisasetof6textures,oneoneachsideof>acube;what’smore,itisnotaccessedwithstandardUVcoordinates,butwitha3Dvector>representingadirection. Thedepthisstoredforalldirectionsinspace,whichmakepossibleforshadowstobe>castallaroundthepointlight. Share Improvethisanswer Follow answeredApr18,2014at18:17 SyntacticFructoseSyntacticFructose 17.1k1919goldbadges8686silverbadges169169bronzebadges 2 Dobecarefulforvectorsthatpointtotheedgebetweenonefaceinthecubemapandanother.Traditionally,GPUsdidnotfiltertexelsfrommultiplecubemapfacesinthiscaseandyouwillgetaveryweirddiscontinuityonthesecornercasesifyoutrytoimplementsomethinglikehardwarePCForfilteredVSM.DX10classhardwaresupportsseamlesscubemapsthough.LookatGL_TEXTURE_CUBE_MAP_SEAMLESSformoredetails;itisdisabledbydefaultevenonhardwarethatsupportsit. – AndonM.Coleman Apr18,2014at21:37 Manyenginesactuallyusethesamefundamentalconceptbehindcubemapshadowmapping,butinsteadofstoringthemasanactualcubemaptheyareunrolledintoa2Dtextureandwriteaspecialtexturelookupfunctionoftheirown.Thishelpsalittlebitwithfilteringbetweencubemapfacesonpre-DX10hardware(e.g.Xbox360/PS3)anditmakespackingtheshadowmapsintoagiantatlasmucheasier.CryEngine,forexample,doesthis. – AndonM.Coleman Apr18,2014at21:50 Addacomment  |  YourAnswer ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers. Draftsaved Draftdiscarded Signuporlogin SignupusingGoogle SignupusingFacebook SignupusingEmailandPassword Submit Postasaguest Name Email Required,butnevershown PostYourAnswer Discard Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy Nottheansweryou'relookingfor?Browseotherquestionstaggedc++openglshadoworaskyourownquestion. TheOverflowBlog Makeyouropen-sourceprojectpublicbeforeyou’reready(Ep.444) Thescienceofinterviewingdevelopers FeaturedonMeta AnnouncingthearrivalofValuedAssociate#1214:Dalmarus Improvementstositestatusandincidentcommunication RetiringOurCommunity-SpecificClosureReasonsforServerFaultandSuperUser Temporarilypausingthesitesatisfactionsurvey StagingGround:ReviewerMotivation,Scaling,andOpenQuestions Related 4 Deferredrenderingandmovingpointlight 9 Omnidirectionalshadowmappingwithdepthcubemap 18 PointersonmodernOpenGLshadowcubemapping? 3 Aresoftshadowspossiblewithpointlightusingcubemap(OpenGL/GLSL)? 1 DirectX11ShadowMappingIssues 1 Directionalshadowmappingindeferredshading 1 Shadowmappingforpointlight HotNetworkQuestions SignalprocessinginPythonvsC++(Bandpassfilter) WhatwasthereasonforextendingNATOinthe90s? GapsincardinalitiesofMADfamilies CanWgatebewrittenonlyusingH,T? Howcanaprivatekeybeimportedtoadescriptorwallet? HowcanItellwhich3rdpartyflashesarecompatiblewithCanon'sSL3missingpinhotshoemount? Isthisaninsectnest? 'Mapping'thevaluesofalisttovariable Differencebetweenproductsandcoproducts. Whyisacapacitortogroundalowfrequencypole,insteadofahighfrequencyzero? Wouldn'tMiller'splanetbefriedbyblueshiftedradiation? AquestionregardingisomorphismincohomologyformodulispaceofstablebundlesoveracompactRiemannsurface Ihaveanarmadaofteleportingskyfortresses.DoIstillneedanavy? Iwant8bitsforeverycharacter! Meaningandoriginoftheword"muist" sObjecttypesfromstring Can'tmultiplywidthin\newcommandforincludegraphics Whatisthemostecologicallysustainablewaytohandleragscoveredinchaingrease? WhatdoesGandalftheWhitemeanbyhisstrangespeechaboutBoromir? Partitioningalistbasedonacriterionforsublists WhattapeformatdidtheNintendoFamicomDataRecorderuse? Howdoyougagafish-personwithouttape? Howdoyouemptyanonlinevirtualdebitcard? Howtodetectchains(sequenceofdegree2vertices)inagraph? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. lang-cpp Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings  



請為這篇文章評分?