9b20a514-6cc3-49de-b216-b6b863046249.json 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "builtin-toon",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "passes": [
  10. {
  11. "rasterizerState": {
  12. "cullMode": 1
  13. },
  14. "program": "builtin-toon|silhouette-edge-vs|silhouette-edge-fs",
  15. "depthStencilState": {
  16. "depthFunc": 3,
  17. "depthTest": true,
  18. "depthWrite": true
  19. },
  20. "switch": "USE_OUTLINE_PASS",
  21. "properties": {
  22. "lineWidth": {
  23. "value": [
  24. 10
  25. ],
  26. "type": 13,
  27. "handleInfo": [
  28. "outlineParams",
  29. 0,
  30. 13
  31. ]
  32. },
  33. "depthBias": {
  34. "value": [
  35. 0
  36. ],
  37. "type": 13,
  38. "handleInfo": [
  39. "outlineParams",
  40. 1,
  41. 13
  42. ]
  43. },
  44. "baseColor": {
  45. "editor": {
  46. "type": "color"
  47. },
  48. "type": 16
  49. },
  50. "baseColorMap": {
  51. "value": "grey",
  52. "type": 28
  53. },
  54. "outlineParams": {
  55. "type": 16,
  56. "editor": {
  57. "visible": false,
  58. "deprecated": true
  59. },
  60. "value": [
  61. 10,
  62. 0,
  63. 0,
  64. 0
  65. ]
  66. }
  67. }
  68. },
  69. {
  70. "program": "builtin-toon|toon-vs|toon-fs",
  71. "properties": {
  72. "tilingOffset": {
  73. "value": [
  74. 1,
  75. 1,
  76. 0,
  77. 0
  78. ],
  79. "type": 16
  80. },
  81. "mainColor": {
  82. "value": [
  83. 0.6,
  84. 0.6,
  85. 0.6,
  86. 1
  87. ],
  88. "linear": true,
  89. "editor": {
  90. "displayName": "BaseColor",
  91. "type": "color"
  92. },
  93. "type": 16,
  94. "handleInfo": [
  95. "baseColor",
  96. 0,
  97. 16
  98. ]
  99. },
  100. "colorScale": {
  101. "value": [
  102. 1,
  103. 1,
  104. 1
  105. ],
  106. "type": 15,
  107. "handleInfo": [
  108. "colorScaleAndCutoff",
  109. 0,
  110. 15
  111. ]
  112. },
  113. "alphaThreshold": {
  114. "value": [
  115. 0.5
  116. ],
  117. "editor": {
  118. "parent": "USE_ALPHA_TEST"
  119. },
  120. "type": 13,
  121. "handleInfo": [
  122. "colorScaleAndCutoff",
  123. 3,
  124. 13
  125. ]
  126. },
  127. "shadeColor1": {
  128. "value": [
  129. 0.4,
  130. 0.4,
  131. 0.4,
  132. 1
  133. ],
  134. "linear": true,
  135. "editor": {
  136. "type": "color"
  137. },
  138. "type": 16
  139. },
  140. "shadeColor2": {
  141. "value": [
  142. 0.2,
  143. 0.2,
  144. 0.2,
  145. 1
  146. ],
  147. "linear": true,
  148. "editor": {
  149. "type": "color"
  150. },
  151. "type": 16
  152. },
  153. "specular": {
  154. "value": [
  155. 1,
  156. 1,
  157. 1,
  158. 0.3
  159. ],
  160. "linear": true,
  161. "editor": {
  162. "type": "color"
  163. },
  164. "type": 16
  165. },
  166. "baseStep": {
  167. "value": [
  168. 0.8
  169. ],
  170. "type": 13,
  171. "handleInfo": [
  172. "shadeParams",
  173. 0,
  174. 13
  175. ]
  176. },
  177. "baseFeather": {
  178. "value": [
  179. 0.001
  180. ],
  181. "type": 13,
  182. "handleInfo": [
  183. "shadeParams",
  184. 1,
  185. 13
  186. ]
  187. },
  188. "shadeStep": {
  189. "value": [
  190. 0.5
  191. ],
  192. "type": 13,
  193. "handleInfo": [
  194. "shadeParams",
  195. 2,
  196. 13
  197. ]
  198. },
  199. "shadeFeather": {
  200. "value": [
  201. 0.001
  202. ],
  203. "type": 13,
  204. "handleInfo": [
  205. "shadeParams",
  206. 3,
  207. 13
  208. ]
  209. },
  210. "shadowCover": {
  211. "value": [
  212. 0.5
  213. ],
  214. "editor": {
  215. "slide": true,
  216. "range": [
  217. 0,
  218. 1
  219. ],
  220. "step": 0.001
  221. },
  222. "type": 13,
  223. "handleInfo": [
  224. "miscParams",
  225. 0,
  226. 13
  227. ]
  228. },
  229. "emissive": {
  230. "value": [
  231. 0,
  232. 0,
  233. 0,
  234. 1
  235. ],
  236. "linear": true,
  237. "editor": {
  238. "type": "color"
  239. },
  240. "type": 16
  241. },
  242. "emissiveScale": {
  243. "value": [
  244. 1,
  245. 1,
  246. 1
  247. ],
  248. "type": 15,
  249. "handleInfo": [
  250. "emissiveScaleAndStrenth",
  251. 0,
  252. 15
  253. ]
  254. },
  255. "normalStrength": {
  256. "value": [
  257. 1
  258. ],
  259. "editor": {
  260. "parent": "USE_NORMAL_MAP"
  261. },
  262. "slide": true,
  263. "range": [
  264. 0,
  265. 5
  266. ],
  267. "step": 0.001,
  268. "type": 13,
  269. "handleInfo": [
  270. "emissiveScaleAndStrenth",
  271. 3,
  272. 13
  273. ]
  274. },
  275. "normalMap": {
  276. "value": "normal",
  277. "type": 28
  278. },
  279. "mainTexture": {
  280. "value": "white",
  281. "editor": {
  282. "displayName": "BaseColorMap"
  283. },
  284. "type": 28,
  285. "handleInfo": [
  286. "baseColorMap",
  287. 0,
  288. 28
  289. ]
  290. },
  291. "shadeMap1": {
  292. "value": "white",
  293. "type": 28
  294. },
  295. "shadeMap2": {
  296. "value": "white",
  297. "type": 28
  298. },
  299. "specularMap": {
  300. "value": "white",
  301. "type": 28
  302. },
  303. "emissiveMap": {
  304. "value": "grey",
  305. "type": 28
  306. },
  307. "baseColor": {
  308. "type": 16,
  309. "editor": {
  310. "visible": false,
  311. "deprecated": true
  312. },
  313. "value": [
  314. 0.6,
  315. 0.6,
  316. 0.6,
  317. 1
  318. ]
  319. },
  320. "colorScaleAndCutoff": {
  321. "type": 16,
  322. "editor": {
  323. "visible": false,
  324. "deprecated": true
  325. },
  326. "value": [
  327. 1,
  328. 1,
  329. 1,
  330. 0.5
  331. ]
  332. },
  333. "shadeParams": {
  334. "type": 16,
  335. "editor": {
  336. "visible": false,
  337. "deprecated": true
  338. },
  339. "value": [
  340. 0.8,
  341. 0.001,
  342. 0.5,
  343. 0.001
  344. ]
  345. },
  346. "miscParams": {
  347. "type": 16,
  348. "editor": {
  349. "visible": false,
  350. "deprecated": true
  351. },
  352. "value": [
  353. 0.5,
  354. 0,
  355. 0,
  356. 0
  357. ]
  358. },
  359. "emissiveScaleAndStrenth": {
  360. "type": 16,
  361. "editor": {
  362. "visible": false,
  363. "deprecated": true
  364. },
  365. "value": [
  366. 1,
  367. 1,
  368. 1,
  369. 1
  370. ]
  371. },
  372. "baseColorMap": {
  373. "type": 28,
  374. "editor": {
  375. "visible": false,
  376. "deprecated": true
  377. },
  378. "value": "white"
  379. }
  380. }
  381. },
  382. {
  383. "phase": "forward-add",
  384. "propertyIndex": 1,
  385. "embeddedMacros": {
  386. "CC_FORWARD_ADD": true
  387. },
  388. "blendState": {
  389. "targets": [
  390. {
  391. "blend": true,
  392. "blendSrc": 1,
  393. "blendDst": 1,
  394. "blendSrcAlpha": 0,
  395. "blendDstAlpha": 1
  396. }
  397. ]
  398. },
  399. "program": "builtin-toon|toon-vs|toon-fs",
  400. "depthStencilState": {
  401. "depthFunc": 2,
  402. "depthTest": true,
  403. "depthWrite": false
  404. },
  405. "properties": {
  406. "tilingOffset": {
  407. "value": [
  408. 1,
  409. 1,
  410. 0,
  411. 0
  412. ],
  413. "type": 16
  414. },
  415. "mainColor": {
  416. "value": [
  417. 0.6,
  418. 0.6,
  419. 0.6,
  420. 1
  421. ],
  422. "linear": true,
  423. "editor": {
  424. "displayName": "BaseColor",
  425. "type": "color"
  426. },
  427. "type": 16,
  428. "handleInfo": [
  429. "baseColor",
  430. 0,
  431. 16
  432. ]
  433. },
  434. "colorScale": {
  435. "value": [
  436. 1,
  437. 1,
  438. 1
  439. ],
  440. "type": 15,
  441. "handleInfo": [
  442. "colorScaleAndCutoff",
  443. 0,
  444. 15
  445. ]
  446. },
  447. "alphaThreshold": {
  448. "value": [
  449. 0.5
  450. ],
  451. "editor": {
  452. "parent": "USE_ALPHA_TEST"
  453. },
  454. "type": 13,
  455. "handleInfo": [
  456. "colorScaleAndCutoff",
  457. 3,
  458. 13
  459. ]
  460. },
  461. "shadeColor1": {
  462. "value": [
  463. 0.4,
  464. 0.4,
  465. 0.4,
  466. 1
  467. ],
  468. "linear": true,
  469. "editor": {
  470. "type": "color"
  471. },
  472. "type": 16
  473. },
  474. "shadeColor2": {
  475. "value": [
  476. 0.2,
  477. 0.2,
  478. 0.2,
  479. 1
  480. ],
  481. "linear": true,
  482. "editor": {
  483. "type": "color"
  484. },
  485. "type": 16
  486. },
  487. "specular": {
  488. "value": [
  489. 1,
  490. 1,
  491. 1,
  492. 0.3
  493. ],
  494. "linear": true,
  495. "editor": {
  496. "type": "color"
  497. },
  498. "type": 16
  499. },
  500. "baseStep": {
  501. "value": [
  502. 0.8
  503. ],
  504. "type": 13,
  505. "handleInfo": [
  506. "shadeParams",
  507. 0,
  508. 13
  509. ]
  510. },
  511. "baseFeather": {
  512. "value": [
  513. 0.001
  514. ],
  515. "type": 13,
  516. "handleInfo": [
  517. "shadeParams",
  518. 1,
  519. 13
  520. ]
  521. },
  522. "shadeStep": {
  523. "value": [
  524. 0.5
  525. ],
  526. "type": 13,
  527. "handleInfo": [
  528. "shadeParams",
  529. 2,
  530. 13
  531. ]
  532. },
  533. "shadeFeather": {
  534. "value": [
  535. 0.001
  536. ],
  537. "type": 13,
  538. "handleInfo": [
  539. "shadeParams",
  540. 3,
  541. 13
  542. ]
  543. },
  544. "shadowCover": {
  545. "value": [
  546. 0.5
  547. ],
  548. "editor": {
  549. "slide": true,
  550. "range": [
  551. 0,
  552. 1
  553. ],
  554. "step": 0.001
  555. },
  556. "type": 13,
  557. "handleInfo": [
  558. "miscParams",
  559. 0,
  560. 13
  561. ]
  562. },
  563. "emissive": {
  564. "value": [
  565. 0,
  566. 0,
  567. 0,
  568. 1
  569. ],
  570. "linear": true,
  571. "editor": {
  572. "type": "color"
  573. },
  574. "type": 16
  575. },
  576. "emissiveScale": {
  577. "value": [
  578. 1,
  579. 1,
  580. 1
  581. ],
  582. "type": 15,
  583. "handleInfo": [
  584. "emissiveScaleAndStrenth",
  585. 0,
  586. 15
  587. ]
  588. },
  589. "normalStrength": {
  590. "value": [
  591. 1
  592. ],
  593. "editor": {
  594. "parent": "USE_NORMAL_MAP"
  595. },
  596. "slide": true,
  597. "range": [
  598. 0,
  599. 5
  600. ],
  601. "step": 0.001,
  602. "type": 13,
  603. "handleInfo": [
  604. "emissiveScaleAndStrenth",
  605. 3,
  606. 13
  607. ]
  608. },
  609. "normalMap": {
  610. "value": "normal",
  611. "type": 28
  612. },
  613. "mainTexture": {
  614. "value": "white",
  615. "editor": {
  616. "displayName": "BaseColorMap"
  617. },
  618. "type": 28,
  619. "handleInfo": [
  620. "baseColorMap",
  621. 0,
  622. 28
  623. ]
  624. },
  625. "shadeMap1": {
  626. "value": "white",
  627. "type": 28
  628. },
  629. "shadeMap2": {
  630. "value": "white",
  631. "type": 28
  632. },
  633. "specularMap": {
  634. "value": "white",
  635. "type": 28
  636. },
  637. "emissiveMap": {
  638. "value": "grey",
  639. "type": 28
  640. },
  641. "baseColor": {
  642. "type": 16,
  643. "editor": {
  644. "visible": false,
  645. "deprecated": true
  646. },
  647. "value": [
  648. 0.6,
  649. 0.6,
  650. 0.6,
  651. 1
  652. ]
  653. },
  654. "colorScaleAndCutoff": {
  655. "type": 16,
  656. "editor": {
  657. "visible": false,
  658. "deprecated": true
  659. },
  660. "value": [
  661. 1,
  662. 1,
  663. 1,
  664. 0.5
  665. ]
  666. },
  667. "shadeParams": {
  668. "type": 16,
  669. "editor": {
  670. "visible": false,
  671. "deprecated": true
  672. },
  673. "value": [
  674. 0.8,
  675. 0.001,
  676. 0.5,
  677. 0.001
  678. ]
  679. },
  680. "miscParams": {
  681. "type": 16,
  682. "editor": {
  683. "visible": false,
  684. "deprecated": true
  685. },
  686. "value": [
  687. 0.5,
  688. 0,
  689. 0,
  690. 0
  691. ]
  692. },
  693. "emissiveScaleAndStrenth": {
  694. "type": 16,
  695. "editor": {
  696. "visible": false,
  697. "deprecated": true
  698. },
  699. "value": [
  700. 1,
  701. 1,
  702. 1,
  703. 1
  704. ]
  705. },
  706. "baseColorMap": {
  707. "type": 28,
  708. "editor": {
  709. "visible": false,
  710. "deprecated": true
  711. },
  712. "value": "white"
  713. }
  714. }
  715. },
  716. {
  717. "phase": "shadow-caster",
  718. "propertyIndex": 1,
  719. "rasterizerState": {
  720. "cullMode": 1
  721. },
  722. "program": "builtin-toon|shadow-caster-vs|shadow-caster-fs",
  723. "properties": {
  724. "tilingOffset": {
  725. "value": [
  726. 1,
  727. 1,
  728. 0,
  729. 0
  730. ],
  731. "type": 16
  732. },
  733. "mainColor": {
  734. "value": [
  735. 0.6,
  736. 0.6,
  737. 0.6,
  738. 1
  739. ],
  740. "editor": {
  741. "displayName": "BaseColor",
  742. "type": "color"
  743. },
  744. "type": 16,
  745. "handleInfo": [
  746. "baseColor",
  747. 0,
  748. 16
  749. ]
  750. },
  751. "colorScale": {
  752. "value": [
  753. 1,
  754. 1,
  755. 1
  756. ],
  757. "type": 15,
  758. "handleInfo": [
  759. "colorScaleAndCutoff",
  760. 0,
  761. 15
  762. ]
  763. },
  764. "alphaThreshold": {
  765. "value": [
  766. 0.5
  767. ],
  768. "editor": {
  769. "parent": "USE_ALPHA_TEST"
  770. },
  771. "type": 13,
  772. "handleInfo": [
  773. "colorScaleAndCutoff",
  774. 3,
  775. 13
  776. ]
  777. },
  778. "shadeColor1": {
  779. "value": [
  780. 0.4,
  781. 0.4,
  782. 0.4,
  783. 1
  784. ],
  785. "editor": {
  786. "type": "color"
  787. },
  788. "type": 16
  789. },
  790. "shadeColor2": {
  791. "value": [
  792. 0.2,
  793. 0.2,
  794. 0.2,
  795. 1
  796. ],
  797. "editor": {
  798. "type": "color"
  799. },
  800. "type": 16
  801. },
  802. "specular": {
  803. "value": [
  804. 1,
  805. 1,
  806. 1,
  807. 0.3
  808. ],
  809. "editor": {
  810. "type": "color"
  811. },
  812. "type": 16
  813. },
  814. "baseStep": {
  815. "value": [
  816. 0.8
  817. ],
  818. "type": 13,
  819. "handleInfo": [
  820. "shadeParams",
  821. 0,
  822. 13
  823. ]
  824. },
  825. "baseFeather": {
  826. "value": [
  827. 0.001
  828. ],
  829. "type": 13,
  830. "handleInfo": [
  831. "shadeParams",
  832. 1,
  833. 13
  834. ]
  835. },
  836. "shadeStep": {
  837. "value": [
  838. 0.5
  839. ],
  840. "type": 13,
  841. "handleInfo": [
  842. "shadeParams",
  843. 2,
  844. 13
  845. ]
  846. },
  847. "shadeFeather": {
  848. "value": [
  849. 0.001
  850. ],
  851. "type": 13,
  852. "handleInfo": [
  853. "shadeParams",
  854. 3,
  855. 13
  856. ]
  857. },
  858. "emissive": {
  859. "value": [
  860. 0,
  861. 0,
  862. 0,
  863. 1
  864. ],
  865. "editor": {
  866. "type": "color"
  867. },
  868. "type": 16
  869. },
  870. "emissiveScale": {
  871. "value": [
  872. 1,
  873. 1,
  874. 1
  875. ],
  876. "type": 15,
  877. "handleInfo": [
  878. "emissiveScaleAndStrenth",
  879. 0,
  880. 15
  881. ]
  882. },
  883. "normalStrenth": {
  884. "value": [
  885. 1
  886. ],
  887. "editor": {
  888. "parent": "USE_NORMAL_MAP"
  889. },
  890. "type": 13,
  891. "handleInfo": [
  892. "emissiveScaleAndStrenth",
  893. 3,
  894. 13
  895. ]
  896. },
  897. "mainTexture": {
  898. "value": "white",
  899. "editor": {
  900. "displayName": "BaseColorMap"
  901. },
  902. "type": 28,
  903. "handleInfo": [
  904. "baseColorMap",
  905. 0,
  906. 28
  907. ]
  908. },
  909. "baseColor": {
  910. "type": 16,
  911. "editor": {
  912. "visible": false,
  913. "deprecated": true
  914. },
  915. "value": [
  916. 0.6,
  917. 0.6,
  918. 0.6,
  919. 1
  920. ]
  921. },
  922. "colorScaleAndCutoff": {
  923. "type": 16,
  924. "editor": {
  925. "visible": false,
  926. "deprecated": true
  927. },
  928. "value": [
  929. 1,
  930. 1,
  931. 1,
  932. 0.5
  933. ]
  934. },
  935. "shadeParams": {
  936. "type": 16,
  937. "editor": {
  938. "visible": false,
  939. "deprecated": true
  940. },
  941. "value": [
  942. 0.8,
  943. 0.001,
  944. 0.5,
  945. 0.001
  946. ]
  947. },
  948. "emissiveScaleAndStrenth": {
  949. "type": 16,
  950. "editor": {
  951. "visible": false,
  952. "deprecated": true
  953. },
  954. "value": [
  955. 1,
  956. 1,
  957. 1,
  958. 1
  959. ]
  960. },
  961. "baseColorMap": {
  962. "type": 28,
  963. "editor": {
  964. "visible": false,
  965. "deprecated": true
  966. },
  967. "value": "white"
  968. }
  969. }
  970. },
  971. {
  972. "phase": "planar-shadow",
  973. "propertyIndex": 0,
  974. "blendState": {
  975. "targets": [
  976. {
  977. "blend": true,
  978. "blendSrc": 2,
  979. "blendDst": 4,
  980. "blendDstAlpha": 4
  981. }
  982. ]
  983. },
  984. "program": "builtin-toon|planar-shadow-vs|planar-shadow-fs",
  985. "depthStencilState": {
  986. "depthTest": true,
  987. "depthWrite": false,
  988. "stencilTestFront": true,
  989. "stencilFuncFront": 5,
  990. "stencilPassOpFront": 2,
  991. "stencilRefBack": 128,
  992. "stencilRefFront": 128,
  993. "stencilReadMaskBack": 128,
  994. "stencilReadMaskFront": 128,
  995. "stencilWriteMaskBack": 128,
  996. "stencilWriteMaskFront": 128
  997. }
  998. },
  999. {
  1000. "phase": "deferred-forward",
  1001. "rasterizerState": {
  1002. "cullMode": 1
  1003. },
  1004. "propertyIndex": 0,
  1005. "program": "builtin-toon|silhouette-edge-vs|silhouette-edge-fs",
  1006. "depthStencilState": {
  1007. "depthFunc": 3,
  1008. "depthTest": true,
  1009. "depthWrite": true
  1010. },
  1011. "switch": "USE_OUTLINE_PASS"
  1012. },
  1013. {
  1014. "phase": "deferred-forward",
  1015. "propertyIndex": 1,
  1016. "program": "builtin-toon|toon-vs|toon-fs"
  1017. }
  1018. ]
  1019. }
  1020. ],
  1021. "shaders": [
  1022. {
  1023. "blocks": [
  1024. {
  1025. "name": "OutlineVert",
  1026. "members": [
  1027. {
  1028. "name": "outlineParams",
  1029. "type": 16,
  1030. "count": 1
  1031. }
  1032. ],
  1033. "defines": [],
  1034. "stageFlags": 1,
  1035. "binding": 0
  1036. },
  1037. {
  1038. "name": "OutlineFrag",
  1039. "members": [
  1040. {
  1041. "name": "baseColor",
  1042. "type": 16,
  1043. "count": 1
  1044. }
  1045. ],
  1046. "defines": [],
  1047. "stageFlags": 16,
  1048. "binding": 1
  1049. }
  1050. ],
  1051. "samplerTextures": [
  1052. {
  1053. "name": "baseColorMap",
  1054. "type": 28,
  1055. "count": 1,
  1056. "defines": [
  1057. "USE_BASE_COLOR_MAP"
  1058. ],
  1059. "stageFlags": 16,
  1060. "binding": 2
  1061. }
  1062. ],
  1063. "samplers": [],
  1064. "textures": [],
  1065. "buffers": [],
  1066. "images": [],
  1067. "subpassInputs": [],
  1068. "attributes": [
  1069. {
  1070. "name": "a_position",
  1071. "defines": [],
  1072. "format": 32,
  1073. "location": 0
  1074. },
  1075. {
  1076. "name": "a_normal",
  1077. "defines": [],
  1078. "format": 32,
  1079. "location": 1
  1080. },
  1081. {
  1082. "name": "a_texCoord",
  1083. "defines": [],
  1084. "format": 21,
  1085. "location": 2
  1086. },
  1087. {
  1088. "name": "a_tangent",
  1089. "defines": [],
  1090. "format": 44,
  1091. "location": 3
  1092. },
  1093. {
  1094. "name": "a_color",
  1095. "defines": [],
  1096. "format": 44,
  1097. "location": 6
  1098. },
  1099. {
  1100. "name": "a_texCoord1",
  1101. "defines": [],
  1102. "format": 21,
  1103. "location": 7
  1104. },
  1105. {
  1106. "name": "a_joints",
  1107. "defines": [
  1108. "CC_USE_SKINNING"
  1109. ],
  1110. "location": 4
  1111. },
  1112. {
  1113. "name": "a_weights",
  1114. "defines": [
  1115. "CC_USE_SKINNING"
  1116. ],
  1117. "format": 44,
  1118. "location": 5
  1119. },
  1120. {
  1121. "name": "a_jointAnimInfo",
  1122. "defines": [
  1123. "USE_INSTANCING",
  1124. "CC_USE_BAKED_ANIMATION"
  1125. ],
  1126. "format": 44,
  1127. "isInstanced": true,
  1128. "location": 8
  1129. },
  1130. {
  1131. "name": "a_matWorld0",
  1132. "defines": [
  1133. "USE_INSTANCING"
  1134. ],
  1135. "format": 44,
  1136. "isInstanced": true,
  1137. "location": 9
  1138. },
  1139. {
  1140. "name": "a_matWorld1",
  1141. "defines": [
  1142. "USE_INSTANCING"
  1143. ],
  1144. "format": 44,
  1145. "isInstanced": true,
  1146. "location": 10
  1147. },
  1148. {
  1149. "name": "a_matWorld2",
  1150. "defines": [
  1151. "USE_INSTANCING"
  1152. ],
  1153. "format": 44,
  1154. "isInstanced": true,
  1155. "location": 11
  1156. },
  1157. {
  1158. "name": "a_lightingMapUVParam",
  1159. "defines": [
  1160. "USE_INSTANCING",
  1161. "CC_USE_LIGHTMAP"
  1162. ],
  1163. "format": 44,
  1164. "isInstanced": true,
  1165. "location": 12
  1166. },
  1167. {
  1168. "name": "a_localShadowBiasAndProbeId",
  1169. "defines": [
  1170. "USE_INSTANCING"
  1171. ],
  1172. "format": 44,
  1173. "isInstanced": true,
  1174. "location": 13
  1175. },
  1176. {
  1177. "name": "a_reflectionProbeData",
  1178. "defines": [
  1179. "USE_INSTANCING",
  1180. "CC_USE_REFLECTION_PROBE"
  1181. ],
  1182. "format": 44,
  1183. "isInstanced": true,
  1184. "location": 14
  1185. },
  1186. {
  1187. "name": "a_sh_linear_const_r",
  1188. "defines": [
  1189. "USE_INSTANCING",
  1190. "CC_USE_LIGHT_PROBE"
  1191. ],
  1192. "format": 44,
  1193. "isInstanced": true,
  1194. "location": 15
  1195. },
  1196. {
  1197. "name": "a_sh_linear_const_g",
  1198. "defines": [
  1199. "USE_INSTANCING",
  1200. "CC_USE_LIGHT_PROBE"
  1201. ],
  1202. "format": 44,
  1203. "isInstanced": true,
  1204. "location": 16
  1205. },
  1206. {
  1207. "name": "a_sh_linear_const_b",
  1208. "defines": [
  1209. "USE_INSTANCING",
  1210. "CC_USE_LIGHT_PROBE"
  1211. ],
  1212. "format": 44,
  1213. "isInstanced": true,
  1214. "location": 17
  1215. },
  1216. {
  1217. "name": "a_vertexId",
  1218. "defines": [
  1219. "CC_USE_MORPH"
  1220. ],
  1221. "format": 11,
  1222. "location": 18
  1223. }
  1224. ],
  1225. "varyings": [
  1226. {
  1227. "name": "v_worldPos",
  1228. "type": 15,
  1229. "count": 1,
  1230. "defines": [],
  1231. "stageFlags": 17,
  1232. "location": 0
  1233. },
  1234. {
  1235. "name": "v_normal",
  1236. "type": 16,
  1237. "count": 1,
  1238. "defines": [],
  1239. "stageFlags": 17,
  1240. "location": 1
  1241. },
  1242. {
  1243. "name": "v_uv",
  1244. "type": 14,
  1245. "count": 1,
  1246. "defines": [],
  1247. "stageFlags": 17,
  1248. "location": 2
  1249. },
  1250. {
  1251. "name": "v_color",
  1252. "type": 16,
  1253. "count": 1,
  1254. "defines": [],
  1255. "stageFlags": 17,
  1256. "location": 3
  1257. },
  1258. {
  1259. "name": "v_tangent",
  1260. "type": 16,
  1261. "count": 1,
  1262. "defines": [],
  1263. "stageFlags": 17,
  1264. "location": 4
  1265. },
  1266. {
  1267. "name": "v_uv1",
  1268. "type": 14,
  1269. "count": 1,
  1270. "defines": [],
  1271. "stageFlags": 17,
  1272. "location": 5
  1273. },
  1274. {
  1275. "name": "v_luv",
  1276. "type": 15,
  1277. "count": 1,
  1278. "defines": [
  1279. "CC_USE_LIGHTMAP",
  1280. "!CC_FORWARD_ADD"
  1281. ],
  1282. "stageFlags": 17,
  1283. "location": 6
  1284. },
  1285. {
  1286. "name": "v_shadowBiasAndProbeId",
  1287. "type": 16,
  1288. "count": 1,
  1289. "defines": [],
  1290. "stageFlags": 17,
  1291. "location": 7
  1292. },
  1293. {
  1294. "name": "v_reflectionProbeData",
  1295. "type": 16,
  1296. "count": 1,
  1297. "defines": [
  1298. "CC_USE_REFLECTION_PROBE",
  1299. "USE_INSTANCING"
  1300. ],
  1301. "stageFlags": 17,
  1302. "location": 8
  1303. },
  1304. {
  1305. "name": "v_fogFactor",
  1306. "type": 13,
  1307. "count": 1,
  1308. "defines": [
  1309. "CC_USE_FOG",
  1310. "!CC_USE_ACCURATE_FOG"
  1311. ],
  1312. "stageFlags": 17,
  1313. "location": 9
  1314. },
  1315. {
  1316. "name": "v_localPos",
  1317. "type": 16,
  1318. "count": 1,
  1319. "defines": [],
  1320. "stageFlags": 17,
  1321. "location": 10
  1322. },
  1323. {
  1324. "name": "v_clipPos",
  1325. "type": 16,
  1326. "count": 1,
  1327. "defines": [],
  1328. "stageFlags": 17,
  1329. "location": 11
  1330. },
  1331. {
  1332. "name": "v_sh_linear_const_r",
  1333. "type": 16,
  1334. "count": 1,
  1335. "defines": [
  1336. "CC_USE_LIGHT_PROBE",
  1337. "USE_INSTANCING"
  1338. ],
  1339. "stageFlags": 17,
  1340. "location": 12
  1341. },
  1342. {
  1343. "name": "v_sh_linear_const_g",
  1344. "type": 16,
  1345. "count": 1,
  1346. "defines": [
  1347. "CC_USE_LIGHT_PROBE",
  1348. "USE_INSTANCING"
  1349. ],
  1350. "stageFlags": 17,
  1351. "location": 13
  1352. },
  1353. {
  1354. "name": "v_sh_linear_const_b",
  1355. "type": 16,
  1356. "count": 1,
  1357. "defines": [
  1358. "CC_USE_LIGHT_PROBE",
  1359. "USE_INSTANCING"
  1360. ],
  1361. "stageFlags": 17,
  1362. "location": 14
  1363. }
  1364. ],
  1365. "fragColors": [
  1366. {
  1367. "name": "fragColorX",
  1368. "typename": "vec4",
  1369. "type": 16,
  1370. "count": 1,
  1371. "defines": [],
  1372. "stageFlags": 16,
  1373. "location": 0
  1374. }
  1375. ],
  1376. "descriptors": [
  1377. {
  1378. "rate": 0,
  1379. "blocks": [
  1380. {
  1381. "tags": {
  1382. "builtin": "local"
  1383. },
  1384. "name": "CCLocal",
  1385. "members": [
  1386. {
  1387. "name": "cc_matWorld",
  1388. "typename": "mat4",
  1389. "type": 25,
  1390. "count": 1,
  1391. "precision": "highp "
  1392. },
  1393. {
  1394. "name": "cc_matWorldIT",
  1395. "typename": "mat4",
  1396. "type": 25,
  1397. "count": 1,
  1398. "precision": "highp "
  1399. },
  1400. {
  1401. "name": "cc_lightingMapUVParam",
  1402. "typename": "vec4",
  1403. "type": 16,
  1404. "count": 1,
  1405. "precision": "highp "
  1406. },
  1407. {
  1408. "name": "cc_localShadowBias",
  1409. "typename": "vec4",
  1410. "type": 16,
  1411. "count": 1,
  1412. "precision": "highp "
  1413. },
  1414. {
  1415. "name": "cc_reflectionProbeData1",
  1416. "typename": "vec4",
  1417. "type": 16,
  1418. "count": 1,
  1419. "precision": "highp "
  1420. },
  1421. {
  1422. "name": "cc_reflectionProbeData2",
  1423. "typename": "vec4",
  1424. "type": 16,
  1425. "count": 1,
  1426. "precision": "highp "
  1427. },
  1428. {
  1429. "name": "cc_reflectionProbeBlendData1",
  1430. "typename": "vec4",
  1431. "type": 16,
  1432. "count": 1,
  1433. "precision": "highp "
  1434. },
  1435. {
  1436. "name": "cc_reflectionProbeBlendData2",
  1437. "typename": "vec4",
  1438. "type": 16,
  1439. "count": 1,
  1440. "precision": "highp "
  1441. }
  1442. ],
  1443. "defines": [
  1444. "!USE_INSTANCING"
  1445. ],
  1446. "stageFlags": 17
  1447. },
  1448. {
  1449. "tags": {
  1450. "builtin": "local"
  1451. },
  1452. "name": "CCMorph",
  1453. "members": [
  1454. {
  1455. "name": "cc_displacementWeights",
  1456. "typename": "vec4",
  1457. "type": 16,
  1458. "count": 15,
  1459. "isArray": true
  1460. },
  1461. {
  1462. "name": "cc_displacementTextureInfo",
  1463. "typename": "vec4",
  1464. "type": 16,
  1465. "count": 1
  1466. }
  1467. ],
  1468. "defines": [
  1469. "CC_USE_MORPH"
  1470. ],
  1471. "stageFlags": 1
  1472. },
  1473. {
  1474. "tags": {
  1475. "builtin": "local"
  1476. },
  1477. "name": "CCSkinningTexture",
  1478. "members": [
  1479. {
  1480. "name": "cc_jointTextureInfo",
  1481. "typename": "vec4",
  1482. "type": 16,
  1483. "count": 1,
  1484. "precision": "highp "
  1485. }
  1486. ],
  1487. "defines": [
  1488. "CC_USE_SKINNING",
  1489. "CC_USE_BAKED_ANIMATION"
  1490. ],
  1491. "stageFlags": 1
  1492. },
  1493. {
  1494. "tags": {
  1495. "builtin": "local"
  1496. },
  1497. "name": "CCSkinningAnimation",
  1498. "members": [
  1499. {
  1500. "name": "cc_jointAnimInfo",
  1501. "typename": "vec4",
  1502. "type": 16,
  1503. "count": 1,
  1504. "precision": "highp "
  1505. }
  1506. ],
  1507. "defines": [
  1508. "CC_USE_SKINNING",
  1509. "CC_USE_BAKED_ANIMATION"
  1510. ],
  1511. "stageFlags": 1
  1512. },
  1513. {
  1514. "tags": {
  1515. "builtin": "local"
  1516. },
  1517. "name": "CCSkinning",
  1518. "members": [
  1519. {
  1520. "name": "cc_joints",
  1521. "typename": "vec4",
  1522. "type": 16,
  1523. "count": 0,
  1524. "precision": "highp ",
  1525. "isArray": true
  1526. }
  1527. ],
  1528. "defines": [
  1529. "CC_USE_SKINNING",
  1530. "!CC_USE_BAKED_ANIMATION",
  1531. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  1532. ],
  1533. "stageFlags": 1
  1534. },
  1535. {
  1536. "tags": {
  1537. "builtin": "local"
  1538. },
  1539. "name": "CCForwardLight",
  1540. "members": [
  1541. {
  1542. "name": "cc_lightPos",
  1543. "typename": "vec4",
  1544. "type": 16,
  1545. "count": 0,
  1546. "precision": "highp ",
  1547. "isArray": true
  1548. },
  1549. {
  1550. "name": "cc_lightColor",
  1551. "typename": "vec4",
  1552. "type": 16,
  1553. "count": 0,
  1554. "isArray": true
  1555. },
  1556. {
  1557. "name": "cc_lightSizeRangeAngle",
  1558. "typename": "vec4",
  1559. "type": 16,
  1560. "count": 0,
  1561. "isArray": true
  1562. },
  1563. {
  1564. "name": "cc_lightDir",
  1565. "typename": "vec4",
  1566. "type": 16,
  1567. "count": 0,
  1568. "isArray": true
  1569. },
  1570. {
  1571. "name": "cc_lightBoundingSizeVS",
  1572. "typename": "vec4",
  1573. "type": 16,
  1574. "count": 0,
  1575. "isArray": true
  1576. }
  1577. ],
  1578. "defines": [
  1579. "CC_FORWARD_ADD",
  1580. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  1581. ],
  1582. "stageFlags": 16
  1583. },
  1584. {
  1585. "tags": {
  1586. "builtin": "local"
  1587. },
  1588. "name": "CCSH",
  1589. "members": [
  1590. {
  1591. "name": "cc_sh_linear_const_r",
  1592. "typename": "vec4",
  1593. "type": 16,
  1594. "count": 1
  1595. },
  1596. {
  1597. "name": "cc_sh_linear_const_g",
  1598. "typename": "vec4",
  1599. "type": 16,
  1600. "count": 1
  1601. },
  1602. {
  1603. "name": "cc_sh_linear_const_b",
  1604. "typename": "vec4",
  1605. "type": 16,
  1606. "count": 1
  1607. },
  1608. {
  1609. "name": "cc_sh_quadratic_r",
  1610. "typename": "vec4",
  1611. "type": 16,
  1612. "count": 1
  1613. },
  1614. {
  1615. "name": "cc_sh_quadratic_g",
  1616. "typename": "vec4",
  1617. "type": 16,
  1618. "count": 1
  1619. },
  1620. {
  1621. "name": "cc_sh_quadratic_b",
  1622. "typename": "vec4",
  1623. "type": 16,
  1624. "count": 1
  1625. },
  1626. {
  1627. "name": "cc_sh_quadratic_a",
  1628. "typename": "vec4",
  1629. "type": 16,
  1630. "count": 1
  1631. }
  1632. ],
  1633. "defines": [
  1634. "CC_USE_LIGHT_PROBE",
  1635. "!USE_INSTANCING"
  1636. ],
  1637. "stageFlags": 16
  1638. }
  1639. ],
  1640. "samplerTextures": [
  1641. {
  1642. "tags": {
  1643. "builtin": "local"
  1644. },
  1645. "name": "cc_PositionDisplacements",
  1646. "typename": "sampler2D",
  1647. "type": 28,
  1648. "count": 1,
  1649. "defines": [
  1650. "CC_USE_MORPH",
  1651. "CC_MORPH_TARGET_HAS_POSITION"
  1652. ],
  1653. "stageFlags": 1
  1654. },
  1655. {
  1656. "tags": {
  1657. "builtin": "local"
  1658. },
  1659. "name": "cc_NormalDisplacements",
  1660. "typename": "sampler2D",
  1661. "type": 28,
  1662. "count": 1,
  1663. "defines": [
  1664. "CC_USE_MORPH",
  1665. "CC_MORPH_TARGET_HAS_NORMAL"
  1666. ],
  1667. "stageFlags": 1
  1668. },
  1669. {
  1670. "tags": {
  1671. "builtin": "local"
  1672. },
  1673. "name": "cc_TangentDisplacements",
  1674. "typename": "sampler2D",
  1675. "type": 28,
  1676. "count": 1,
  1677. "defines": [
  1678. "CC_USE_MORPH",
  1679. "CC_MORPH_TARGET_HAS_TANGENT"
  1680. ],
  1681. "stageFlags": 1
  1682. },
  1683. {
  1684. "tags": {
  1685. "builtin": "local"
  1686. },
  1687. "name": "cc_jointTexture",
  1688. "typename": "sampler2D",
  1689. "type": 28,
  1690. "count": 1,
  1691. "precision": "highp ",
  1692. "defines": [
  1693. "CC_USE_SKINNING",
  1694. "CC_USE_BAKED_ANIMATION"
  1695. ],
  1696. "stageFlags": 1
  1697. },
  1698. {
  1699. "tags": {
  1700. "builtin": "local"
  1701. },
  1702. "name": "cc_realtimeJoint",
  1703. "typename": "sampler2D",
  1704. "type": 28,
  1705. "count": 1,
  1706. "precision": "highp ",
  1707. "defines": [
  1708. "CC_USE_SKINNING",
  1709. "!CC_USE_BAKED_ANIMATION",
  1710. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  1711. ],
  1712. "stageFlags": 1
  1713. },
  1714. {
  1715. "tags": {
  1716. "builtin": "local"
  1717. },
  1718. "name": "cc_reflectionProbeCubemap",
  1719. "typename": "samplerCube",
  1720. "type": 31,
  1721. "count": 1,
  1722. "defines": [
  1723. "CC_USE_REFLECTION_PROBE"
  1724. ],
  1725. "stageFlags": 16
  1726. },
  1727. {
  1728. "tags": {
  1729. "builtin": "local"
  1730. },
  1731. "name": "cc_reflectionProbePlanarMap",
  1732. "typename": "sampler2D",
  1733. "type": 28,
  1734. "count": 1,
  1735. "defines": [
  1736. "CC_USE_REFLECTION_PROBE"
  1737. ],
  1738. "stageFlags": 16
  1739. },
  1740. {
  1741. "tags": {
  1742. "builtin": "local"
  1743. },
  1744. "name": "cc_reflectionProbeDataMap",
  1745. "typename": "sampler2D",
  1746. "type": 28,
  1747. "count": 1,
  1748. "defines": [
  1749. "CC_USE_REFLECTION_PROBE"
  1750. ],
  1751. "stageFlags": 16
  1752. },
  1753. {
  1754. "tags": {
  1755. "builtin": "local"
  1756. },
  1757. "name": "cc_reflectionProbeBlendCubemap",
  1758. "typename": "samplerCube",
  1759. "type": 31,
  1760. "count": 1,
  1761. "defines": [
  1762. "CC_USE_REFLECTION_PROBE"
  1763. ],
  1764. "stageFlags": 16
  1765. },
  1766. {
  1767. "tags": {
  1768. "builtin": "local"
  1769. },
  1770. "name": "cc_lightingMap",
  1771. "typename": "sampler2D",
  1772. "type": 28,
  1773. "count": 1,
  1774. "defines": [
  1775. "CC_USE_LIGHTMAP",
  1776. "!CC_FORWARD_ADD"
  1777. ],
  1778. "stageFlags": 16
  1779. }
  1780. ],
  1781. "samplers": [],
  1782. "textures": [],
  1783. "buffers": [],
  1784. "images": [],
  1785. "subpassInputs": []
  1786. },
  1787. {
  1788. "rate": 1,
  1789. "blocks": [
  1790. {
  1791. "name": "OutlineVert",
  1792. "members": [
  1793. {
  1794. "name": "outlineParams",
  1795. "type": 16,
  1796. "count": 1
  1797. }
  1798. ],
  1799. "defines": [],
  1800. "stageFlags": 1,
  1801. "binding": 0
  1802. },
  1803. {
  1804. "name": "OutlineFrag",
  1805. "members": [
  1806. {
  1807. "name": "baseColor",
  1808. "type": 16,
  1809. "count": 1
  1810. }
  1811. ],
  1812. "defines": [],
  1813. "stageFlags": 16,
  1814. "binding": 1
  1815. }
  1816. ],
  1817. "samplerTextures": [
  1818. {
  1819. "name": "baseColorMap",
  1820. "type": 28,
  1821. "count": 1,
  1822. "defines": [
  1823. "USE_BASE_COLOR_MAP"
  1824. ],
  1825. "stageFlags": 16,
  1826. "binding": 2
  1827. }
  1828. ],
  1829. "samplers": [],
  1830. "textures": [],
  1831. "buffers": [],
  1832. "images": [],
  1833. "subpassInputs": []
  1834. },
  1835. {
  1836. "rate": 2,
  1837. "blocks": [],
  1838. "samplerTextures": [],
  1839. "samplers": [],
  1840. "textures": [],
  1841. "buffers": [],
  1842. "images": [],
  1843. "subpassInputs": []
  1844. },
  1845. {
  1846. "rate": 3,
  1847. "blocks": [
  1848. {
  1849. "tags": {
  1850. "builtin": "global"
  1851. },
  1852. "name": "CCGlobal",
  1853. "members": [
  1854. {
  1855. "name": "cc_time",
  1856. "typename": "vec4",
  1857. "type": 16,
  1858. "count": 1,
  1859. "precision": "highp "
  1860. },
  1861. {
  1862. "name": "cc_screenSize",
  1863. "typename": "vec4",
  1864. "type": 16,
  1865. "count": 1,
  1866. "precision": "mediump "
  1867. },
  1868. {
  1869. "name": "cc_nativeSize",
  1870. "typename": "vec4",
  1871. "type": 16,
  1872. "count": 1,
  1873. "precision": "mediump "
  1874. },
  1875. {
  1876. "name": "cc_probeInfo",
  1877. "typename": "vec4",
  1878. "type": 16,
  1879. "count": 1,
  1880. "precision": "mediump "
  1881. },
  1882. {
  1883. "name": "cc_debug_view_mode",
  1884. "typename": "vec4",
  1885. "type": 16,
  1886. "count": 1,
  1887. "precision": "mediump "
  1888. }
  1889. ],
  1890. "defines": [],
  1891. "stageFlags": 17
  1892. },
  1893. {
  1894. "tags": {
  1895. "builtin": "global"
  1896. },
  1897. "name": "CCCamera",
  1898. "members": [
  1899. {
  1900. "name": "cc_matView",
  1901. "typename": "mat4",
  1902. "type": 25,
  1903. "count": 1,
  1904. "precision": "highp "
  1905. },
  1906. {
  1907. "name": "cc_matViewInv",
  1908. "typename": "mat4",
  1909. "type": 25,
  1910. "count": 1,
  1911. "precision": "highp "
  1912. },
  1913. {
  1914. "name": "cc_matProj",
  1915. "typename": "mat4",
  1916. "type": 25,
  1917. "count": 1,
  1918. "precision": "highp "
  1919. },
  1920. {
  1921. "name": "cc_matProjInv",
  1922. "typename": "mat4",
  1923. "type": 25,
  1924. "count": 1,
  1925. "precision": "highp "
  1926. },
  1927. {
  1928. "name": "cc_matViewProj",
  1929. "typename": "mat4",
  1930. "type": 25,
  1931. "count": 1,
  1932. "precision": "highp "
  1933. },
  1934. {
  1935. "name": "cc_matViewProjInv",
  1936. "typename": "mat4",
  1937. "type": 25,
  1938. "count": 1,
  1939. "precision": "highp "
  1940. },
  1941. {
  1942. "name": "cc_cameraPos",
  1943. "typename": "vec4",
  1944. "type": 16,
  1945. "count": 1,
  1946. "precision": "highp "
  1947. },
  1948. {
  1949. "name": "cc_surfaceTransform",
  1950. "typename": "vec4",
  1951. "type": 16,
  1952. "count": 1,
  1953. "precision": "mediump "
  1954. },
  1955. {
  1956. "name": "cc_screenScale",
  1957. "typename": "vec4",
  1958. "type": 16,
  1959. "count": 1,
  1960. "precision": "mediump "
  1961. },
  1962. {
  1963. "name": "cc_exposure",
  1964. "typename": "vec4",
  1965. "type": 16,
  1966. "count": 1,
  1967. "precision": "mediump "
  1968. },
  1969. {
  1970. "name": "cc_mainLitDir",
  1971. "typename": "vec4",
  1972. "type": 16,
  1973. "count": 1,
  1974. "precision": "mediump "
  1975. },
  1976. {
  1977. "name": "cc_mainLitColor",
  1978. "typename": "vec4",
  1979. "type": 16,
  1980. "count": 1,
  1981. "precision": "mediump "
  1982. },
  1983. {
  1984. "name": "cc_ambientSky",
  1985. "typename": "vec4",
  1986. "type": 16,
  1987. "count": 1,
  1988. "precision": "mediump "
  1989. },
  1990. {
  1991. "name": "cc_ambientGround",
  1992. "typename": "vec4",
  1993. "type": 16,
  1994. "count": 1,
  1995. "precision": "mediump "
  1996. },
  1997. {
  1998. "name": "cc_fogColor",
  1999. "typename": "vec4",
  2000. "type": 16,
  2001. "count": 1,
  2002. "precision": "mediump "
  2003. },
  2004. {
  2005. "name": "cc_fogBase",
  2006. "typename": "vec4",
  2007. "type": 16,
  2008. "count": 1,
  2009. "precision": "mediump "
  2010. },
  2011. {
  2012. "name": "cc_fogAdd",
  2013. "typename": "vec4",
  2014. "type": 16,
  2015. "count": 1,
  2016. "precision": "mediump "
  2017. },
  2018. {
  2019. "name": "cc_nearFar",
  2020. "typename": "vec4",
  2021. "type": 16,
  2022. "count": 1,
  2023. "precision": "mediump "
  2024. },
  2025. {
  2026. "name": "cc_viewPort",
  2027. "typename": "vec4",
  2028. "type": 16,
  2029. "count": 1,
  2030. "precision": "mediump "
  2031. }
  2032. ],
  2033. "defines": [],
  2034. "stageFlags": 17
  2035. },
  2036. {
  2037. "tags": {
  2038. "builtin": "global"
  2039. },
  2040. "name": "CCShadow",
  2041. "members": [
  2042. {
  2043. "name": "cc_matLightView",
  2044. "typename": "mat4",
  2045. "type": 25,
  2046. "count": 1,
  2047. "precision": "highp "
  2048. },
  2049. {
  2050. "name": "cc_matLightViewProj",
  2051. "typename": "mat4",
  2052. "type": 25,
  2053. "count": 1,
  2054. "precision": "highp "
  2055. },
  2056. {
  2057. "name": "cc_shadowInvProjDepthInfo",
  2058. "typename": "vec4",
  2059. "type": 16,
  2060. "count": 1,
  2061. "precision": "highp "
  2062. },
  2063. {
  2064. "name": "cc_shadowProjDepthInfo",
  2065. "typename": "vec4",
  2066. "type": 16,
  2067. "count": 1,
  2068. "precision": "highp "
  2069. },
  2070. {
  2071. "name": "cc_shadowProjInfo",
  2072. "typename": "vec4",
  2073. "type": 16,
  2074. "count": 1,
  2075. "precision": "highp "
  2076. },
  2077. {
  2078. "name": "cc_shadowNFLSInfo",
  2079. "typename": "vec4",
  2080. "type": 16,
  2081. "count": 1,
  2082. "precision": "mediump "
  2083. },
  2084. {
  2085. "name": "cc_shadowWHPBInfo",
  2086. "typename": "vec4",
  2087. "type": 16,
  2088. "count": 1,
  2089. "precision": "mediump "
  2090. },
  2091. {
  2092. "name": "cc_shadowLPNNInfo",
  2093. "typename": "vec4",
  2094. "type": 16,
  2095. "count": 1,
  2096. "precision": "mediump "
  2097. },
  2098. {
  2099. "name": "cc_shadowColor",
  2100. "typename": "vec4",
  2101. "type": 16,
  2102. "count": 1,
  2103. "precision": "lowp "
  2104. },
  2105. {
  2106. "name": "cc_planarNDInfo",
  2107. "typename": "vec4",
  2108. "type": 16,
  2109. "count": 1,
  2110. "precision": "mediump "
  2111. }
  2112. ],
  2113. "defines": [],
  2114. "stageFlags": 17
  2115. },
  2116. {
  2117. "tags": {
  2118. "builtin": "global"
  2119. },
  2120. "name": "CCCSM",
  2121. "members": [
  2122. {
  2123. "name": "cc_csmViewDir0",
  2124. "typename": "vec4",
  2125. "type": 16,
  2126. "count": 4,
  2127. "precision": "highp ",
  2128. "isArray": true
  2129. },
  2130. {
  2131. "name": "cc_csmViewDir1",
  2132. "typename": "vec4",
  2133. "type": 16,
  2134. "count": 4,
  2135. "precision": "highp ",
  2136. "isArray": true
  2137. },
  2138. {
  2139. "name": "cc_csmViewDir2",
  2140. "typename": "vec4",
  2141. "type": 16,
  2142. "count": 4,
  2143. "precision": "highp ",
  2144. "isArray": true
  2145. },
  2146. {
  2147. "name": "cc_csmAtlas",
  2148. "typename": "vec4",
  2149. "type": 16,
  2150. "count": 4,
  2151. "precision": "highp ",
  2152. "isArray": true
  2153. },
  2154. {
  2155. "name": "cc_matCSMViewProj",
  2156. "typename": "mat4",
  2157. "type": 25,
  2158. "count": 4,
  2159. "precision": "highp ",
  2160. "isArray": true
  2161. },
  2162. {
  2163. "name": "cc_csmProjDepthInfo",
  2164. "typename": "vec4",
  2165. "type": 16,
  2166. "count": 4,
  2167. "precision": "highp ",
  2168. "isArray": true
  2169. },
  2170. {
  2171. "name": "cc_csmProjInfo",
  2172. "typename": "vec4",
  2173. "type": 16,
  2174. "count": 4,
  2175. "precision": "highp ",
  2176. "isArray": true
  2177. },
  2178. {
  2179. "name": "cc_csmSplitsInfo",
  2180. "typename": "vec4",
  2181. "type": 16,
  2182. "count": 1,
  2183. "precision": "highp "
  2184. }
  2185. ],
  2186. "defines": [
  2187. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  2188. ],
  2189. "stageFlags": 16
  2190. }
  2191. ],
  2192. "samplerTextures": [
  2193. {
  2194. "tags": {
  2195. "builtin": "global"
  2196. },
  2197. "name": "cc_environment",
  2198. "typename": "samplerCube",
  2199. "type": 31,
  2200. "count": 1,
  2201. "defines": [],
  2202. "stageFlags": 16
  2203. },
  2204. {
  2205. "tags": {
  2206. "builtin": "global"
  2207. },
  2208. "name": "cc_diffuseMap",
  2209. "typename": "samplerCube",
  2210. "type": 31,
  2211. "count": 1,
  2212. "defines": [
  2213. "CC_USE_IBL",
  2214. "CC_USE_DIFFUSEMAP"
  2215. ],
  2216. "stageFlags": 16
  2217. },
  2218. {
  2219. "tags": {
  2220. "builtin": "global"
  2221. },
  2222. "name": "cc_shadowMap",
  2223. "typename": "sampler2D",
  2224. "type": 28,
  2225. "count": 1,
  2226. "precision": "highp ",
  2227. "defines": [
  2228. "CC_RECEIVE_SHADOW"
  2229. ],
  2230. "stageFlags": 16
  2231. },
  2232. {
  2233. "tags": {
  2234. "builtin": "global"
  2235. },
  2236. "name": "cc_spotShadowMap",
  2237. "typename": "sampler2D",
  2238. "type": 28,
  2239. "count": 1,
  2240. "precision": "highp ",
  2241. "defines": [
  2242. "CC_RECEIVE_SHADOW"
  2243. ],
  2244. "stageFlags": 16
  2245. }
  2246. ],
  2247. "samplers": [],
  2248. "textures": [],
  2249. "buffers": [],
  2250. "images": [],
  2251. "subpassInputs": []
  2252. }
  2253. ],
  2254. "hash": 3857170659,
  2255. "glsl4": {
  2256. "vert": "#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define CC_SURFACES_USE_TANGENT_SPACE 0\n#define CC_SURFACES_USE_VERTEX_COLOR 0\n#define CC_SURFACES_USE_SECOND_UV 0\n#define CC_SURFACES_USE_LIGHT_MAP 0\n#define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 3) in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 6) in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n layout(location = 7) in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 8) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 9) in vec4 a_matWorld0;\n layout(location = 10) in vec4 a_matWorld1;\n layout(location = 11) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 12) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 13) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 14) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 15) in vec4 a_sh_linear_const_r;\n layout(location = 16) in vec4 a_sh_linear_const_g;\n layout(location = 17) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nlayout(location = 0) out highp vec3 v_worldPos;\nlayout(location = 1) out vec4 v_normal;\nlayout(location = 2) out vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 3) out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 4) out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n layout(location = 5) out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 6) out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 7) out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 8) out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n layout(location = 9) out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n layout(location = 10) out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n layout(location = 11) out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 12) out mediump vec4 v_sh_linear_const_r;\n layout(location = 13) out mediump vec4 v_sh_linear_const_g;\n layout(location = 14) out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(set = 2, binding = 3) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(set = 2, binding = 2) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n layout(set = 2, binding = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n#endif\n layout(set = 1, binding = 0) uniform OutlineVert {\n vec4 outlineParams;\n};\n #define CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\n vec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n {\n float width = outlineParams.x * 0.001;\n vec3 localPos = In.position.xyz;\n #if USE_POSITION_SCALING\n vec3 dir = normalize(localPos);\n float flip = dot(dir, normalize(In.normal)) < 0.0 ? -1.0 : 1.0;\n localPos += flip * dir * width * 2.0;\n #else\n localPos += normalize(In.normal) * width;\n #endif\n return localPos;\n }\n #define CC_SURFACES_VERTEX_MODIFY_CLIP_POS\n vec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n {\n vec4 clipPos = In.clipPos;\n float scaleZ = cc_nearFar.z == 0.0 ? 0.5 : 1.0;\n clipPos.z -= outlineParams.y * 0.002 * scaleZ;\n return clipPos;\n }\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\nvec3 SurfacesVertexModifyLocalNormal(in SurfacesStandardVertexIntermediate In)\n{\n return In.normal.xyz;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec4 SurfacesVertexModifyLocalTangent(in SurfacesStandardVertexIntermediate In)\n {\n return In.tangent;\n }\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\nvec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)\n{\n vec3 worldNormal = In.worldNormal.xyz;\n #if CC_SURFACES_USE_TWO_SIDED\n worldNormal.xyz *= In.worldNormal.w;\n #endif\n return worldNormal;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);\n#endif\n}\nvoid CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId = vec4(0.0);\n #endif\n #if CC_RECEIVE_SHADOW\n In.shadowBiasAndProbeId.xy = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.xy += a_localShadowBiasAndProbeId.xy;\n #else\n In.shadowBiasAndProbeId.xy += cc_localShadowBias.xy;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n In.shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #if USE_INSTANCING\n In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n In.lightmapUV.z = a_lightingMapUVParam.w;\n #else\n In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n In.lightmapUV.z = cc_lightingMapUVParam.w;\n #endif\n#endif\n}\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n In.normal.xyz = SurfacesVertexModifyLocalNormal(In);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = SurfacesVertexModifyLocalTangent(In);\n #endif\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);\n In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;\n In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexTransferFog(In);\n CCSurfacesVertexTransferLightMapUV(In);\n CCSurfacesVertexTransferShadow(In);\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);\n #endif\n CCSurfacesVertexOutput(In);\n}",
  2257. "frag": "\nprecision highp float;\n#define CC_SURFACES_USE_TANGENT_SPACE 0\n#define CC_SURFACES_USE_VERTEX_COLOR 0\n#define CC_SURFACES_USE_SECOND_UV 0\n#define CC_SURFACES_USE_LIGHT_MAP 0\n#define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nlayout(location = 0) in highp vec3 v_worldPos;\nlayout(location = 1) in vec4 v_normal;\nlayout(location = 2) in vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 3) in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 4) in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n layout(location = 5) in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 6) in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 7) in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 8) in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n layout(location = 9) in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n layout(location = 10) in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n layout(location = 11) in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 12) in mediump vec4 v_sh_linear_const_r;\n layout(location = 13) in mediump vec4 v_sh_linear_const_g;\n layout(location = 14) in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(set = 2, binding = 1) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(set = 2, binding = 6) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nlayout(set = 0, binding = 5) uniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n layout(set = 0, binding = 7) uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 15) uniform samplerCube cc_reflectionProbeCubemap;\n layout(set = 2, binding = 16) uniform sampler2D cc_reflectionProbePlanarMap;\n layout(set = 2, binding = 17) uniform sampler2D cc_reflectionProbeDataMap;\n layout(set = 2, binding = 18) uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(set = 2, binding = 11) uniform sampler2D cc_lightingMap;\n#endif\nlayout(set = 1, binding = 1) uniform OutlineFrag {\n vec4 baseColor;\n};\n#if USE_BASE_COLOR_MAP\n layout(set = 1, binding = 2) uniform sampler2D baseColorMap;\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n vec4 color = vec4(cc_mainLitColor.rgb, 1.0);\n color.rgb = SRGBToLinear(baseColor.rgb);\n #if USE_BASE_COLOR_MAP\n vec4 texColor = texture(baseColorMap, FSInput_texcoord);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n color *= texColor;\n #endif\n return color;\n}\nlayout(location = 0) out vec4 fragColorX;\nvoid main () {\n vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n fragColorX = color;\n}"
  2258. },
  2259. "glsl3": {
  2260. "vert": "\nprecision highp float;\n#define CC_SURFACES_USE_TANGENT_SPACE 0\n#define CC_SURFACES_USE_VERTEX_COLOR 0\n#define CC_SURFACES_USE_SECOND_UV 0\n#define CC_SURFACES_USE_LIGHT_MAP 0\n#define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nout highp vec3 v_worldPos;\nout vec4 v_normal;\nout vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n out mediump vec4 v_sh_linear_const_r;\n out mediump vec4 v_sh_linear_const_g;\n out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n#endif\n layout(std140) uniform OutlineVert {\n vec4 outlineParams;\n};\n #define CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\n vec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n {\n float width = outlineParams.x * 0.001;\n vec3 localPos = In.position.xyz;\n #if USE_POSITION_SCALING\n vec3 dir = normalize(localPos);\n float flip = dot(dir, normalize(In.normal)) < 0.0 ? -1.0 : 1.0;\n localPos += flip * dir * width * 2.0;\n #else\n localPos += normalize(In.normal) * width;\n #endif\n return localPos;\n }\n #define CC_SURFACES_VERTEX_MODIFY_CLIP_POS\n vec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n {\n vec4 clipPos = In.clipPos;\n float scaleZ = cc_nearFar.z == 0.0 ? 0.5 : 1.0;\n clipPos.z -= outlineParams.y * 0.002 * scaleZ;\n return clipPos;\n }\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\nvec3 SurfacesVertexModifyLocalNormal(in SurfacesStandardVertexIntermediate In)\n{\n return In.normal.xyz;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec4 SurfacesVertexModifyLocalTangent(in SurfacesStandardVertexIntermediate In)\n {\n return In.tangent;\n }\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\nvec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)\n{\n vec3 worldNormal = In.worldNormal.xyz;\n #if CC_SURFACES_USE_TWO_SIDED\n worldNormal.xyz *= In.worldNormal.w;\n #endif\n return worldNormal;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);\n#endif\n}\nvoid CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId = vec4(0.0);\n #endif\n #if CC_RECEIVE_SHADOW\n In.shadowBiasAndProbeId.xy = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.xy += a_localShadowBiasAndProbeId.xy;\n #else\n In.shadowBiasAndProbeId.xy += cc_localShadowBias.xy;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n In.shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #if USE_INSTANCING\n In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n In.lightmapUV.z = a_lightingMapUVParam.w;\n #else\n In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n In.lightmapUV.z = cc_lightingMapUVParam.w;\n #endif\n#endif\n}\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n In.normal.xyz = SurfacesVertexModifyLocalNormal(In);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = SurfacesVertexModifyLocalTangent(In);\n #endif\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);\n In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;\n In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexTransferFog(In);\n CCSurfacesVertexTransferLightMapUV(In);\n CCSurfacesVertexTransferShadow(In);\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);\n #endif\n CCSurfacesVertexOutput(In);\n}",
  2261. "frag": "\nprecision highp float;\n#define CC_SURFACES_USE_TANGENT_SPACE 0\n#define CC_SURFACES_USE_VERTEX_COLOR 0\n#define CC_SURFACES_USE_SECOND_UV 0\n#define CC_SURFACES_USE_LIGHT_MAP 0\n#define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nin highp vec3 v_worldPos;\nin vec4 v_normal;\nin vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n in mediump vec4 v_sh_linear_const_r;\n in mediump vec4 v_sh_linear_const_g;\n in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(std140) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n#endif\nlayout(std140) uniform OutlineFrag {\n vec4 baseColor;\n};\n#if USE_BASE_COLOR_MAP\n uniform sampler2D baseColorMap;\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n vec4 color = vec4(cc_mainLitColor.rgb, 1.0);\n color.rgb = SRGBToLinear(baseColor.rgb);\n #if USE_BASE_COLOR_MAP\n vec4 texColor = texture(baseColorMap, FSInput_texcoord);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n color *= texColor;\n #endif\n return color;\n}\nlayout(location = 0) out vec4 fragColorX;\nvoid main () {\n vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n fragColorX = color;\n}"
  2262. },
  2263. "glsl1": {
  2264. "vert": "\nprecision highp float;\n#define CC_SURFACES_USE_TANGENT_SPACE 0\n#define CC_SURFACES_USE_VERTEX_COLOR 0\n#define CC_SURFACES_USE_SECOND_UV 0\n#define CC_SURFACES_USE_LIGHT_MAP 0\n#define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n attribute vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n attribute vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n uniform mediump vec4 cc_nearFar;\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_shadowLPNNInfo;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n uniform highp vec4 cc_lightingMapUVParam;\n uniform highp vec4 cc_localShadowBias;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n#endif\n uniform vec4 outlineParams;\n #define CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\n vec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n {\n float width = outlineParams.x * 0.001;\n vec3 localPos = In.position.xyz;\n #if USE_POSITION_SCALING\n vec3 dir = normalize(localPos);\n float flip = dot(dir, normalize(In.normal)) < 0.0 ? -1.0 : 1.0;\n localPos += flip * dir * width * 2.0;\n #else\n localPos += normalize(In.normal) * width;\n #endif\n return localPos;\n }\n #define CC_SURFACES_VERTEX_MODIFY_CLIP_POS\n vec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n {\n vec4 clipPos = In.clipPos;\n float scaleZ = cc_nearFar.z == 0.0 ? 0.5 : 1.0;\n clipPos.z -= outlineParams.y * 0.002 * scaleZ;\n return clipPos;\n }\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\nvec3 SurfacesVertexModifyLocalNormal(in SurfacesStandardVertexIntermediate In)\n{\n return In.normal.xyz;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec4 SurfacesVertexModifyLocalTangent(in SurfacesStandardVertexIntermediate In)\n {\n return In.tangent;\n }\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\nvec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)\n{\n vec3 worldNormal = In.worldNormal.xyz;\n #if CC_SURFACES_USE_TWO_SIDED\n worldNormal.xyz *= In.worldNormal.w;\n #endif\n return worldNormal;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);\n#endif\n}\nvoid CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId = vec4(0.0);\n #endif\n #if CC_RECEIVE_SHADOW\n In.shadowBiasAndProbeId.xy = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.xy += a_localShadowBiasAndProbeId.xy;\n #else\n In.shadowBiasAndProbeId.xy += cc_localShadowBias.xy;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n In.shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #if USE_INSTANCING\n In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n In.lightmapUV.z = a_lightingMapUVParam.w;\n #else\n In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n In.lightmapUV.z = cc_lightingMapUVParam.w;\n #endif\n#endif\n}\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n In.normal.xyz = SurfacesVertexModifyLocalNormal(In);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = SurfacesVertexModifyLocalTangent(In);\n #endif\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);\n In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;\n In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexTransferFog(In);\n CCSurfacesVertexTransferLightMapUV(In);\n CCSurfacesVertexTransferShadow(In);\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);\n #endif\n CCSurfacesVertexOutput(In);\n}",
  2265. "frag": "\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\n#define CC_SURFACES_USE_TANGENT_SPACE 0\n#define CC_SURFACES_USE_VERTEX_COLOR 0\n#define CC_SURFACES_USE_SECOND_UV 0\n#define CC_SURFACES_USE_LIGHT_MAP 0\n#define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nuniform mediump vec4 cc_debug_view_mode;\nuniform mediump vec4 cc_surfaceTransform;\n uniform mediump vec4 cc_mainLitColor;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n #endif\n#endif\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n #endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n #endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n#endif\n uniform vec4 baseColor;\n#if USE_BASE_COLOR_MAP\n uniform sampler2D baseColorMap;\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n vec4 color = vec4(cc_mainLitColor.rgb, 1.0);\n color.rgb = SRGBToLinear(baseColor.rgb);\n #if USE_BASE_COLOR_MAP\n vec4 texColor = texture2D(baseColorMap, FSInput_texcoord);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n color *= texColor;\n #endif\n return color;\n}\nvoid main () {\n vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n gl_FragColor = color;\n}"
  2266. },
  2267. "builtins": {
  2268. "globals": {
  2269. "blocks": [
  2270. {
  2271. "name": "CCGlobal",
  2272. "defines": []
  2273. },
  2274. {
  2275. "name": "CCCamera",
  2276. "defines": []
  2277. },
  2278. {
  2279. "name": "CCShadow",
  2280. "defines": []
  2281. },
  2282. {
  2283. "name": "CCCSM",
  2284. "defines": [
  2285. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  2286. ]
  2287. }
  2288. ],
  2289. "samplerTextures": [
  2290. {
  2291. "name": "cc_environment",
  2292. "defines": []
  2293. },
  2294. {
  2295. "name": "cc_diffuseMap",
  2296. "defines": [
  2297. "CC_USE_IBL",
  2298. "CC_USE_DIFFUSEMAP"
  2299. ]
  2300. },
  2301. {
  2302. "name": "cc_shadowMap",
  2303. "defines": [
  2304. "CC_RECEIVE_SHADOW"
  2305. ]
  2306. },
  2307. {
  2308. "name": "cc_spotShadowMap",
  2309. "defines": [
  2310. "CC_RECEIVE_SHADOW"
  2311. ]
  2312. }
  2313. ],
  2314. "buffers": [],
  2315. "images": []
  2316. },
  2317. "locals": {
  2318. "blocks": [
  2319. {
  2320. "name": "CCLocal",
  2321. "defines": [
  2322. "!USE_INSTANCING"
  2323. ]
  2324. },
  2325. {
  2326. "name": "CCMorph",
  2327. "defines": [
  2328. "CC_USE_MORPH"
  2329. ]
  2330. },
  2331. {
  2332. "name": "CCSkinningTexture",
  2333. "defines": [
  2334. "CC_USE_SKINNING",
  2335. "CC_USE_BAKED_ANIMATION"
  2336. ]
  2337. },
  2338. {
  2339. "name": "CCSkinningAnimation",
  2340. "defines": [
  2341. "CC_USE_SKINNING",
  2342. "CC_USE_BAKED_ANIMATION"
  2343. ]
  2344. },
  2345. {
  2346. "name": "CCSkinning",
  2347. "defines": [
  2348. "CC_USE_SKINNING",
  2349. "!CC_USE_BAKED_ANIMATION",
  2350. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  2351. ]
  2352. },
  2353. {
  2354. "name": "CCForwardLight",
  2355. "defines": [
  2356. "CC_FORWARD_ADD",
  2357. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  2358. ]
  2359. },
  2360. {
  2361. "name": "CCSH",
  2362. "defines": [
  2363. "CC_USE_LIGHT_PROBE",
  2364. "!USE_INSTANCING"
  2365. ]
  2366. }
  2367. ],
  2368. "samplerTextures": [
  2369. {
  2370. "name": "cc_PositionDisplacements",
  2371. "defines": [
  2372. "CC_USE_MORPH",
  2373. "CC_MORPH_TARGET_HAS_POSITION"
  2374. ]
  2375. },
  2376. {
  2377. "name": "cc_NormalDisplacements",
  2378. "defines": [
  2379. "CC_USE_MORPH",
  2380. "CC_MORPH_TARGET_HAS_NORMAL"
  2381. ]
  2382. },
  2383. {
  2384. "name": "cc_TangentDisplacements",
  2385. "defines": [
  2386. "CC_USE_MORPH",
  2387. "CC_MORPH_TARGET_HAS_TANGENT"
  2388. ]
  2389. },
  2390. {
  2391. "name": "cc_jointTexture",
  2392. "defines": [
  2393. "CC_USE_SKINNING",
  2394. "CC_USE_BAKED_ANIMATION"
  2395. ]
  2396. },
  2397. {
  2398. "name": "cc_realtimeJoint",
  2399. "defines": [
  2400. "CC_USE_SKINNING",
  2401. "!CC_USE_BAKED_ANIMATION",
  2402. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  2403. ]
  2404. },
  2405. {
  2406. "name": "cc_reflectionProbeCubemap",
  2407. "defines": [
  2408. "CC_USE_REFLECTION_PROBE"
  2409. ]
  2410. },
  2411. {
  2412. "name": "cc_reflectionProbePlanarMap",
  2413. "defines": [
  2414. "CC_USE_REFLECTION_PROBE"
  2415. ]
  2416. },
  2417. {
  2418. "name": "cc_reflectionProbeDataMap",
  2419. "defines": [
  2420. "CC_USE_REFLECTION_PROBE"
  2421. ]
  2422. },
  2423. {
  2424. "name": "cc_reflectionProbeBlendCubemap",
  2425. "defines": [
  2426. "CC_USE_REFLECTION_PROBE"
  2427. ]
  2428. },
  2429. {
  2430. "name": "cc_lightingMap",
  2431. "defines": [
  2432. "CC_USE_LIGHTMAP",
  2433. "!CC_FORWARD_ADD"
  2434. ]
  2435. }
  2436. ],
  2437. "buffers": [],
  2438. "images": []
  2439. },
  2440. "statistics": {
  2441. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 91,
  2442. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 121
  2443. }
  2444. },
  2445. "defines": [
  2446. {
  2447. "name": "USE_INSTANCING",
  2448. "type": "boolean",
  2449. "defines": [],
  2450. "editor": {
  2451. "elevated": true
  2452. }
  2453. },
  2454. {
  2455. "name": "CC_USE_LIGHTMAP",
  2456. "type": "boolean",
  2457. "defines": []
  2458. },
  2459. {
  2460. "name": "CC_USE_SKINNING",
  2461. "type": "boolean",
  2462. "defines": []
  2463. },
  2464. {
  2465. "name": "CC_USE_BAKED_ANIMATION",
  2466. "type": "boolean",
  2467. "defines": [
  2468. "USE_INSTANCING"
  2469. ]
  2470. },
  2471. {
  2472. "name": "CC_RECEIVE_SHADOW",
  2473. "type": "boolean",
  2474. "defines": []
  2475. },
  2476. {
  2477. "name": "CC_USE_REFLECTION_PROBE",
  2478. "type": "number",
  2479. "defines": [],
  2480. "range": [
  2481. 0,
  2482. 3
  2483. ]
  2484. },
  2485. {
  2486. "name": "CC_USE_LIGHT_PROBE",
  2487. "type": "boolean",
  2488. "defines": [],
  2489. "default": 0
  2490. },
  2491. {
  2492. "name": "CC_USE_MORPH",
  2493. "type": "boolean",
  2494. "defines": []
  2495. },
  2496. {
  2497. "name": "CC_FORWARD_ADD",
  2498. "type": "boolean",
  2499. "defines": []
  2500. },
  2501. {
  2502. "name": "CC_USE_FOG",
  2503. "type": "number",
  2504. "defines": [],
  2505. "range": [
  2506. 0,
  2507. 4
  2508. ]
  2509. },
  2510. {
  2511. "name": "CC_USE_ACCURATE_FOG",
  2512. "type": "boolean",
  2513. "defines": [
  2514. "CC_USE_FOG"
  2515. ]
  2516. },
  2517. {
  2518. "name": "CC_MORPH_TARGET_COUNT",
  2519. "type": "number",
  2520. "defines": [
  2521. "CC_USE_MORPH"
  2522. ],
  2523. "range": [
  2524. 2,
  2525. 8
  2526. ]
  2527. },
  2528. {
  2529. "name": "CC_MORPH_TARGET_HAS_POSITION",
  2530. "type": "boolean",
  2531. "defines": [
  2532. "CC_USE_MORPH"
  2533. ]
  2534. },
  2535. {
  2536. "name": "CC_MORPH_TARGET_HAS_NORMAL",
  2537. "type": "boolean",
  2538. "defines": [
  2539. "CC_USE_MORPH"
  2540. ]
  2541. },
  2542. {
  2543. "name": "CC_MORPH_TARGET_HAS_TANGENT",
  2544. "type": "boolean",
  2545. "defines": [
  2546. "CC_USE_MORPH"
  2547. ]
  2548. },
  2549. {
  2550. "name": "CC_MORPH_PRECOMPUTED",
  2551. "type": "boolean",
  2552. "defines": [
  2553. "CC_USE_MORPH"
  2554. ]
  2555. },
  2556. {
  2557. "name": "CC_USE_REAL_TIME_JOINT_TEXTURE",
  2558. "type": "boolean",
  2559. "defines": [
  2560. "CC_USE_SKINNING",
  2561. "!CC_USE_BAKED_ANIMATION"
  2562. ]
  2563. },
  2564. {
  2565. "name": "USE_POSITION_SCALING",
  2566. "type": "boolean",
  2567. "defines": []
  2568. },
  2569. {
  2570. "name": "CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER",
  2571. "type": "number",
  2572. "defines": [],
  2573. "range": [
  2574. 0,
  2575. 1
  2576. ]
  2577. },
  2578. {
  2579. "name": "CC_PIPELINE_TYPE",
  2580. "type": "number",
  2581. "defines": [],
  2582. "range": [
  2583. 0,
  2584. 1
  2585. ]
  2586. },
  2587. {
  2588. "name": "CC_FORCE_FORWARD_SHADING",
  2589. "type": "boolean",
  2590. "defines": [
  2591. "CC_PIPELINE_TYPE"
  2592. ]
  2593. },
  2594. {
  2595. "name": "CC_ENABLE_CLUSTERED_LIGHT_CULLING",
  2596. "type": "number",
  2597. "defines": [
  2598. "CC_FORWARD_ADD"
  2599. ],
  2600. "range": [
  2601. 0,
  2602. 3
  2603. ]
  2604. },
  2605. {
  2606. "name": "CC_SUPPORT_CASCADED_SHADOW_MAP",
  2607. "type": "boolean",
  2608. "defines": []
  2609. },
  2610. {
  2611. "name": "CC_USE_IBL",
  2612. "type": "number",
  2613. "defines": [],
  2614. "range": [
  2615. 0,
  2616. 2
  2617. ]
  2618. },
  2619. {
  2620. "name": "CC_USE_DIFFUSEMAP",
  2621. "type": "number",
  2622. "defines": [
  2623. "CC_USE_IBL"
  2624. ],
  2625. "range": [
  2626. 0,
  2627. 2
  2628. ]
  2629. },
  2630. {
  2631. "name": "CC_USE_DEBUG_VIEW",
  2632. "type": "number",
  2633. "defines": [],
  2634. "range": [
  2635. 0,
  2636. 3
  2637. ]
  2638. },
  2639. {
  2640. "name": "USE_BASE_COLOR_MAP",
  2641. "type": "boolean",
  2642. "defines": []
  2643. },
  2644. {
  2645. "name": "CC_USE_RGBE_OUTPUT",
  2646. "type": "boolean",
  2647. "defines": []
  2648. },
  2649. {
  2650. "name": "CC_USE_FLOAT_OUTPUT",
  2651. "type": "boolean",
  2652. "defines": [
  2653. "!CC_USE_RGBE_OUTPUT"
  2654. ]
  2655. }
  2656. ],
  2657. "name": "builtin-toon|silhouette-edge-vs|silhouette-edge-fs"
  2658. },
  2659. {
  2660. "blocks": [
  2661. {
  2662. "name": "Constants",
  2663. "members": [
  2664. {
  2665. "name": "tilingOffset",
  2666. "type": 16,
  2667. "count": 1
  2668. },
  2669. {
  2670. "name": "baseColor",
  2671. "type": 16,
  2672. "count": 1
  2673. },
  2674. {
  2675. "name": "colorScaleAndCutoff",
  2676. "type": 16,
  2677. "count": 1
  2678. },
  2679. {
  2680. "name": "shadeColor1",
  2681. "type": 16,
  2682. "count": 1
  2683. },
  2684. {
  2685. "name": "shadeColor2",
  2686. "type": 16,
  2687. "count": 1
  2688. },
  2689. {
  2690. "name": "specular",
  2691. "type": 16,
  2692. "count": 1
  2693. },
  2694. {
  2695. "name": "shadeParams",
  2696. "type": 16,
  2697. "count": 1
  2698. },
  2699. {
  2700. "name": "miscParams",
  2701. "type": 16,
  2702. "count": 1
  2703. },
  2704. {
  2705. "name": "emissive",
  2706. "type": 16,
  2707. "count": 1
  2708. },
  2709. {
  2710. "name": "emissiveScaleAndStrenth",
  2711. "type": 16,
  2712. "count": 1
  2713. }
  2714. ],
  2715. "defines": [],
  2716. "stageFlags": 17,
  2717. "binding": 0
  2718. }
  2719. ],
  2720. "samplerTextures": [
  2721. {
  2722. "name": "baseColorMap",
  2723. "type": 28,
  2724. "count": 1,
  2725. "defines": [
  2726. "USE_BASE_COLOR_MAP"
  2727. ],
  2728. "stageFlags": 16,
  2729. "binding": 1
  2730. },
  2731. {
  2732. "name": "normalMap",
  2733. "type": 28,
  2734. "count": 1,
  2735. "defines": [
  2736. "USE_NORMAL_MAP"
  2737. ],
  2738. "stageFlags": 16,
  2739. "binding": 2
  2740. },
  2741. {
  2742. "name": "shadeMap1",
  2743. "type": 28,
  2744. "count": 1,
  2745. "defines": [
  2746. "USE_1ST_SHADE_MAP"
  2747. ],
  2748. "stageFlags": 16,
  2749. "binding": 3
  2750. },
  2751. {
  2752. "name": "shadeMap2",
  2753. "type": 28,
  2754. "count": 1,
  2755. "defines": [
  2756. "USE_2ND_SHADE_MAP"
  2757. ],
  2758. "stageFlags": 16,
  2759. "binding": 4
  2760. },
  2761. {
  2762. "name": "specularMap",
  2763. "type": 28,
  2764. "count": 1,
  2765. "defines": [
  2766. "USE_SPECULAR_MAP"
  2767. ],
  2768. "stageFlags": 16,
  2769. "binding": 5
  2770. },
  2771. {
  2772. "name": "emissiveMap",
  2773. "type": 28,
  2774. "count": 1,
  2775. "defines": [
  2776. "USE_EMISSIVE_MAP"
  2777. ],
  2778. "stageFlags": 16,
  2779. "binding": 6
  2780. }
  2781. ],
  2782. "samplers": [],
  2783. "textures": [],
  2784. "buffers": [],
  2785. "images": [],
  2786. "subpassInputs": [],
  2787. "attributes": [
  2788. {
  2789. "name": "a_position",
  2790. "defines": [],
  2791. "format": 32,
  2792. "location": 0
  2793. },
  2794. {
  2795. "name": "a_normal",
  2796. "defines": [],
  2797. "format": 32,
  2798. "location": 1
  2799. },
  2800. {
  2801. "name": "a_texCoord",
  2802. "defines": [],
  2803. "format": 21,
  2804. "location": 2
  2805. },
  2806. {
  2807. "name": "a_tangent",
  2808. "defines": [
  2809. "USE_NORMAL_MAP"
  2810. ],
  2811. "format": 44,
  2812. "location": 3
  2813. },
  2814. {
  2815. "name": "a_color",
  2816. "defines": [],
  2817. "format": 44,
  2818. "location": 6
  2819. },
  2820. {
  2821. "name": "a_texCoord1",
  2822. "defines": [],
  2823. "format": 21,
  2824. "location": 7
  2825. },
  2826. {
  2827. "name": "a_joints",
  2828. "defines": [
  2829. "CC_USE_SKINNING"
  2830. ],
  2831. "location": 4
  2832. },
  2833. {
  2834. "name": "a_weights",
  2835. "defines": [
  2836. "CC_USE_SKINNING"
  2837. ],
  2838. "format": 44,
  2839. "location": 5
  2840. },
  2841. {
  2842. "name": "a_jointAnimInfo",
  2843. "defines": [
  2844. "USE_INSTANCING",
  2845. "CC_USE_BAKED_ANIMATION"
  2846. ],
  2847. "format": 44,
  2848. "isInstanced": true,
  2849. "location": 8
  2850. },
  2851. {
  2852. "name": "a_matWorld0",
  2853. "defines": [
  2854. "USE_INSTANCING"
  2855. ],
  2856. "format": 44,
  2857. "isInstanced": true,
  2858. "location": 9
  2859. },
  2860. {
  2861. "name": "a_matWorld1",
  2862. "defines": [
  2863. "USE_INSTANCING"
  2864. ],
  2865. "format": 44,
  2866. "isInstanced": true,
  2867. "location": 10
  2868. },
  2869. {
  2870. "name": "a_matWorld2",
  2871. "defines": [
  2872. "USE_INSTANCING"
  2873. ],
  2874. "format": 44,
  2875. "isInstanced": true,
  2876. "location": 11
  2877. },
  2878. {
  2879. "name": "a_lightingMapUVParam",
  2880. "defines": [
  2881. "USE_INSTANCING",
  2882. "CC_USE_LIGHTMAP"
  2883. ],
  2884. "format": 44,
  2885. "isInstanced": true,
  2886. "location": 12
  2887. },
  2888. {
  2889. "name": "a_localShadowBiasAndProbeId",
  2890. "defines": [
  2891. "USE_INSTANCING"
  2892. ],
  2893. "format": 44,
  2894. "isInstanced": true,
  2895. "location": 13
  2896. },
  2897. {
  2898. "name": "a_reflectionProbeData",
  2899. "defines": [
  2900. "USE_INSTANCING",
  2901. "CC_USE_REFLECTION_PROBE"
  2902. ],
  2903. "format": 44,
  2904. "isInstanced": true,
  2905. "location": 14
  2906. },
  2907. {
  2908. "name": "a_sh_linear_const_r",
  2909. "defines": [
  2910. "USE_INSTANCING",
  2911. "CC_USE_LIGHT_PROBE"
  2912. ],
  2913. "format": 44,
  2914. "isInstanced": true,
  2915. "location": 15
  2916. },
  2917. {
  2918. "name": "a_sh_linear_const_g",
  2919. "defines": [
  2920. "USE_INSTANCING",
  2921. "CC_USE_LIGHT_PROBE"
  2922. ],
  2923. "format": 44,
  2924. "isInstanced": true,
  2925. "location": 16
  2926. },
  2927. {
  2928. "name": "a_sh_linear_const_b",
  2929. "defines": [
  2930. "USE_INSTANCING",
  2931. "CC_USE_LIGHT_PROBE"
  2932. ],
  2933. "format": 44,
  2934. "isInstanced": true,
  2935. "location": 17
  2936. },
  2937. {
  2938. "name": "a_vertexId",
  2939. "defines": [
  2940. "CC_USE_MORPH"
  2941. ],
  2942. "format": 11,
  2943. "location": 18
  2944. }
  2945. ],
  2946. "varyings": [
  2947. {
  2948. "name": "v_worldPos",
  2949. "type": 15,
  2950. "count": 1,
  2951. "defines": [],
  2952. "stageFlags": 17,
  2953. "location": 0
  2954. },
  2955. {
  2956. "name": "v_normal",
  2957. "type": 16,
  2958. "count": 1,
  2959. "defines": [],
  2960. "stageFlags": 17,
  2961. "location": 1
  2962. },
  2963. {
  2964. "name": "v_uv",
  2965. "type": 14,
  2966. "count": 1,
  2967. "defines": [],
  2968. "stageFlags": 17,
  2969. "location": 2
  2970. },
  2971. {
  2972. "name": "v_color",
  2973. "type": 16,
  2974. "count": 1,
  2975. "defines": [],
  2976. "stageFlags": 17,
  2977. "location": 3
  2978. },
  2979. {
  2980. "name": "v_tangent",
  2981. "type": 16,
  2982. "count": 1,
  2983. "defines": [],
  2984. "stageFlags": 17,
  2985. "location": 4
  2986. },
  2987. {
  2988. "name": "v_uv1",
  2989. "type": 14,
  2990. "count": 1,
  2991. "defines": [],
  2992. "stageFlags": 17,
  2993. "location": 5
  2994. },
  2995. {
  2996. "name": "v_luv",
  2997. "type": 15,
  2998. "count": 1,
  2999. "defines": [
  3000. "CC_USE_LIGHTMAP",
  3001. "!CC_FORWARD_ADD"
  3002. ],
  3003. "stageFlags": 17,
  3004. "location": 6
  3005. },
  3006. {
  3007. "name": "v_shadowBiasAndProbeId",
  3008. "type": 16,
  3009. "count": 1,
  3010. "defines": [],
  3011. "stageFlags": 17,
  3012. "location": 7
  3013. },
  3014. {
  3015. "name": "v_reflectionProbeData",
  3016. "type": 16,
  3017. "count": 1,
  3018. "defines": [
  3019. "CC_USE_REFLECTION_PROBE",
  3020. "USE_INSTANCING"
  3021. ],
  3022. "stageFlags": 17,
  3023. "location": 8
  3024. },
  3025. {
  3026. "name": "v_fogFactor",
  3027. "type": 13,
  3028. "count": 1,
  3029. "defines": [
  3030. "CC_USE_FOG",
  3031. "!CC_USE_ACCURATE_FOG"
  3032. ],
  3033. "stageFlags": 17,
  3034. "location": 9
  3035. },
  3036. {
  3037. "name": "v_localPos",
  3038. "type": 16,
  3039. "count": 1,
  3040. "defines": [],
  3041. "stageFlags": 17,
  3042. "location": 10
  3043. },
  3044. {
  3045. "name": "v_clipPos",
  3046. "type": 16,
  3047. "count": 1,
  3048. "defines": [],
  3049. "stageFlags": 17,
  3050. "location": 11
  3051. },
  3052. {
  3053. "name": "v_sh_linear_const_r",
  3054. "type": 16,
  3055. "count": 1,
  3056. "defines": [
  3057. "CC_USE_LIGHT_PROBE",
  3058. "USE_INSTANCING"
  3059. ],
  3060. "stageFlags": 17,
  3061. "location": 12
  3062. },
  3063. {
  3064. "name": "v_sh_linear_const_g",
  3065. "type": 16,
  3066. "count": 1,
  3067. "defines": [
  3068. "CC_USE_LIGHT_PROBE",
  3069. "USE_INSTANCING"
  3070. ],
  3071. "stageFlags": 17,
  3072. "location": 13
  3073. },
  3074. {
  3075. "name": "v_sh_linear_const_b",
  3076. "type": 16,
  3077. "count": 1,
  3078. "defines": [
  3079. "CC_USE_LIGHT_PROBE",
  3080. "USE_INSTANCING"
  3081. ],
  3082. "stageFlags": 17,
  3083. "location": 14
  3084. }
  3085. ],
  3086. "fragColors": [
  3087. {
  3088. "tags": [],
  3089. "name": "fragColorX",
  3090. "typename": "vec4",
  3091. "type": 16,
  3092. "count": 1,
  3093. "defines": [],
  3094. "stageFlags": 16,
  3095. "location": 0
  3096. },
  3097. {
  3098. "tags": [
  3099. "CC_PIPELINE_TYPE"
  3100. ],
  3101. "name": "albedoOut",
  3102. "typename": "vec4",
  3103. "type": 16,
  3104. "count": 1,
  3105. "defines": [
  3106. "CC_PIPELINE_TYPE"
  3107. ],
  3108. "stageFlags": 16,
  3109. "location": 1
  3110. },
  3111. {
  3112. "name": "emissiveOut",
  3113. "typename": "vec4",
  3114. "type": 16,
  3115. "count": 1,
  3116. "defines": [
  3117. "CC_PIPELINE_TYPE"
  3118. ],
  3119. "stageFlags": 16,
  3120. "location": 2
  3121. },
  3122. {
  3123. "name": "normalOut",
  3124. "typename": "vec4",
  3125. "type": 16,
  3126. "count": 1,
  3127. "defines": [
  3128. "CC_PIPELINE_TYPE"
  3129. ],
  3130. "stageFlags": 16,
  3131. "location": 3
  3132. }
  3133. ],
  3134. "descriptors": [
  3135. {
  3136. "rate": 0,
  3137. "blocks": [
  3138. {
  3139. "tags": {
  3140. "builtin": "local"
  3141. },
  3142. "name": "CCLocal",
  3143. "members": [
  3144. {
  3145. "name": "cc_matWorld",
  3146. "typename": "mat4",
  3147. "type": 25,
  3148. "count": 1,
  3149. "precision": "highp "
  3150. },
  3151. {
  3152. "name": "cc_matWorldIT",
  3153. "typename": "mat4",
  3154. "type": 25,
  3155. "count": 1,
  3156. "precision": "highp "
  3157. },
  3158. {
  3159. "name": "cc_lightingMapUVParam",
  3160. "typename": "vec4",
  3161. "type": 16,
  3162. "count": 1,
  3163. "precision": "highp "
  3164. },
  3165. {
  3166. "name": "cc_localShadowBias",
  3167. "typename": "vec4",
  3168. "type": 16,
  3169. "count": 1,
  3170. "precision": "highp "
  3171. },
  3172. {
  3173. "name": "cc_reflectionProbeData1",
  3174. "typename": "vec4",
  3175. "type": 16,
  3176. "count": 1,
  3177. "precision": "highp "
  3178. },
  3179. {
  3180. "name": "cc_reflectionProbeData2",
  3181. "typename": "vec4",
  3182. "type": 16,
  3183. "count": 1,
  3184. "precision": "highp "
  3185. },
  3186. {
  3187. "name": "cc_reflectionProbeBlendData1",
  3188. "typename": "vec4",
  3189. "type": 16,
  3190. "count": 1,
  3191. "precision": "highp "
  3192. },
  3193. {
  3194. "name": "cc_reflectionProbeBlendData2",
  3195. "typename": "vec4",
  3196. "type": 16,
  3197. "count": 1,
  3198. "precision": "highp "
  3199. }
  3200. ],
  3201. "defines": [
  3202. "!USE_INSTANCING"
  3203. ],
  3204. "stageFlags": 17
  3205. },
  3206. {
  3207. "tags": {
  3208. "builtin": "local"
  3209. },
  3210. "name": "CCMorph",
  3211. "members": [
  3212. {
  3213. "name": "cc_displacementWeights",
  3214. "typename": "vec4",
  3215. "type": 16,
  3216. "count": 15,
  3217. "isArray": true
  3218. },
  3219. {
  3220. "name": "cc_displacementTextureInfo",
  3221. "typename": "vec4",
  3222. "type": 16,
  3223. "count": 1
  3224. }
  3225. ],
  3226. "defines": [
  3227. "CC_USE_MORPH"
  3228. ],
  3229. "stageFlags": 1
  3230. },
  3231. {
  3232. "tags": {
  3233. "builtin": "local"
  3234. },
  3235. "name": "CCSkinningTexture",
  3236. "members": [
  3237. {
  3238. "name": "cc_jointTextureInfo",
  3239. "typename": "vec4",
  3240. "type": 16,
  3241. "count": 1,
  3242. "precision": "highp "
  3243. }
  3244. ],
  3245. "defines": [
  3246. "CC_USE_SKINNING",
  3247. "CC_USE_BAKED_ANIMATION"
  3248. ],
  3249. "stageFlags": 1
  3250. },
  3251. {
  3252. "tags": {
  3253. "builtin": "local"
  3254. },
  3255. "name": "CCSkinningAnimation",
  3256. "members": [
  3257. {
  3258. "name": "cc_jointAnimInfo",
  3259. "typename": "vec4",
  3260. "type": 16,
  3261. "count": 1,
  3262. "precision": "highp "
  3263. }
  3264. ],
  3265. "defines": [
  3266. "CC_USE_SKINNING",
  3267. "CC_USE_BAKED_ANIMATION"
  3268. ],
  3269. "stageFlags": 1
  3270. },
  3271. {
  3272. "tags": {
  3273. "builtin": "local"
  3274. },
  3275. "name": "CCSkinning",
  3276. "members": [
  3277. {
  3278. "name": "cc_joints",
  3279. "typename": "vec4",
  3280. "type": 16,
  3281. "count": 0,
  3282. "precision": "highp ",
  3283. "isArray": true
  3284. }
  3285. ],
  3286. "defines": [
  3287. "CC_USE_SKINNING",
  3288. "!CC_USE_BAKED_ANIMATION",
  3289. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  3290. ],
  3291. "stageFlags": 1
  3292. },
  3293. {
  3294. "tags": {
  3295. "builtin": "local"
  3296. },
  3297. "name": "CCForwardLight",
  3298. "members": [
  3299. {
  3300. "name": "cc_lightPos",
  3301. "typename": "vec4",
  3302. "type": 16,
  3303. "count": 0,
  3304. "precision": "highp ",
  3305. "isArray": true
  3306. },
  3307. {
  3308. "name": "cc_lightColor",
  3309. "typename": "vec4",
  3310. "type": 16,
  3311. "count": 0,
  3312. "isArray": true
  3313. },
  3314. {
  3315. "name": "cc_lightSizeRangeAngle",
  3316. "typename": "vec4",
  3317. "type": 16,
  3318. "count": 0,
  3319. "isArray": true
  3320. },
  3321. {
  3322. "name": "cc_lightDir",
  3323. "typename": "vec4",
  3324. "type": 16,
  3325. "count": 0,
  3326. "isArray": true
  3327. },
  3328. {
  3329. "name": "cc_lightBoundingSizeVS",
  3330. "typename": "vec4",
  3331. "type": 16,
  3332. "count": 0,
  3333. "isArray": true
  3334. }
  3335. ],
  3336. "defines": [
  3337. "CC_FORWARD_ADD",
  3338. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  3339. ],
  3340. "stageFlags": 16
  3341. },
  3342. {
  3343. "tags": {
  3344. "builtin": "local"
  3345. },
  3346. "name": "CCSH",
  3347. "members": [
  3348. {
  3349. "name": "cc_sh_linear_const_r",
  3350. "typename": "vec4",
  3351. "type": 16,
  3352. "count": 1
  3353. },
  3354. {
  3355. "name": "cc_sh_linear_const_g",
  3356. "typename": "vec4",
  3357. "type": 16,
  3358. "count": 1
  3359. },
  3360. {
  3361. "name": "cc_sh_linear_const_b",
  3362. "typename": "vec4",
  3363. "type": 16,
  3364. "count": 1
  3365. },
  3366. {
  3367. "name": "cc_sh_quadratic_r",
  3368. "typename": "vec4",
  3369. "type": 16,
  3370. "count": 1
  3371. },
  3372. {
  3373. "name": "cc_sh_quadratic_g",
  3374. "typename": "vec4",
  3375. "type": 16,
  3376. "count": 1
  3377. },
  3378. {
  3379. "name": "cc_sh_quadratic_b",
  3380. "typename": "vec4",
  3381. "type": 16,
  3382. "count": 1
  3383. },
  3384. {
  3385. "name": "cc_sh_quadratic_a",
  3386. "typename": "vec4",
  3387. "type": 16,
  3388. "count": 1
  3389. }
  3390. ],
  3391. "defines": [
  3392. "CC_USE_LIGHT_PROBE",
  3393. "!USE_INSTANCING"
  3394. ],
  3395. "stageFlags": 16
  3396. }
  3397. ],
  3398. "samplerTextures": [
  3399. {
  3400. "tags": {
  3401. "builtin": "local"
  3402. },
  3403. "name": "cc_PositionDisplacements",
  3404. "typename": "sampler2D",
  3405. "type": 28,
  3406. "count": 1,
  3407. "defines": [
  3408. "CC_USE_MORPH",
  3409. "CC_MORPH_TARGET_HAS_POSITION"
  3410. ],
  3411. "stageFlags": 1
  3412. },
  3413. {
  3414. "tags": {
  3415. "builtin": "local"
  3416. },
  3417. "name": "cc_NormalDisplacements",
  3418. "typename": "sampler2D",
  3419. "type": 28,
  3420. "count": 1,
  3421. "defines": [
  3422. "CC_USE_MORPH",
  3423. "CC_MORPH_TARGET_HAS_NORMAL"
  3424. ],
  3425. "stageFlags": 1
  3426. },
  3427. {
  3428. "tags": {
  3429. "builtin": "local"
  3430. },
  3431. "name": "cc_TangentDisplacements",
  3432. "typename": "sampler2D",
  3433. "type": 28,
  3434. "count": 1,
  3435. "defines": [
  3436. "CC_USE_MORPH",
  3437. "CC_MORPH_TARGET_HAS_TANGENT"
  3438. ],
  3439. "stageFlags": 1
  3440. },
  3441. {
  3442. "tags": {
  3443. "builtin": "local"
  3444. },
  3445. "name": "cc_jointTexture",
  3446. "typename": "sampler2D",
  3447. "type": 28,
  3448. "count": 1,
  3449. "precision": "highp ",
  3450. "defines": [
  3451. "CC_USE_SKINNING",
  3452. "CC_USE_BAKED_ANIMATION"
  3453. ],
  3454. "stageFlags": 1
  3455. },
  3456. {
  3457. "tags": {
  3458. "builtin": "local"
  3459. },
  3460. "name": "cc_realtimeJoint",
  3461. "typename": "sampler2D",
  3462. "type": 28,
  3463. "count": 1,
  3464. "precision": "highp ",
  3465. "defines": [
  3466. "CC_USE_SKINNING",
  3467. "!CC_USE_BAKED_ANIMATION",
  3468. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  3469. ],
  3470. "stageFlags": 1
  3471. },
  3472. {
  3473. "tags": {
  3474. "builtin": "local"
  3475. },
  3476. "name": "cc_reflectionProbeCubemap",
  3477. "typename": "samplerCube",
  3478. "type": 31,
  3479. "count": 1,
  3480. "defines": [
  3481. "CC_USE_REFLECTION_PROBE"
  3482. ],
  3483. "stageFlags": 16
  3484. },
  3485. {
  3486. "tags": {
  3487. "builtin": "local"
  3488. },
  3489. "name": "cc_reflectionProbePlanarMap",
  3490. "typename": "sampler2D",
  3491. "type": 28,
  3492. "count": 1,
  3493. "defines": [
  3494. "CC_USE_REFLECTION_PROBE"
  3495. ],
  3496. "stageFlags": 16
  3497. },
  3498. {
  3499. "tags": {
  3500. "builtin": "local"
  3501. },
  3502. "name": "cc_reflectionProbeDataMap",
  3503. "typename": "sampler2D",
  3504. "type": 28,
  3505. "count": 1,
  3506. "defines": [
  3507. "CC_USE_REFLECTION_PROBE"
  3508. ],
  3509. "stageFlags": 16
  3510. },
  3511. {
  3512. "tags": {
  3513. "builtin": "local"
  3514. },
  3515. "name": "cc_reflectionProbeBlendCubemap",
  3516. "typename": "samplerCube",
  3517. "type": 31,
  3518. "count": 1,
  3519. "defines": [
  3520. "CC_USE_REFLECTION_PROBE"
  3521. ],
  3522. "stageFlags": 16
  3523. },
  3524. {
  3525. "tags": {
  3526. "builtin": "local"
  3527. },
  3528. "name": "cc_lightingMap",
  3529. "typename": "sampler2D",
  3530. "type": 28,
  3531. "count": 1,
  3532. "defines": [
  3533. "CC_USE_LIGHTMAP",
  3534. "!CC_FORWARD_ADD"
  3535. ],
  3536. "stageFlags": 16
  3537. }
  3538. ],
  3539. "samplers": [],
  3540. "textures": [],
  3541. "buffers": [],
  3542. "images": [],
  3543. "subpassInputs": []
  3544. },
  3545. {
  3546. "rate": 1,
  3547. "blocks": [
  3548. {
  3549. "name": "Constants",
  3550. "members": [
  3551. {
  3552. "name": "tilingOffset",
  3553. "type": 16,
  3554. "count": 1
  3555. },
  3556. {
  3557. "name": "baseColor",
  3558. "type": 16,
  3559. "count": 1
  3560. },
  3561. {
  3562. "name": "colorScaleAndCutoff",
  3563. "type": 16,
  3564. "count": 1
  3565. },
  3566. {
  3567. "name": "shadeColor1",
  3568. "type": 16,
  3569. "count": 1
  3570. },
  3571. {
  3572. "name": "shadeColor2",
  3573. "type": 16,
  3574. "count": 1
  3575. },
  3576. {
  3577. "name": "specular",
  3578. "type": 16,
  3579. "count": 1
  3580. },
  3581. {
  3582. "name": "shadeParams",
  3583. "type": 16,
  3584. "count": 1
  3585. },
  3586. {
  3587. "name": "miscParams",
  3588. "type": 16,
  3589. "count": 1
  3590. },
  3591. {
  3592. "name": "emissive",
  3593. "type": 16,
  3594. "count": 1
  3595. },
  3596. {
  3597. "name": "emissiveScaleAndStrenth",
  3598. "type": 16,
  3599. "count": 1
  3600. }
  3601. ],
  3602. "defines": [],
  3603. "stageFlags": 17,
  3604. "binding": 0
  3605. }
  3606. ],
  3607. "samplerTextures": [
  3608. {
  3609. "name": "baseColorMap",
  3610. "type": 28,
  3611. "count": 1,
  3612. "defines": [
  3613. "USE_BASE_COLOR_MAP"
  3614. ],
  3615. "stageFlags": 16,
  3616. "binding": 1
  3617. },
  3618. {
  3619. "name": "normalMap",
  3620. "type": 28,
  3621. "count": 1,
  3622. "defines": [
  3623. "USE_NORMAL_MAP"
  3624. ],
  3625. "stageFlags": 16,
  3626. "binding": 2
  3627. },
  3628. {
  3629. "name": "shadeMap1",
  3630. "type": 28,
  3631. "count": 1,
  3632. "defines": [
  3633. "USE_1ST_SHADE_MAP"
  3634. ],
  3635. "stageFlags": 16,
  3636. "binding": 3
  3637. },
  3638. {
  3639. "name": "shadeMap2",
  3640. "type": 28,
  3641. "count": 1,
  3642. "defines": [
  3643. "USE_2ND_SHADE_MAP"
  3644. ],
  3645. "stageFlags": 16,
  3646. "binding": 4
  3647. },
  3648. {
  3649. "name": "specularMap",
  3650. "type": 28,
  3651. "count": 1,
  3652. "defines": [
  3653. "USE_SPECULAR_MAP"
  3654. ],
  3655. "stageFlags": 16,
  3656. "binding": 5
  3657. },
  3658. {
  3659. "name": "emissiveMap",
  3660. "type": 28,
  3661. "count": 1,
  3662. "defines": [
  3663. "USE_EMISSIVE_MAP"
  3664. ],
  3665. "stageFlags": 16,
  3666. "binding": 6
  3667. }
  3668. ],
  3669. "samplers": [],
  3670. "textures": [],
  3671. "buffers": [],
  3672. "images": [],
  3673. "subpassInputs": []
  3674. },
  3675. {
  3676. "rate": 2,
  3677. "blocks": [],
  3678. "samplerTextures": [],
  3679. "samplers": [],
  3680. "textures": [],
  3681. "buffers": [],
  3682. "images": [],
  3683. "subpassInputs": []
  3684. },
  3685. {
  3686. "rate": 3,
  3687. "blocks": [
  3688. {
  3689. "tags": {
  3690. "builtin": "global"
  3691. },
  3692. "name": "CCGlobal",
  3693. "members": [
  3694. {
  3695. "name": "cc_time",
  3696. "typename": "vec4",
  3697. "type": 16,
  3698. "count": 1,
  3699. "precision": "highp "
  3700. },
  3701. {
  3702. "name": "cc_screenSize",
  3703. "typename": "vec4",
  3704. "type": 16,
  3705. "count": 1,
  3706. "precision": "mediump "
  3707. },
  3708. {
  3709. "name": "cc_nativeSize",
  3710. "typename": "vec4",
  3711. "type": 16,
  3712. "count": 1,
  3713. "precision": "mediump "
  3714. },
  3715. {
  3716. "name": "cc_probeInfo",
  3717. "typename": "vec4",
  3718. "type": 16,
  3719. "count": 1,
  3720. "precision": "mediump "
  3721. },
  3722. {
  3723. "name": "cc_debug_view_mode",
  3724. "typename": "vec4",
  3725. "type": 16,
  3726. "count": 1,
  3727. "precision": "mediump "
  3728. }
  3729. ],
  3730. "defines": [],
  3731. "stageFlags": 17
  3732. },
  3733. {
  3734. "tags": {
  3735. "builtin": "global"
  3736. },
  3737. "name": "CCCamera",
  3738. "members": [
  3739. {
  3740. "name": "cc_matView",
  3741. "typename": "mat4",
  3742. "type": 25,
  3743. "count": 1,
  3744. "precision": "highp "
  3745. },
  3746. {
  3747. "name": "cc_matViewInv",
  3748. "typename": "mat4",
  3749. "type": 25,
  3750. "count": 1,
  3751. "precision": "highp "
  3752. },
  3753. {
  3754. "name": "cc_matProj",
  3755. "typename": "mat4",
  3756. "type": 25,
  3757. "count": 1,
  3758. "precision": "highp "
  3759. },
  3760. {
  3761. "name": "cc_matProjInv",
  3762. "typename": "mat4",
  3763. "type": 25,
  3764. "count": 1,
  3765. "precision": "highp "
  3766. },
  3767. {
  3768. "name": "cc_matViewProj",
  3769. "typename": "mat4",
  3770. "type": 25,
  3771. "count": 1,
  3772. "precision": "highp "
  3773. },
  3774. {
  3775. "name": "cc_matViewProjInv",
  3776. "typename": "mat4",
  3777. "type": 25,
  3778. "count": 1,
  3779. "precision": "highp "
  3780. },
  3781. {
  3782. "name": "cc_cameraPos",
  3783. "typename": "vec4",
  3784. "type": 16,
  3785. "count": 1,
  3786. "precision": "highp "
  3787. },
  3788. {
  3789. "name": "cc_surfaceTransform",
  3790. "typename": "vec4",
  3791. "type": 16,
  3792. "count": 1,
  3793. "precision": "mediump "
  3794. },
  3795. {
  3796. "name": "cc_screenScale",
  3797. "typename": "vec4",
  3798. "type": 16,
  3799. "count": 1,
  3800. "precision": "mediump "
  3801. },
  3802. {
  3803. "name": "cc_exposure",
  3804. "typename": "vec4",
  3805. "type": 16,
  3806. "count": 1,
  3807. "precision": "mediump "
  3808. },
  3809. {
  3810. "name": "cc_mainLitDir",
  3811. "typename": "vec4",
  3812. "type": 16,
  3813. "count": 1,
  3814. "precision": "mediump "
  3815. },
  3816. {
  3817. "name": "cc_mainLitColor",
  3818. "typename": "vec4",
  3819. "type": 16,
  3820. "count": 1,
  3821. "precision": "mediump "
  3822. },
  3823. {
  3824. "name": "cc_ambientSky",
  3825. "typename": "vec4",
  3826. "type": 16,
  3827. "count": 1,
  3828. "precision": "mediump "
  3829. },
  3830. {
  3831. "name": "cc_ambientGround",
  3832. "typename": "vec4",
  3833. "type": 16,
  3834. "count": 1,
  3835. "precision": "mediump "
  3836. },
  3837. {
  3838. "name": "cc_fogColor",
  3839. "typename": "vec4",
  3840. "type": 16,
  3841. "count": 1,
  3842. "precision": "mediump "
  3843. },
  3844. {
  3845. "name": "cc_fogBase",
  3846. "typename": "vec4",
  3847. "type": 16,
  3848. "count": 1,
  3849. "precision": "mediump "
  3850. },
  3851. {
  3852. "name": "cc_fogAdd",
  3853. "typename": "vec4",
  3854. "type": 16,
  3855. "count": 1,
  3856. "precision": "mediump "
  3857. },
  3858. {
  3859. "name": "cc_nearFar",
  3860. "typename": "vec4",
  3861. "type": 16,
  3862. "count": 1,
  3863. "precision": "mediump "
  3864. },
  3865. {
  3866. "name": "cc_viewPort",
  3867. "typename": "vec4",
  3868. "type": 16,
  3869. "count": 1,
  3870. "precision": "mediump "
  3871. }
  3872. ],
  3873. "defines": [],
  3874. "stageFlags": 17
  3875. },
  3876. {
  3877. "tags": {
  3878. "builtin": "global"
  3879. },
  3880. "name": "CCShadow",
  3881. "members": [
  3882. {
  3883. "name": "cc_matLightView",
  3884. "typename": "mat4",
  3885. "type": 25,
  3886. "count": 1,
  3887. "precision": "highp "
  3888. },
  3889. {
  3890. "name": "cc_matLightViewProj",
  3891. "typename": "mat4",
  3892. "type": 25,
  3893. "count": 1,
  3894. "precision": "highp "
  3895. },
  3896. {
  3897. "name": "cc_shadowInvProjDepthInfo",
  3898. "typename": "vec4",
  3899. "type": 16,
  3900. "count": 1,
  3901. "precision": "highp "
  3902. },
  3903. {
  3904. "name": "cc_shadowProjDepthInfo",
  3905. "typename": "vec4",
  3906. "type": 16,
  3907. "count": 1,
  3908. "precision": "highp "
  3909. },
  3910. {
  3911. "name": "cc_shadowProjInfo",
  3912. "typename": "vec4",
  3913. "type": 16,
  3914. "count": 1,
  3915. "precision": "highp "
  3916. },
  3917. {
  3918. "name": "cc_shadowNFLSInfo",
  3919. "typename": "vec4",
  3920. "type": 16,
  3921. "count": 1,
  3922. "precision": "mediump "
  3923. },
  3924. {
  3925. "name": "cc_shadowWHPBInfo",
  3926. "typename": "vec4",
  3927. "type": 16,
  3928. "count": 1,
  3929. "precision": "mediump "
  3930. },
  3931. {
  3932. "name": "cc_shadowLPNNInfo",
  3933. "typename": "vec4",
  3934. "type": 16,
  3935. "count": 1,
  3936. "precision": "mediump "
  3937. },
  3938. {
  3939. "name": "cc_shadowColor",
  3940. "typename": "vec4",
  3941. "type": 16,
  3942. "count": 1,
  3943. "precision": "lowp "
  3944. },
  3945. {
  3946. "name": "cc_planarNDInfo",
  3947. "typename": "vec4",
  3948. "type": 16,
  3949. "count": 1,
  3950. "precision": "mediump "
  3951. }
  3952. ],
  3953. "defines": [],
  3954. "stageFlags": 17
  3955. },
  3956. {
  3957. "tags": {
  3958. "builtin": "global"
  3959. },
  3960. "name": "CCCSM",
  3961. "members": [
  3962. {
  3963. "name": "cc_csmViewDir0",
  3964. "typename": "vec4",
  3965. "type": 16,
  3966. "count": 4,
  3967. "precision": "highp ",
  3968. "isArray": true
  3969. },
  3970. {
  3971. "name": "cc_csmViewDir1",
  3972. "typename": "vec4",
  3973. "type": 16,
  3974. "count": 4,
  3975. "precision": "highp ",
  3976. "isArray": true
  3977. },
  3978. {
  3979. "name": "cc_csmViewDir2",
  3980. "typename": "vec4",
  3981. "type": 16,
  3982. "count": 4,
  3983. "precision": "highp ",
  3984. "isArray": true
  3985. },
  3986. {
  3987. "name": "cc_csmAtlas",
  3988. "typename": "vec4",
  3989. "type": 16,
  3990. "count": 4,
  3991. "precision": "highp ",
  3992. "isArray": true
  3993. },
  3994. {
  3995. "name": "cc_matCSMViewProj",
  3996. "typename": "mat4",
  3997. "type": 25,
  3998. "count": 4,
  3999. "precision": "highp ",
  4000. "isArray": true
  4001. },
  4002. {
  4003. "name": "cc_csmProjDepthInfo",
  4004. "typename": "vec4",
  4005. "type": 16,
  4006. "count": 4,
  4007. "precision": "highp ",
  4008. "isArray": true
  4009. },
  4010. {
  4011. "name": "cc_csmProjInfo",
  4012. "typename": "vec4",
  4013. "type": 16,
  4014. "count": 4,
  4015. "precision": "highp ",
  4016. "isArray": true
  4017. },
  4018. {
  4019. "name": "cc_csmSplitsInfo",
  4020. "typename": "vec4",
  4021. "type": 16,
  4022. "count": 1,
  4023. "precision": "highp "
  4024. }
  4025. ],
  4026. "defines": [
  4027. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  4028. ],
  4029. "stageFlags": 16
  4030. }
  4031. ],
  4032. "samplerTextures": [
  4033. {
  4034. "tags": {
  4035. "builtin": "global"
  4036. },
  4037. "name": "cc_environment",
  4038. "typename": "samplerCube",
  4039. "type": 31,
  4040. "count": 1,
  4041. "defines": [],
  4042. "stageFlags": 16
  4043. },
  4044. {
  4045. "tags": {
  4046. "builtin": "global"
  4047. },
  4048. "name": "cc_diffuseMap",
  4049. "typename": "samplerCube",
  4050. "type": 31,
  4051. "count": 1,
  4052. "defines": [
  4053. "CC_USE_IBL",
  4054. "CC_USE_DIFFUSEMAP"
  4055. ],
  4056. "stageFlags": 16
  4057. },
  4058. {
  4059. "tags": {
  4060. "builtin": "global"
  4061. },
  4062. "name": "cc_shadowMap",
  4063. "typename": "sampler2D",
  4064. "type": 28,
  4065. "count": 1,
  4066. "precision": "highp ",
  4067. "defines": [
  4068. "CC_RECEIVE_SHADOW"
  4069. ],
  4070. "stageFlags": 16
  4071. },
  4072. {
  4073. "tags": {
  4074. "builtin": "global"
  4075. },
  4076. "name": "cc_spotShadowMap",
  4077. "typename": "sampler2D",
  4078. "type": 28,
  4079. "count": 1,
  4080. "precision": "highp ",
  4081. "defines": [
  4082. "CC_RECEIVE_SHADOW"
  4083. ],
  4084. "stageFlags": 16
  4085. }
  4086. ],
  4087. "samplers": [],
  4088. "textures": [],
  4089. "buffers": [],
  4090. "images": [],
  4091. "subpassInputs": []
  4092. }
  4093. ],
  4094. "hash": 1072892874,
  4095. "glsl4": {
  4096. "vert": "#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 3) in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 6) in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n layout(location = 7) in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 8) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 9) in vec4 a_matWorld0;\n layout(location = 10) in vec4 a_matWorld1;\n layout(location = 11) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 12) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 13) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 14) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 15) in vec4 a_sh_linear_const_r;\n layout(location = 16) in vec4 a_sh_linear_const_g;\n layout(location = 17) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nlayout(location = 0) out highp vec3 v_worldPos;\nlayout(location = 1) out vec4 v_normal;\nlayout(location = 2) out vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 3) out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 4) out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n layout(location = 5) out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 6) out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 7) out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 8) out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n layout(location = 9) out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n layout(location = 10) out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n layout(location = 11) out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 12) out mediump vec4 v_sh_linear_const_r;\n layout(location = 13) out mediump vec4 v_sh_linear_const_g;\n layout(location = 14) out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(set = 2, binding = 3) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(set = 2, binding = 2) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n layout(set = 2, binding = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n#endif\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\nvec3 SurfacesVertexModifyLocalNormal(in SurfacesStandardVertexIntermediate In)\n{\n return In.normal.xyz;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec4 SurfacesVertexModifyLocalTangent(in SurfacesStandardVertexIntermediate In)\n {\n return In.tangent;\n }\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\nvec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)\n{\n vec3 worldNormal = In.worldNormal.xyz;\n #if CC_SURFACES_USE_TWO_SIDED\n worldNormal.xyz *= In.worldNormal.w;\n #endif\n return worldNormal;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);\n#endif\n}\nvoid CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId = vec4(0.0);\n #endif\n #if CC_RECEIVE_SHADOW\n In.shadowBiasAndProbeId.xy = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.xy += a_localShadowBiasAndProbeId.xy;\n #else\n In.shadowBiasAndProbeId.xy += cc_localShadowBias.xy;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n In.shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #if USE_INSTANCING\n In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n In.lightmapUV.z = a_lightingMapUVParam.w;\n #else\n In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n In.lightmapUV.z = cc_lightingMapUVParam.w;\n #endif\n#endif\n}\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n In.normal.xyz = SurfacesVertexModifyLocalNormal(In);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = SurfacesVertexModifyLocalTangent(In);\n #endif\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);\n In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;\n In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexTransferFog(In);\n CCSurfacesVertexTransferLightMapUV(In);\n CCSurfacesVertexTransferShadow(In);\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);\n #endif\n CCSurfacesVertexOutput(In);\n}",
  4097. "frag": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nlayout(location = 0) in highp vec3 v_worldPos;\nlayout(location = 1) in vec4 v_normal;\nlayout(location = 2) in vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 3) in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 4) in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n layout(location = 5) in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 6) in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 7) in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 8) in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n layout(location = 9) in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n layout(location = 10) in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n layout(location = 11) in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 12) in mediump vec4 v_sh_linear_const_r;\n layout(location = 13) in mediump vec4 v_sh_linear_const_g;\n layout(location = 14) in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\nbool equalf_mode(float data1, float data2) { return abs(float(data1) - float(data2)) < 0.001; }\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(set = 2, binding = 1) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(set = 2, binding = 6) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nlayout(set = 0, binding = 5) uniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n layout(set = 0, binding = 7) uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 15) uniform samplerCube cc_reflectionProbeCubemap;\n layout(set = 2, binding = 16) uniform sampler2D cc_reflectionProbePlanarMap;\n layout(set = 2, binding = 17) uniform sampler2D cc_reflectionProbeDataMap;\n layout(set = 2, binding = 18) uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nhighp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nbool isnans(vec2 val) {\n return isnan(val.x) || isnan(val.y);\n}\nbool isnans(vec3 val) {\n return isnan(val.x) || isnan(val.y) || isnan(val.z);\n}\nbool isnans(vec4 val) {\n return isnan(val.x) || isnan(val.y) || isnan(val.z) || isnan(val.w);\n}\nbool isinfs(vec2 val) {\n return isinf(val.x) || isinf(val.y);\n}\nbool isinfs(vec3 val) {\n return isinf(val.x) || isinf(val.y) || isinf(val.z);\n}\nbool isinfs(vec4 val) {\n return isinf(val.x) || isinf(val.y) || isinf(val.z) || isinf(val.w);\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 CalculateBinormal(vec3 normal, vec3 tangent, float mirrorNormal)\n{\n return cross(normal, tangent) * mirrorNormal;\n}\nvec3 CalculateNormalFromTangentSpace(vec3 normalFromTangentSpace, float normalStrength, vec3 normal, vec3 tangent, float mirrorNormal)\n{\n vec3 binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n return (normalFromTangentSpace.x * normalStrength) * normalize(tangent) +\n (normalFromTangentSpace.y * normalStrength) * normalize(binormal) +\n normalFromTangentSpace.z * normalize(normal);\n}\nvec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n}\nvec2 float32x3_to_oct(in vec3 v) {\n vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));\n return (v.z <= 0.0) ? ((1.0 - abs(p.yx)) * signNotZero(p)) : p;\n}\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n float SampleShadowMap (vec3 shadowNDCPos, highp sampler2D shadowMap)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return dot(texture(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n #else\n return texture(shadowMap, shadowNDCPos.xy).x;\n #endif\n }\n float SampleShadowMapSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block1 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block2 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float block3 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(texture(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, texture(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(texture(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(texture(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(texture(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(texture(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(texture(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(texture(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(texture(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(texture(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(texture(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(texture(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(texture(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(texture(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(texture(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(texture(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(texture(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(texture(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(texture(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, texture(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, texture(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, texture(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, texture(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, texture(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, texture(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, texture(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, texture(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, texture(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, texture(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, texture(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, texture(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, texture(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, texture(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, texture(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, texture(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, texture(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, texture(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(set = 2, binding = 11) uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture(lightingMap, luv);\n \tvec4 dataHigh = texture(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n void GetLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n \tvec4 lightmap;\n \tvec2 occlusion;\n \tSampleAndDecodeLightMapColor(lightmapColor, dirShadow, ao, lightingMap, luv, lum, worldNormal);\n #if CC_USE_HDR\n lightmapColor.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n }\n#endif\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#if USE_BASE_COLOR_MAP\n layout(set = 1, binding = 1) uniform sampler2D baseColorMap;\n#endif\n#if USE_NORMAL_MAP\n layout(set = 1, binding = 2) uniform sampler2D normalMap;\n#endif\n#if USE_1ST_SHADE_MAP\n layout(set = 1, binding = 3) uniform sampler2D shadeMap1;\n#endif\n#if USE_2ND_SHADE_MAP\n layout(set = 1, binding = 4) uniform sampler2D shadeMap2;\n#endif\n#if USE_SPECULAR_MAP\n layout(set = 1, binding = 5) uniform sampler2D specularMap;\n#endif\n#if USE_EMISSIVE_MAP\n layout(set = 1, binding = 6) uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\nvoid SurfacesFragmentModifyBaseColorAndToonShade(out vec4 baseColorAndTransparency, out vec3 shade1, out vec3 shade2)\n{\n shade2 = shadeColor2.rgb * colorScaleAndCutoff.rgb;\n #if USE_2ND_SHADE_MAP\n shade2 *= SRGBToLinear(texture(shadeMap2, FSInput_texcoord).rgb);\n #endif\n shade1 = shadeColor1.rgb * colorScaleAndCutoff.rgb;\n #if USE_1ST_SHADE_MAP\n shade1 *= SRGBToLinear(texture(shadeMap1, FSInput_texcoord).rgb);\n #if SHADE_MAP_1_AS_SHADE_MAP_2\n shade2 *= shade1.rgb;\n #endif\n #endif\n vec4 color = baseColor;\n #if USE_BASE_COLOR_MAP\n vec4 texColor = texture(baseColorMap, FSInput_texcoord);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n color *= texColor;\n #if BASE_COLOR_MAP_AS_SHADE_MAP_1\n shade1 *= texColor.rgb;\n #endif\n #if BASE_COLOR_MAP_AS_SHADE_MAP_2\n shade2 *= texColor.rgb;\n #endif\n #endif\n baseColorAndTransparency = color;\n baseColorAndTransparency.rgb *= colorScaleAndCutoff.xyz;\n #if USE_ALPHA_TEST\n if (baseColorAndTransparency.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n vec3 normal = FSInput_worldNormal;\n #if USE_NORMAL_MAP\n vec3 nmmp = texture(normalMap, FSInput_texcoord).xyz - vec3(0.5);\n normal = CalculateNormalFromTangentSpace(nmmp, emissiveScaleAndStrenth.w, normalize(normal.xyz), normalize(FSInput_worldTangent), FSInput_mirrorNormal);\n #endif\n return normalize(normal);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n vec3 emissive = emissive.rgb * emissiveScaleAndStrenth.xyz;\n #if USE_EMISSIVE_MAP\n emissive *= SRGBToLinear(texture(emissiveMap, FSInput_texcoord).rgb);\n #endif\n return emissive;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\nvec4 SurfacesFragmentModifyToonStepAndFeather()\n{\n return shadeParams;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\nfloat SurfacesFragmentModifyToonShadowCover()\n{\n return miscParams.x;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nvec4 SurfacesFragmentModifyToonSpecular()\n{\n vec4 specularParam = specular;\n #if USE_SPECULAR_MAP\n specularParam.rgb *= SRGBToLinear(texture(specularMap, FSInput_texcoord).rgb);\n #endif\n return specularParam;\n}\nstruct LightingIntermediateData\n{\n vec3 N, H, L, V;\n float distToLight, distToLightSqr;\n float distToCamera, distToCameraSqr;\n float angleAttenuation, distAttenuation;\n float NoL, NoV, NoH, VoH;\n float NoLSat, NoVSat, NoHSat;\n float NoVAbsSat, VoHAbsSat;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPosition, worldPosition_fract_part;\n #else\n vec3 worldPosition;\n #endif\n vec3 T, B;\n float specularParam;\n float ior, layerOpacity;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 shadowPosAndDepth;\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitScatteringParams;\n vec3 outScatteringColor, inScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n};\nvoid CCSurfacesLightingGetIntermediateData_PerPixel(inout LightingIntermediateData data, vec3 worldNormal, vec3 worldPos, vec3 worldTangent, vec3 worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , float anisotropyShape\n#endif\n)\n{\n data.N = worldNormal;\n data.V = cc_cameraPos.xyz - worldPos;\n data.distToCameraSqr = dot(data.V, data.V);\n data.distToCamera = sqrt(data.distToCameraSqr);\n data.V /= data.distToCamera;\n data.angleAttenuation = data.distAttenuation = 1.0;\n data.NoV = dot(data.N, data.V);\n data.NoVSat = max(data.NoV, 0.0);\n data.NoVAbsSat = max(abs(data.NoV), 0.0);\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(data.worldPosition, data.worldPosition_fract_part, worldPos);\n #else\n data.worldPosition = worldPos;\n #endif\n data.T = worldTangent;\n data.B = worldBinormal;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n data.anisotropyShape = anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.outScatteringColor = vec3(1.0);\n data.inScatteringColor = vec3(0.0);\n data.transmitScatteringParams = vec4(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.shadowPosAndDepth = vec4(0.0, 0.0, SURFACES_MAX_TRANSMIT_DEPTH_VALUE, SURFACES_MAX_TRANSMIT_DEPTH_VALUE);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n data.baseColorTT = vec3(0.0);\n data.ttIntensity = data.ttScatterCoef = 0.0;\n#endif\n}\nvoid CCSurfacesLightingGetIntermediateData_PerLight(inout LightingIntermediateData data, vec3 lightDirWithDist)\n{\n data.L = lightDirWithDist;\n data.distToLightSqr = dot(data.L, data.L);\n data.distToLight = sqrt(data.distToLightSqr);\n data.L /= data.distToLight;\n data.H = normalize(data.L + data.V);\n data.NoL = dot(data.N, data.L);\n data.NoH = dot(data.N, data.H);\n data.VoH = dot(data.V, data.H);\n data.NoLSat = max(data.NoL, 0.0);\n data.NoHSat = max(data.NoH, 0.0);\n data.VoHAbsSat = max(abs(data.VoH), 0.0);\n}\nstruct LightingResult\n{\n vec3 diffuseColorWithLighting, specularColorWithLighting;\n vec3 directDiffuse, directSpecular, directGF;\n vec3 environmentDiffuse, environmentSpecular, environmentGF;\n float shadow, ao;\n vec3 lightmapColor;\n vec3 emissive;\n vec3 fresnel;\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n vec3 directDiffuseSubLayers, directSpecularSubLayers;\n vec3 environmentDiffuseSubLayers, environmentSpecularSubLayers;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 directTransmitSpecular, environmentTransmitSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 directTransmitDiffuse, environmentTransmitDiffuse;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 direct2ndSpecular, environment2ndSpecular;\n vec3 specularColorWithLighting2ndSpecular;\n vec3 directGF2ndSpecular, environmentGF2ndSpecular;\n vec3 directSubLayerF, environmentSubLayerF;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 directTT;\n vec3 diffuseColorWithLightingTT;\n#endif\n};\nstruct LightingMiscData\n{\n float lightType;\n vec3 lightPos, lightDir;\n vec4 lightColorAndIntensity;\n vec4 lightSizeRangeAngle;\n};\n#define DiffuseCoefficient_EnergyConservation INV_PI\nfloat SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n}\nfloat GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n}\nfloat GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n}\nfloat GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n}\nfloat CalculateDistanceAttenuation(float distToLightSqr, float lightRadius, float lightRange, float lightType)\n{\n float attRadiusSqrInv = 1.0 / max(lightRange, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float litRadiusSqr = lightRadius * lightRadius;\n float edgeAttenuation = (IS_POINT_LIGHT(lightType) || IS_RANGED_DIRECTIONAL_LIGHT(lightType)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distToLightSqr);\n return GetDistAtt(distToLightSqr, attRadiusSqrInv) * edgeAttenuation;\n}\nfloat CalculateAngleAttenuation(vec3 spotLightDir, vec3 L, float cosAngleOuter)\n{\n float cosInner = max(dot(spotLightDir, L), 0.01);\n float litAngleScale = 1.0 / max(0.001, cosInner - cosAngleOuter);\n float litAngleOffset = -cosAngleOuter * litAngleScale;\n return GetAngleAtt(L, spotLightDir, litAngleScale, litAngleOffset);\n}\nbool CCSurfacesLightingEnableShadow(in float NoL)\n{\n return NoL > 0.0;\n}\nfloat CCSurfacesLightingCalculateDistanceAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in float lightType)\n{\n return CalculateDistanceAttenuation(lightingData.distToLightSqr, lightSizeRangeAngle.x, lightSizeRangeAngle.y, lightType);\n}\nfloat CCSurfacesLightingCalculateAngleAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in vec3 spotLightDir)\n{\n return CalculateAngleAttenuation(spotLightDir, lightingData.L, lightSizeRangeAngle.z);\n}\nvoid CCSurfacesLightingCalculateDirect(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n lightingDiffuse = irradiance;\n#if CC_FORWARD_ADD\n float NL = 0.5 * lightingData.NoL + 0.5;\n lightingDiffuse *= NL;\n#endif\n float NH = 0.5 * lightingData.NoH + 0.5;\n float specularWeight = 1.0 - pow(lightingData.specularParam, 5.0);\n float specularMask = step(specularWeight + EPSILON_LOWP, NH);\n lightingSpecular = irradiance * specularMask;\n}\nvoid CCSurfacesLightingCalculateEnvironment(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n{\n lightingDiffuse = vec3(0.0);\n lightingSpecular = vec3(0.0);\n}\n#if CC_SURFACES_LIGHTING_USE_FRESNEL\nvec3 CCSurfaceLightingCalculateExtraFresnel(in LightingIntermediateData lightingData)\n{\n return vec3(1.0);\n}\n#endif\nvoid CCSurfaceLightingCalculateDirectFresnel(out vec3 fresnel, in LightingIntermediateData lightingData, vec3 specularColor, in vec3 environmentGF)\n{\n fresnel = vec3(1.0);\n}\nvoid CCSurfaceLightingCalculateEnvironmentFresnel(out vec3 integratedGF, out vec3 integratedF, in LightingIntermediateData lightingData, vec3 specularColor)\n{\n integratedF = integratedGF = vec3(1.0);\n}\nstruct SurfacesMaterialData\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPos, worldPos_fract_part;\n #else\n vec3 worldPos;\n #endif\n vec4 baseColor;\n vec4 specular;\n vec3 worldNormal;\n vec3 emissive;\n vec3 shade1;\n vec3 shade2;\n float baseStep;\n float baseFeather;\n float shadeStep;\n float shadeFeather;\n float shadowCover;\n};\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n return FSInput_vertexColor;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_TANGENT_AND_BINORMAL\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_IOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n return vec3(0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_SCATTERING_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_IN_SCATTERING_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_OUT_SCATTERING_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_DIFFUSE_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SSS_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_DUAL_LOBE_SPECULAR_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHARED_DATA\nvoid SurfacesFragmentModifySharedData(inout SurfacesMaterialData surfaceData)\n{\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\nvoid SurfacesFragmentModifyBaseColorAndToonShade(out vec4 baseColorAndTransparency, out vec3 shade1, out vec3 shade2, in vec3 baseColor)\n{\n baseColorAndTransparency = FSInput_vertexColor;\n shade1 = shade2 = vec3(0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\nvec4 SurfacesFragmentModifyToonStepAndFeather()\n{\n return vec3(0.8, 0.001, 0.5, 0.001);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\nfloat SurfacesFragmentModifyToonShadowCover()\n{\n return 0.5;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nvec4 SurfacesFragmentModifyToonSpecular()\n{\n return vec4(1.0, 1.0, 1.0, 0.3);\n}\n#endif\nvoid CCSurfacesFragmentGetMaterialData(inout SurfacesMaterialData surfaceData)\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part, FSInput_worldPos);\n #else\n surfaceData.worldPos = FSInput_worldPos;\n #endif\n surfaceData.worldNormal = SurfacesFragmentModifyWorldNormal();\n surfaceData.emissive = SurfacesFragmentModifyEmissive();\n SurfacesFragmentModifyBaseColorAndToonShade(surfaceData.baseColor, surfaceData.shade1, surfaceData.shade2);\n surfaceData.specular = SurfacesFragmentModifyToonSpecular();\n surfaceData.shadowCover = SurfacesFragmentModifyToonShadowCover();\n vec4 shaderParams = SurfacesFragmentModifyToonStepAndFeather();\n surfaceData.baseStep = shadeParams.x;\n surfaceData.baseFeather = shadeParams.y;\n surfaceData.shadeStep = shadeParams.z;\n surfaceData.shadeFeather = shadeParams.w;\n SurfacesFragmentModifySharedData(surfaceData);\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP)\n surfaceData.worldNormal = normalize(FSInput_worldNormal);\n#endif\n#if CC_USE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO) {\n float brightBase = dot(GRAY_VECTOR, surfaceData.baseColor.rgb);\n float brightShade1 = dot(GRAY_VECTOR, surfaceData.shade1.rgb);\n float brightShade2 = dot(GRAY_VECTOR, surfaceData.shade2.rgb);\n surfaceData.baseColor.rgb = vec3(1.0);\n surfaceData.shade1.rgb = vec3(brightShade1 / brightBase);\n surfaceData.shade2.rgb = vec3(brightShade2 / brightBase);\n surfaceData.specular.rgb = vec3(1.0);\n }\n#endif\n}\nvec3 CCSurfacesGetDiffuseColor(in SurfacesMaterialData surfaceData)\n{\n return surfaceData.shade1;\n}\nvec3 CCSurfacesGetSpecularColor(in SurfacesMaterialData surfaceData)\n{\n return surfaceData.specular.xyz;\n}\nvoid CCSurfacesLightingInitializeColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n diffuseColorWithLighting = vec3(0.0);\n specularColorWithLighting = surfaceData.specular.xyz * surfaceData.baseStep;\n}\nvoid CCSurfacesLightingCalculateColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n float NL = 0.5 * lightingData.NoL + 0.5;\n vec3 diffuse = mix(surfaceData.shade1, surfaceData.shade2,\n clamp(1.0 + (surfaceData.shadeStep - surfaceData.shadeFeather - NL) / surfaceData.shadeFeather, 0.0, 1.0));\n diffuse = mix(surfaceData.baseColor.rgb, diffuse,\n clamp(1.0 + (surfaceData.baseStep - surfaceData.baseFeather - NL) / surfaceData.baseFeather, 0.0, 1.0));\n diffuseColorWithLighting = diffuse * surfaceData.baseStep;\n}\nvoid CCSurfacesInitializeLightingIntermediateData(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesLightingGetIntermediateData_PerPixel(lightingData, surfaceData.worldNormal, worldPos, vec3(0.0), vec3(0.0));\n lightingData.specularParam = surfaceData.specular.a;\n lightingData.ior = 1.0;\n}\nvoid CCSurfacesLightingCalculateIntermediateData_PerLight(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData, vec3 lightDirWithDist)\n{\n CCSurfacesLightingGetIntermediateData_PerLight(lightingData, lightDirWithDist);\n}\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData)\n{\n lightingResult.emissive = surfaceData.emissive;\n}\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult)\n{\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n}\nvoid CCSurfacesAccumulateLightingResult(inout LightingResult lightingResultAccumulated, in LightingResult lightingResult)\n{\n lightingResultAccumulated.directDiffuse += lightingResult.directDiffuse * lightingResult.shadow;\n lightingResultAccumulated.directSpecular += lightingResult.directSpecular * lightingResult.shadow;\n}\n#if CC_PIPELINE_TYPE == 1\n vec4 CCSurfacesDeferredOutputBaseColor(in SurfacesMaterialData surfaceData)\n {\n return surfaceData.baseColor;\n }\n vec4 CCSurfacesDeferredOutputNormalMR(in SurfacesMaterialData surfaceData)\n {\n return vec4(float32x3_to_oct(surfaceData.worldNormal), 0.5, 0.0);\n }\n vec4 CCSurfacesDeferredOutputEmissiveAO(in SurfacesMaterialData surfaceData)\n {\n return vec4(surfaceData.emissive, 1.0);\n }\n#endif\nvec4 CCSurfacesShading(in SurfacesMaterialData surfaceData, in LightingResult lightingResult)\n{\n vec4 color = vec4(0.0, 0.0, 0.0, surfaceData.baseColor.a);\n#if CC_FORWARD_ADD\n color.xyz += lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;\n color.xyz += lightingResult.directSpecular * lightingResult.specularColorWithLighting;\n#else\n float lightmapCoef = 0.0;\n#if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n color.xyz += (\n mix(lightingResult.directDiffuse, lightingResult.lightmapColor, lightmapCoef) * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting)\n * lightingResult.shadow\n ;\n#else\n LightingIntermediateData lightingData;\n lightingData.NoL = -1.0;\n vec3 backLightingDiffuse, backLightingSpecular;\n CCSurfacesLightingInitializeColorWithLighting(backLightingDiffuse, backLightingSpecular, surfaceData, lightingData);\n CCSurfacesLightingCalculateColorWithLighting(backLightingDiffuse, backLightingSpecular, surfaceData, lightingData);\n color.xyz +=\n mix(lightingResult.directDiffuse, lightingResult.lightmapColor, lightmapCoef) * mix(backLightingDiffuse, lightingResult.diffuseColorWithLighting, lightingResult.shadow)\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.shadow\n ;\n#endif\n color.xyz += lightingResult.emissive;\n#endif\n return color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\nbool CCSurfacesDebugViewSurfaceData(inout vec4 color, in SurfacesMaterialData surfaceData)\n{\n bool enableMaterialAlpha = true;\n float scalar;\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(surfaceData.worldNormal * 0.5 + vec3(0.5), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSPARENCY)) && (cc_surfaceTransform.y != 3.0)))\n {\n scalar = surfaceData.baseColor.a;\n color = vec4(scalar, scalar, scalar, 1.0);\n enableMaterialAlpha = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_BASE_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(surfaceData.baseColor.rgb), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(CCSurfacesGetDiffuseColor(surfaceData)), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(CCSurfacesGetSpecularColor(surfaceData)), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY)) && (cc_surfaceTransform.y != 3.0)))\n {\n scalar = surfaceData.specular.a;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n return enableMaterialAlpha;\n}\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n void CCSurfacesLighting(inout LightingResult lightingResultAccumulated, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesInitializeLightingResult(lightingResultAccumulated);\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n LightingResult lightingResult;\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n lightingResultAccumulated.diffuseColorWithLighting = lightingResult.diffuseColorWithLighting;\n lightingResultAccumulated.specularColorWithLighting = lightingResult.specularColorWithLighting;\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 diff;\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData);\n lightingResultAccumulated.specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #endif\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 lightDirWithLength = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -normalize(cc_lightDir[i].xyz) : cc_lightPos[i].xyz - worldPos;\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n vec3 diffuseLighting, specularLighting;\n CCSurfacesLightingCalculateDirect(diffuseLighting, specularLighting, lightingData, cc_lightColor[i]);\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n vec3 fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n vec3 fresnel = vec3(1.0);\n #endif\n lightingResult.fresnel = fresnel;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_lightPos[i].w > 0.0 && cc_lightSizeRangeAngle[i].w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n shadow = CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec3 shadowNDCPos;\n bool isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Perspective(shadowNDCPos.z, shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Perspective(SampleShadowMapSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy), shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n #endif\n }\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n shadow = 1.0;\n #endif\n lightingResult.shadow = shadow;\n float distAtt = 1.0;\n if(IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n distAtt = GetOutOfRange(worldPos, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n distAtt = CCSurfacesLightingCalculateDistanceAttenuation(lightingData, cc_lightSizeRangeAngle[i], cc_lightPos[i].w);\n }\n float angleAtt = 1.0;\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n angleAtt = CCSurfacesLightingCalculateAngleAttenuation(lightingData, cc_lightSizeRangeAngle[i], -cc_lightDir[i].xyz);\n }\n float multiplier = distAtt * angleAtt;\n lightingData.angleAttenuation = angleAtt;\n lightingData.distAttenuation = distAtt;\n lightingResult.directDiffuse = diffuseLighting * multiplier;\n lightingResult.directSpecular = specularLighting * multiplier;\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, vec3(1.0));\n vec4 attenuatedLightColorAndIntensity = vec4(cc_lightColor[i].xyz, cc_lightColor[i].w * multiplier);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 transmitSpecularLighting;\n CCSurfacesLightingCalculateDirectTransmitSpecular(transmitSpecularLighting, lightingData, attenuatedLightColorAndIntensity);\n lightingResult.directTransmitSpecular = transmitSpecularLighting * multiplier * (1.0 - fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, attenuatedLightColorAndIntensity, lightingResult.shadow);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData, lightDirWithLength);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, vec3(1.0));\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n lightingResult.direct2ndSpecular *= multiplier;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, attenuatedLightColorAndIntensity);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = cc_lightPos[i].w;\n miscData.lightPos = cc_lightPos[i].xyz;\n miscData.lightDir = cc_lightDir[i].xyz;\n miscData.lightColorAndIntensity = cc_lightColor[i];\n miscData.lightSizeRangeAngle = cc_lightSizeRangeAngle[i];\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n CCSurfacesAccumulateLightingResult(lightingResultAccumulated, lightingResult);\n }\n }\n #else\n void CCSurfacesLighting(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n CCSurfacesInitializeLightingResult(lightingResult, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, -cc_mainLitDir.xyz);\n lightingResult.shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_mainLitDir.w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n vec4 shadowProjDepthInfo = vec4(0.0);\n vec3 shadowNDCPos;\n bool isExceedShadowMap = true;\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n lightingResult.shadow = CCCSMFactorBase(worldPos, lightingData.N, shadowBias);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec4 shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n isExceedShadowMap = 0 > CCGetCSMLevel(shadowPosWithDepthBias, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n lightingResult.shadow = CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, lightingData.N, shadowBias);\n shadowProjDepthInfo = cc_shadowProjDepthInfo;\n isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowNDCPos.z, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Orthgraphic(SampleShadowMapSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy), shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n #endif\n }\n #endif\n lightingResult.lightmapColor = vec3(0.0);\n #if CC_SURFACES_USE_LIGHT_MAP && !CC_FORWARD_ADD\n float lightmapShadow, lightmapAO;\n GetLightMapColor(lightingResult.lightmapColor, lightmapShadow, lightmapAO, cc_lightingMap, FSInput_lightMapUV.xy, FSInput_lightMapUV.z, surfaceData.worldNormal);\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n lightingResult.shadow *= lightmapShadow;\n #endif\n lightingResult.ao *= lightmapAO;\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n #endif\n vec3 unused;\n CCSurfacesLightingCalculateEnvironment(lightingResult.environmentDiffuse, lightingResult.environmentSpecular, lightingData, cc_ambientSky.w);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF, unused, lightingData, lightingResult.specularColorWithLighting);\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n #if !CC_DISABLE_DIRECTIONAL_LIGHT && !CC_FORWARD_ADD\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateDirect(lightingResult.directDiffuse, lightingResult.directSpecular, lightingData, cc_mainLitColor);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, lightingResult.environmentGF);\n #endif\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n lightingResult.fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n lightingResult.fresnel = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n CCSurfacesLightingCalculateDirectTransmitSpecular(lightingResult.directTransmitSpecular, lightingData, cc_mainLitColor);\n CCSurfacesLightingCalculateEnvironmentTransmitSpecular(lightingResult.environmentTransmitSpecular, lightingData, cc_ambientSky.w);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, -cc_mainLitDir.xyz);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, cc_mainLitColor, lightingResult.shadow);\n CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(lightingResult.environmentTransmitDiffuse, lightingDataTD, cc_ambientSky.w, lightingResult.ao, -cc_mainLitDir.xyz);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData2ndSpecular, -cc_mainLitDir.xyz);\n vec3 diff;\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData2ndSpecular);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateEnvironment2ndSpecular(lightingResult.environment2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.environmentSpecular);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF2ndSpecular, lightingResult.environmentSubLayerF, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular);\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, lightingResult.environmentGF2ndSpecular);\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentSheen(lightingResult.environment2ndSpecular, lightingResult.environmentGF2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, cc_mainLitColor);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = LIGHT_TYPE_DIRECTIONAL;\n miscData.lightPos = vec3(0.0);\n miscData.lightDir = cc_mainLitDir.xyz;\n miscData.lightColorAndIntensity = cc_mainLitColor;\n miscData.lightSizeRangeAngle = vec4(0.0, 0.0, 0.0, 0.0);\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING\n #endif\n #endif\n#endif\nvec4 CCSurfacesDebugDisplayInvalidNumber(vec4 color)\n{\n float index = mod(cc_time.x * 10.0, 2.0);\n vec4 error = index < 1.0 ? vec4(1.0, 0.0, 0.2, 1.0) : vec4(0.0, 1.0, 0.2, 1.0);\n return (isnans(color.rgb) || isinfs(color.rgb)) ? error : color;\n}\nvec4 CCSurfacesDebugDisplayInvalidInputData(vec4 color, vec3 data)\n{\n float index = mod(cc_time.x * 10.0, 2.0);\n vec4 error = index < 1.0 ? vec4(1.0, 0.0, 0.2, 1.0) : vec4(0.0, 1.0, 0.2, 1.0);\n return (isnans(data) || isinfs(data)) ? error : color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && !CC_FORWARD_ADD\n void CCSurfacesDebugViewMeshData(inout vec4 color)\n {\n vec4 white = vec4(1.0, 1.0, 1.0, 1.0);\n vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_VERTEX_COLOR\n color = FSInput_vertexColor;\n #else\n color = white;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_worldNormal * 0.5 + vec3(0.5), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = vec4(FSInput_worldTangent * 0.5 + vec3(0.5), 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n float sign = FSInput_mirrorNormal * 0.5 + 0.5;\n color = vec4(sign, sign, sign, 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FACE_SIDE)) && (cc_surfaceTransform.y != 3.0)))\n {\n float scalar = clamp(FSInput_faceSideSign, 0.0, 1.0);\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UV0)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_texcoord.xy, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UV1)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_texcoord1.xy, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n color = vec4(FSInput_lightMapUV.xy, 0.0, 1.0);\n #else\n color = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH)) && (cc_surfaceTransform.y != 3.0)))\n {\n vec4 clipPos = cc_matProj * cc_matView * vec4(FSInput_worldPos.xyz, 1.0);\n float depth = clipPos.z / clipPos.w;\n color = vec4(depth, depth, depth, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH)) && (cc_surfaceTransform.y != 3.0)))\n {\n vec4 viewPos = cc_matView * vec4(FSInput_worldPos.xyz, 1.0);\n float depth = (-viewPos.z - cc_nearFar.x) / cc_nearFar.y;\n color = vec4(depth, depth, depth, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_WORLD_POS)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_worldPos.xyz, 1.0);\n }\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n bool CCSurfacesDebugViewLightingResult(inout vec4 color, in LightingResult lightingResult)\n {\n bool isSRGBColor = false;\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_LIGHT_MAP)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.lightmapColor;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_EMISSIVE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.emissive;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_AO)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(lightingResult.ao);\n isSRGBColor = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SHADOW)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(lightingResult.shadow);\n isSRGBColor = false;\n }\n vec3 fresnel = lightingResult.fresnel;\n vec3 directTransmitSpecular = vec3(0.0), environmentTransmitSpecular = vec3(0.0);\n vec3 directTransmitDiffuse = vec3(0.0), environmentTransmitDiffuse = vec3(0.0);\n vec3 diffuseColorWithLightingTT = vec3(0.0), specularColorWithLighting2ndSpecular = vec3(0.0);\n vec3 direct2ndSpecular = vec3(0.0), environment2ndSpecular = vec3(0.0);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n directTransmitSpecular = lightingResult.directTransmitSpecular;\n environmentTransmitSpecular = lightingResult.environmentTransmitSpecular;\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n directTransmitDiffuse = lightingResult.directTransmitDiffuse;\n environmentTransmitDiffuse = lightingResult.environmentTransmitDiffuse;\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n direct2ndSpecular = lightingResult.direct2ndSpecular * lightingResult.directGF2ndSpecular;\n environment2ndSpecular = lightingResult.environment2ndSpecular * lightingResult.environmentGF2ndSpecular;\n specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n fresnel = lightingResult.environmentSubLayerF;\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n direct2ndSpecular = lightingResult.directSpecularSubLayers;\n environment2ndSpecular = lightingResult.environmentSpecularSubLayers;\n #endif\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRESNEL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(fresnel);\n isSRGBColor = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environmentTransmitSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environmentTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitSpecular + environmentTransmitSpecular + directTransmitDiffuse + environmentTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = direct2ndSpecular * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environment2ndSpecular * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = (direct2ndSpecular + environment2ndSpecular) * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n return isSRGBColor;\n }\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n void CCSurfacesDebugViewCompositeLightingResult(inout LightingResult lightingResult)\n {\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE)\n lightingResult.directDiffuse = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR)\n lightingResult.directSpecular = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE)\n lightingResult.environmentDiffuse = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR)\n lightingResult.environmentSpecular = vec3(0.0);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE)\n lightingResult.directTransmitDiffuse = lightingResult.environmentTransmitDiffuse = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR)\n lightingResult.directTransmitSpecular = lightingResult.environmentTransmitSpecular = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR)\n lightingResult.direct2ndSpecular = lightingResult.environment2ndSpecular = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_TT\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT)\n lightingResult.directTT = vec3(0.0);\n #endif\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE)\n lightingResult.emissive = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP)\n lightingResult.lightmapColor = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL)\n lightingResult.fresnel = vec3(1.0);\n }\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n layout(location = 0) out vec4 fragColorX;\n void main() {\n #if CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER\n float NoL = dot(-cc_mainLitDir.xyz, FSInput_worldNormal.xyz);\n vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();\n float fogFactor = 1.0;\n #if CC_FORWARD_ADD\n color.rgb = vec3(0.0);\n #endif\n #else\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n vec2 shadowBias = vec2(0.0);\n vec3 colDebugCSMLayer = vec3(1.0);\n #if CC_RECEIVE_SHADOW\n shadowBias = FSInput_shadowBias;\n #if !CC_FORWARD_ADD\n #if CC_USE_DEBUG_VIEW && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION)\n {\n vec4 csmPos;\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int csmLayer = -1;\n csmLayer = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, surfaceData.worldPos);\n bool OutOfRange = csmLayer < 0;\n if (OutOfRange)\n colDebugCSMLayer = vec3(1.0);\n else if (csmLayer == 0)\n colDebugCSMLayer = vec3(1.0, 0.0, 0.0);\n else if (csmLayer == 1)\n colDebugCSMLayer = vec3(0.0, 1.0, 0.0);\n else if (csmLayer == 2)\n colDebugCSMLayer = vec3(0.0, 0.0, 1.0);\n else if (csmLayer == 3)\n colDebugCSMLayer = vec3(0.0, 1.0, 1.0);\n }\n #endif\n #endif\n #endif\n float fogFactor = 1.0;\n #if !CC_FORWARD_ADD\n #if CC_USE_FOG != 4\n #if !CC_USE_ACCURATE_FOG\n fogFactor = FSInput_fogFactor;\n #else\n CC_TRANSFER_FOG_BASE(vec4(FSInput_worldPos, 1.0), fogFactor);\n #endif\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG) {\n fogFactor = 1.0;\n }\n #endif\n #endif\n LightingResult lightingResult;\n CCSurfacesLighting(lightingResult, surfaceData, shadowBias);\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && CC_SURFACES_ENABLE_DEBUG_VIEW\n vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);\n float materialTransparency = CCSurfacesShading(surfaceData, lightingResult).a;\n #if !CC_FORWARD_ADD && !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n CCSurfacesDebugViewMeshData(debugColor);\n if (CCSurfacesDebugViewSurfaceData(debugColor, surfaceData))\n {\n debugColor.a = materialTransparency;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FOG)) && (cc_surfaceTransform.y != 3.0)))\n {\n debugColor.rgb = vec3(1.0 - fogFactor);\n }\n #endif\n #if CC_FORWARD_ADD\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)) && (cc_surfaceTransform.y != 3.0)) ||\n (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n #endif\n {\n if (CCSurfacesDebugViewLightingResult(debugColor, lightingResult))\n {\n debugColor.a = materialTransparency;\n #if !CC_USE_FLOAT_OUTPUT\n debugColor.rgb = HDRToLDR(debugColor.rgb);\n debugColor.rgb = LinearToSRGB(debugColor.rgb);\n #endif\n }\n }\n if (IS_DEBUG_VIEW_ENABLE_WITH_CAMERA) {\n fragColorX = debugColor;\n return;\n }\n #elif CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n CCSurfacesDebugViewCompositeLightingResult(lightingResult);\n #endif\n vec4 color = CCSurfacesShading(surfaceData, lightingResult);\n #if CC_USE_DEBUG_VIEW && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION) {\n color.rgb *= colDebugCSMLayer.rgb;\n }\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = CCSurfacesDebugDisplayInvalidInputData(color, FSInput_worldTangent);\n #endif\n #endif\n #endif\n #if CC_USE_FOG != 4 && (!CC_USE_FLOAT_OUTPUT || CC_IS_TRANSPARENCY_PASS)\n #if !CC_FORWARD_ADD\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FOG\n color.rgb = CCSurfacesLightingModifyFog(fogFactor, color.rgb, surfaceData, lightingResult);\n #else\n CC_APPLY_FOG_BASE(color, fogFactor);\n #endif\n #endif\n #endif\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #else\n color = CCSurfacesDebugDisplayInvalidNumber(color);\n #if !CC_USE_FLOAT_OUTPUT || CC_IS_TRANSPARENCY_PASS\n color.rgb = HDRToLDR(color.rgb);\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n #endif\n fragColorX = color;\n }\n#elif CC_PIPELINE_TYPE == 1\n layout(location = 0) out vec4 albedoOut;\n layout(location = 1) out vec4 emissiveOut;\n layout(location = 2) out vec4 normalOut;\n void main () {\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n albedoOut = CCSurfacesDeferredOutputBaseColor(surfaceData);\n normalOut = CCSurfacesDeferredOutputNormalMR(surfaceData);\n emissiveOut = CCSurfacesDeferredOutputEmissiveAO(surfaceData);\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && CC_SURFACES_ENABLE_DEBUG_VIEW\n vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);\n CCSurfacesDebugViewMeshData(debugColor);\n CCSurfacesDebugViewSurfaceData(debugColor, surfaceData);\n if (IS_DEBUG_VIEW_ENABLE_WITH_CAMERA) {\n albedoOut = debugColor;\n }\n #endif\n }\n#endif"
  4098. },
  4099. "glsl3": {
  4100. "vert": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nout highp vec3 v_worldPos;\nout vec4 v_normal;\nout vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n out mediump vec4 v_sh_linear_const_r;\n out mediump vec4 v_sh_linear_const_g;\n out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\nvec3 SurfacesVertexModifyLocalNormal(in SurfacesStandardVertexIntermediate In)\n{\n return In.normal.xyz;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec4 SurfacesVertexModifyLocalTangent(in SurfacesStandardVertexIntermediate In)\n {\n return In.tangent;\n }\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\nvec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)\n{\n vec3 worldNormal = In.worldNormal.xyz;\n #if CC_SURFACES_USE_TWO_SIDED\n worldNormal.xyz *= In.worldNormal.w;\n #endif\n return worldNormal;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);\n#endif\n}\nvoid CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId = vec4(0.0);\n #endif\n #if CC_RECEIVE_SHADOW\n In.shadowBiasAndProbeId.xy = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.xy += a_localShadowBiasAndProbeId.xy;\n #else\n In.shadowBiasAndProbeId.xy += cc_localShadowBias.xy;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n In.shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #if USE_INSTANCING\n In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n In.lightmapUV.z = a_lightingMapUVParam.w;\n #else\n In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n In.lightmapUV.z = cc_lightingMapUVParam.w;\n #endif\n#endif\n}\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n In.normal.xyz = SurfacesVertexModifyLocalNormal(In);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = SurfacesVertexModifyLocalTangent(In);\n #endif\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);\n In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;\n In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexTransferFog(In);\n CCSurfacesVertexTransferLightMapUV(In);\n CCSurfacesVertexTransferShadow(In);\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);\n #endif\n CCSurfacesVertexOutput(In);\n}",
  4101. "frag": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nin highp vec3 v_worldPos;\nin vec4 v_normal;\nin vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n in mediump vec4 v_sh_linear_const_r;\n in mediump vec4 v_sh_linear_const_g;\n in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\nbool equalf_mode(float data1, float data2) { return abs(float(data1) - float(data2)) < 0.001; }\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(std140) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nhighp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nbool isnans(vec2 val) {\n return isnan(val.x) || isnan(val.y);\n}\nbool isnans(vec3 val) {\n return isnan(val.x) || isnan(val.y) || isnan(val.z);\n}\nbool isnans(vec4 val) {\n return isnan(val.x) || isnan(val.y) || isnan(val.z) || isnan(val.w);\n}\nbool isinfs(vec2 val) {\n return isinf(val.x) || isinf(val.y);\n}\nbool isinfs(vec3 val) {\n return isinf(val.x) || isinf(val.y) || isinf(val.z);\n}\nbool isinfs(vec4 val) {\n return isinf(val.x) || isinf(val.y) || isinf(val.z) || isinf(val.w);\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 CalculateBinormal(vec3 normal, vec3 tangent, float mirrorNormal)\n{\n return cross(normal, tangent) * mirrorNormal;\n}\nvec3 CalculateNormalFromTangentSpace(vec3 normalFromTangentSpace, float normalStrength, vec3 normal, vec3 tangent, float mirrorNormal)\n{\n vec3 binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n return (normalFromTangentSpace.x * normalStrength) * normalize(tangent) +\n (normalFromTangentSpace.y * normalStrength) * normalize(binormal) +\n normalFromTangentSpace.z * normalize(normal);\n}\nvec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n}\nvec2 float32x3_to_oct(in vec3 v) {\n vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));\n return (v.z <= 0.0) ? ((1.0 - abs(p.yx)) * signNotZero(p)) : p;\n}\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n float SampleShadowMap (vec3 shadowNDCPos, highp sampler2D shadowMap)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return dot(texture(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n #else\n return texture(shadowMap, shadowNDCPos.xy).x;\n #endif\n }\n float SampleShadowMapSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block1 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block2 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float block3 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(texture(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, texture(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(texture(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(texture(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(texture(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(texture(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(texture(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(texture(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(texture(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(texture(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(texture(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(texture(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(texture(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(texture(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(texture(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(texture(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(texture(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(texture(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(texture(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(texture(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, texture(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, texture(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, texture(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, texture(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, texture(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, texture(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, texture(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, texture(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, texture(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, texture(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, texture(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, texture(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, texture(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, texture(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, texture(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, texture(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, texture(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, texture(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, texture(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, texture(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, texture(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, texture(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, texture(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, texture(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, texture(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture(lightingMap, luv);\n \tvec4 dataHigh = texture(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n void GetLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n \tvec4 lightmap;\n \tvec2 occlusion;\n \tSampleAndDecodeLightMapColor(lightmapColor, dirShadow, ao, lightingMap, luv, lum, worldNormal);\n #if CC_USE_HDR\n lightmapColor.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n }\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#if USE_BASE_COLOR_MAP\n uniform sampler2D baseColorMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_1ST_SHADE_MAP\n uniform sampler2D shadeMap1;\n#endif\n#if USE_2ND_SHADE_MAP\n uniform sampler2D shadeMap2;\n#endif\n#if USE_SPECULAR_MAP\n uniform sampler2D specularMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\nvoid SurfacesFragmentModifyBaseColorAndToonShade(out vec4 baseColorAndTransparency, out vec3 shade1, out vec3 shade2)\n{\n shade2 = shadeColor2.rgb * colorScaleAndCutoff.rgb;\n #if USE_2ND_SHADE_MAP\n shade2 *= SRGBToLinear(texture(shadeMap2, FSInput_texcoord).rgb);\n #endif\n shade1 = shadeColor1.rgb * colorScaleAndCutoff.rgb;\n #if USE_1ST_SHADE_MAP\n shade1 *= SRGBToLinear(texture(shadeMap1, FSInput_texcoord).rgb);\n #if SHADE_MAP_1_AS_SHADE_MAP_2\n shade2 *= shade1.rgb;\n #endif\n #endif\n vec4 color = baseColor;\n #if USE_BASE_COLOR_MAP\n vec4 texColor = texture(baseColorMap, FSInput_texcoord);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n color *= texColor;\n #if BASE_COLOR_MAP_AS_SHADE_MAP_1\n shade1 *= texColor.rgb;\n #endif\n #if BASE_COLOR_MAP_AS_SHADE_MAP_2\n shade2 *= texColor.rgb;\n #endif\n #endif\n baseColorAndTransparency = color;\n baseColorAndTransparency.rgb *= colorScaleAndCutoff.xyz;\n #if USE_ALPHA_TEST\n if (baseColorAndTransparency.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n vec3 normal = FSInput_worldNormal;\n #if USE_NORMAL_MAP\n vec3 nmmp = texture(normalMap, FSInput_texcoord).xyz - vec3(0.5);\n normal = CalculateNormalFromTangentSpace(nmmp, emissiveScaleAndStrenth.w, normalize(normal.xyz), normalize(FSInput_worldTangent), FSInput_mirrorNormal);\n #endif\n return normalize(normal);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n vec3 emissive = emissive.rgb * emissiveScaleAndStrenth.xyz;\n #if USE_EMISSIVE_MAP\n emissive *= SRGBToLinear(texture(emissiveMap, FSInput_texcoord).rgb);\n #endif\n return emissive;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\nvec4 SurfacesFragmentModifyToonStepAndFeather()\n{\n return shadeParams;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\nfloat SurfacesFragmentModifyToonShadowCover()\n{\n return miscParams.x;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nvec4 SurfacesFragmentModifyToonSpecular()\n{\n vec4 specularParam = specular;\n #if USE_SPECULAR_MAP\n specularParam.rgb *= SRGBToLinear(texture(specularMap, FSInput_texcoord).rgb);\n #endif\n return specularParam;\n}\nstruct LightingIntermediateData\n{\n vec3 N, H, L, V;\n float distToLight, distToLightSqr;\n float distToCamera, distToCameraSqr;\n float angleAttenuation, distAttenuation;\n float NoL, NoV, NoH, VoH;\n float NoLSat, NoVSat, NoHSat;\n float NoVAbsSat, VoHAbsSat;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPosition, worldPosition_fract_part;\n #else\n vec3 worldPosition;\n #endif\n vec3 T, B;\n float specularParam;\n float ior, layerOpacity;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 shadowPosAndDepth;\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitScatteringParams;\n vec3 outScatteringColor, inScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n};\nvoid CCSurfacesLightingGetIntermediateData_PerPixel(inout LightingIntermediateData data, vec3 worldNormal, vec3 worldPos, vec3 worldTangent, vec3 worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , float anisotropyShape\n#endif\n)\n{\n data.N = worldNormal;\n data.V = cc_cameraPos.xyz - worldPos;\n data.distToCameraSqr = dot(data.V, data.V);\n data.distToCamera = sqrt(data.distToCameraSqr);\n data.V /= data.distToCamera;\n data.angleAttenuation = data.distAttenuation = 1.0;\n data.NoV = dot(data.N, data.V);\n data.NoVSat = max(data.NoV, 0.0);\n data.NoVAbsSat = max(abs(data.NoV), 0.0);\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(data.worldPosition, data.worldPosition_fract_part, worldPos);\n #else\n data.worldPosition = worldPos;\n #endif\n data.T = worldTangent;\n data.B = worldBinormal;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n data.anisotropyShape = anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.outScatteringColor = vec3(1.0);\n data.inScatteringColor = vec3(0.0);\n data.transmitScatteringParams = vec4(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.shadowPosAndDepth = vec4(0.0, 0.0, SURFACES_MAX_TRANSMIT_DEPTH_VALUE, SURFACES_MAX_TRANSMIT_DEPTH_VALUE);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n data.baseColorTT = vec3(0.0);\n data.ttIntensity = data.ttScatterCoef = 0.0;\n#endif\n}\nvoid CCSurfacesLightingGetIntermediateData_PerLight(inout LightingIntermediateData data, vec3 lightDirWithDist)\n{\n data.L = lightDirWithDist;\n data.distToLightSqr = dot(data.L, data.L);\n data.distToLight = sqrt(data.distToLightSqr);\n data.L /= data.distToLight;\n data.H = normalize(data.L + data.V);\n data.NoL = dot(data.N, data.L);\n data.NoH = dot(data.N, data.H);\n data.VoH = dot(data.V, data.H);\n data.NoLSat = max(data.NoL, 0.0);\n data.NoHSat = max(data.NoH, 0.0);\n data.VoHAbsSat = max(abs(data.VoH), 0.0);\n}\nstruct LightingResult\n{\n vec3 diffuseColorWithLighting, specularColorWithLighting;\n vec3 directDiffuse, directSpecular, directGF;\n vec3 environmentDiffuse, environmentSpecular, environmentGF;\n float shadow, ao;\n vec3 lightmapColor;\n vec3 emissive;\n vec3 fresnel;\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n vec3 directDiffuseSubLayers, directSpecularSubLayers;\n vec3 environmentDiffuseSubLayers, environmentSpecularSubLayers;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 directTransmitSpecular, environmentTransmitSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 directTransmitDiffuse, environmentTransmitDiffuse;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 direct2ndSpecular, environment2ndSpecular;\n vec3 specularColorWithLighting2ndSpecular;\n vec3 directGF2ndSpecular, environmentGF2ndSpecular;\n vec3 directSubLayerF, environmentSubLayerF;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 directTT;\n vec3 diffuseColorWithLightingTT;\n#endif\n};\nstruct LightingMiscData\n{\n float lightType;\n vec3 lightPos, lightDir;\n vec4 lightColorAndIntensity;\n vec4 lightSizeRangeAngle;\n};\n#define DiffuseCoefficient_EnergyConservation INV_PI\nfloat SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n}\nfloat GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n}\nfloat GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n}\nfloat GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n}\nfloat CalculateDistanceAttenuation(float distToLightSqr, float lightRadius, float lightRange, float lightType)\n{\n float attRadiusSqrInv = 1.0 / max(lightRange, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float litRadiusSqr = lightRadius * lightRadius;\n float edgeAttenuation = (IS_POINT_LIGHT(lightType) || IS_RANGED_DIRECTIONAL_LIGHT(lightType)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distToLightSqr);\n return GetDistAtt(distToLightSqr, attRadiusSqrInv) * edgeAttenuation;\n}\nfloat CalculateAngleAttenuation(vec3 spotLightDir, vec3 L, float cosAngleOuter)\n{\n float cosInner = max(dot(spotLightDir, L), 0.01);\n float litAngleScale = 1.0 / max(0.001, cosInner - cosAngleOuter);\n float litAngleOffset = -cosAngleOuter * litAngleScale;\n return GetAngleAtt(L, spotLightDir, litAngleScale, litAngleOffset);\n}\nbool CCSurfacesLightingEnableShadow(in float NoL)\n{\n return NoL > 0.0;\n}\nfloat CCSurfacesLightingCalculateDistanceAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in float lightType)\n{\n return CalculateDistanceAttenuation(lightingData.distToLightSqr, lightSizeRangeAngle.x, lightSizeRangeAngle.y, lightType);\n}\nfloat CCSurfacesLightingCalculateAngleAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in vec3 spotLightDir)\n{\n return CalculateAngleAttenuation(spotLightDir, lightingData.L, lightSizeRangeAngle.z);\n}\nvoid CCSurfacesLightingCalculateDirect(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n lightingDiffuse = irradiance;\n#if CC_FORWARD_ADD\n float NL = 0.5 * lightingData.NoL + 0.5;\n lightingDiffuse *= NL;\n#endif\n float NH = 0.5 * lightingData.NoH + 0.5;\n float specularWeight = 1.0 - pow(lightingData.specularParam, 5.0);\n float specularMask = step(specularWeight + EPSILON_LOWP, NH);\n lightingSpecular = irradiance * specularMask;\n}\nvoid CCSurfacesLightingCalculateEnvironment(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n{\n lightingDiffuse = vec3(0.0);\n lightingSpecular = vec3(0.0);\n}\n#if CC_SURFACES_LIGHTING_USE_FRESNEL\nvec3 CCSurfaceLightingCalculateExtraFresnel(in LightingIntermediateData lightingData)\n{\n return vec3(1.0);\n}\n#endif\nvoid CCSurfaceLightingCalculateDirectFresnel(out vec3 fresnel, in LightingIntermediateData lightingData, vec3 specularColor, in vec3 environmentGF)\n{\n fresnel = vec3(1.0);\n}\nvoid CCSurfaceLightingCalculateEnvironmentFresnel(out vec3 integratedGF, out vec3 integratedF, in LightingIntermediateData lightingData, vec3 specularColor)\n{\n integratedF = integratedGF = vec3(1.0);\n}\nstruct SurfacesMaterialData\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPos, worldPos_fract_part;\n #else\n vec3 worldPos;\n #endif\n vec4 baseColor;\n vec4 specular;\n vec3 worldNormal;\n vec3 emissive;\n vec3 shade1;\n vec3 shade2;\n float baseStep;\n float baseFeather;\n float shadeStep;\n float shadeFeather;\n float shadowCover;\n};\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n return FSInput_vertexColor;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_TANGENT_AND_BINORMAL\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_IOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n return vec3(0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_SCATTERING_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_IN_SCATTERING_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_OUT_SCATTERING_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_DIFFUSE_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SSS_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_DUAL_LOBE_SPECULAR_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHARED_DATA\nvoid SurfacesFragmentModifySharedData(inout SurfacesMaterialData surfaceData)\n{\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\nvoid SurfacesFragmentModifyBaseColorAndToonShade(out vec4 baseColorAndTransparency, out vec3 shade1, out vec3 shade2, in vec3 baseColor)\n{\n baseColorAndTransparency = FSInput_vertexColor;\n shade1 = shade2 = vec3(0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\nvec4 SurfacesFragmentModifyToonStepAndFeather()\n{\n return vec3(0.8, 0.001, 0.5, 0.001);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\nfloat SurfacesFragmentModifyToonShadowCover()\n{\n return 0.5;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nvec4 SurfacesFragmentModifyToonSpecular()\n{\n return vec4(1.0, 1.0, 1.0, 0.3);\n}\n#endif\nvoid CCSurfacesFragmentGetMaterialData(inout SurfacesMaterialData surfaceData)\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part, FSInput_worldPos);\n #else\n surfaceData.worldPos = FSInput_worldPos;\n #endif\n surfaceData.worldNormal = SurfacesFragmentModifyWorldNormal();\n surfaceData.emissive = SurfacesFragmentModifyEmissive();\n SurfacesFragmentModifyBaseColorAndToonShade(surfaceData.baseColor, surfaceData.shade1, surfaceData.shade2);\n surfaceData.specular = SurfacesFragmentModifyToonSpecular();\n surfaceData.shadowCover = SurfacesFragmentModifyToonShadowCover();\n vec4 shaderParams = SurfacesFragmentModifyToonStepAndFeather();\n surfaceData.baseStep = shadeParams.x;\n surfaceData.baseFeather = shadeParams.y;\n surfaceData.shadeStep = shadeParams.z;\n surfaceData.shadeFeather = shadeParams.w;\n SurfacesFragmentModifySharedData(surfaceData);\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP)\n surfaceData.worldNormal = normalize(FSInput_worldNormal);\n#endif\n#if CC_USE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO) {\n float brightBase = dot(GRAY_VECTOR, surfaceData.baseColor.rgb);\n float brightShade1 = dot(GRAY_VECTOR, surfaceData.shade1.rgb);\n float brightShade2 = dot(GRAY_VECTOR, surfaceData.shade2.rgb);\n surfaceData.baseColor.rgb = vec3(1.0);\n surfaceData.shade1.rgb = vec3(brightShade1 / brightBase);\n surfaceData.shade2.rgb = vec3(brightShade2 / brightBase);\n surfaceData.specular.rgb = vec3(1.0);\n }\n#endif\n}\nvec3 CCSurfacesGetDiffuseColor(in SurfacesMaterialData surfaceData)\n{\n return surfaceData.shade1;\n}\nvec3 CCSurfacesGetSpecularColor(in SurfacesMaterialData surfaceData)\n{\n return surfaceData.specular.xyz;\n}\nvoid CCSurfacesLightingInitializeColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n diffuseColorWithLighting = vec3(0.0);\n specularColorWithLighting = surfaceData.specular.xyz * surfaceData.baseStep;\n}\nvoid CCSurfacesLightingCalculateColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n float NL = 0.5 * lightingData.NoL + 0.5;\n vec3 diffuse = mix(surfaceData.shade1, surfaceData.shade2,\n clamp(1.0 + (surfaceData.shadeStep - surfaceData.shadeFeather - NL) / surfaceData.shadeFeather, 0.0, 1.0));\n diffuse = mix(surfaceData.baseColor.rgb, diffuse,\n clamp(1.0 + (surfaceData.baseStep - surfaceData.baseFeather - NL) / surfaceData.baseFeather, 0.0, 1.0));\n diffuseColorWithLighting = diffuse * surfaceData.baseStep;\n}\nvoid CCSurfacesInitializeLightingIntermediateData(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesLightingGetIntermediateData_PerPixel(lightingData, surfaceData.worldNormal, worldPos, vec3(0.0), vec3(0.0));\n lightingData.specularParam = surfaceData.specular.a;\n lightingData.ior = 1.0;\n}\nvoid CCSurfacesLightingCalculateIntermediateData_PerLight(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData, vec3 lightDirWithDist)\n{\n CCSurfacesLightingGetIntermediateData_PerLight(lightingData, lightDirWithDist);\n}\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData)\n{\n lightingResult.emissive = surfaceData.emissive;\n}\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult)\n{\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n}\nvoid CCSurfacesAccumulateLightingResult(inout LightingResult lightingResultAccumulated, in LightingResult lightingResult)\n{\n lightingResultAccumulated.directDiffuse += lightingResult.directDiffuse * lightingResult.shadow;\n lightingResultAccumulated.directSpecular += lightingResult.directSpecular * lightingResult.shadow;\n}\n#if CC_PIPELINE_TYPE == 1\n vec4 CCSurfacesDeferredOutputBaseColor(in SurfacesMaterialData surfaceData)\n {\n return surfaceData.baseColor;\n }\n vec4 CCSurfacesDeferredOutputNormalMR(in SurfacesMaterialData surfaceData)\n {\n return vec4(float32x3_to_oct(surfaceData.worldNormal), 0.5, 0.0);\n }\n vec4 CCSurfacesDeferredOutputEmissiveAO(in SurfacesMaterialData surfaceData)\n {\n return vec4(surfaceData.emissive, 1.0);\n }\n#endif\nvec4 CCSurfacesShading(in SurfacesMaterialData surfaceData, in LightingResult lightingResult)\n{\n vec4 color = vec4(0.0, 0.0, 0.0, surfaceData.baseColor.a);\n#if CC_FORWARD_ADD\n color.xyz += lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;\n color.xyz += lightingResult.directSpecular * lightingResult.specularColorWithLighting;\n#else\n float lightmapCoef = 0.0;\n#if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n color.xyz += (\n mix(lightingResult.directDiffuse, lightingResult.lightmapColor, lightmapCoef) * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting)\n * lightingResult.shadow\n ;\n#else\n LightingIntermediateData lightingData;\n lightingData.NoL = -1.0;\n vec3 backLightingDiffuse, backLightingSpecular;\n CCSurfacesLightingInitializeColorWithLighting(backLightingDiffuse, backLightingSpecular, surfaceData, lightingData);\n CCSurfacesLightingCalculateColorWithLighting(backLightingDiffuse, backLightingSpecular, surfaceData, lightingData);\n color.xyz +=\n mix(lightingResult.directDiffuse, lightingResult.lightmapColor, lightmapCoef) * mix(backLightingDiffuse, lightingResult.diffuseColorWithLighting, lightingResult.shadow)\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.shadow\n ;\n#endif\n color.xyz += lightingResult.emissive;\n#endif\n return color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\nbool CCSurfacesDebugViewSurfaceData(inout vec4 color, in SurfacesMaterialData surfaceData)\n{\n bool enableMaterialAlpha = true;\n float scalar;\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(surfaceData.worldNormal * 0.5 + vec3(0.5), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSPARENCY)) && (cc_surfaceTransform.y != 3.0)))\n {\n scalar = surfaceData.baseColor.a;\n color = vec4(scalar, scalar, scalar, 1.0);\n enableMaterialAlpha = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_BASE_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(surfaceData.baseColor.rgb), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(CCSurfacesGetDiffuseColor(surfaceData)), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(CCSurfacesGetSpecularColor(surfaceData)), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY)) && (cc_surfaceTransform.y != 3.0)))\n {\n scalar = surfaceData.specular.a;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n return enableMaterialAlpha;\n}\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n void CCSurfacesLighting(inout LightingResult lightingResultAccumulated, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesInitializeLightingResult(lightingResultAccumulated);\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n LightingResult lightingResult;\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n lightingResultAccumulated.diffuseColorWithLighting = lightingResult.diffuseColorWithLighting;\n lightingResultAccumulated.specularColorWithLighting = lightingResult.specularColorWithLighting;\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 diff;\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData);\n lightingResultAccumulated.specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #endif\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 lightDirWithLength = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -normalize(cc_lightDir[i].xyz) : cc_lightPos[i].xyz - worldPos;\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n vec3 diffuseLighting, specularLighting;\n CCSurfacesLightingCalculateDirect(diffuseLighting, specularLighting, lightingData, cc_lightColor[i]);\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n vec3 fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n vec3 fresnel = vec3(1.0);\n #endif\n lightingResult.fresnel = fresnel;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_lightPos[i].w > 0.0 && cc_lightSizeRangeAngle[i].w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n shadow = CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec3 shadowNDCPos;\n bool isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Perspective(shadowNDCPos.z, shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Perspective(SampleShadowMapSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy), shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n #endif\n }\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n shadow = 1.0;\n #endif\n lightingResult.shadow = shadow;\n float distAtt = 1.0;\n if(IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n distAtt = GetOutOfRange(worldPos, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n distAtt = CCSurfacesLightingCalculateDistanceAttenuation(lightingData, cc_lightSizeRangeAngle[i], cc_lightPos[i].w);\n }\n float angleAtt = 1.0;\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n angleAtt = CCSurfacesLightingCalculateAngleAttenuation(lightingData, cc_lightSizeRangeAngle[i], -cc_lightDir[i].xyz);\n }\n float multiplier = distAtt * angleAtt;\n lightingData.angleAttenuation = angleAtt;\n lightingData.distAttenuation = distAtt;\n lightingResult.directDiffuse = diffuseLighting * multiplier;\n lightingResult.directSpecular = specularLighting * multiplier;\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, vec3(1.0));\n vec4 attenuatedLightColorAndIntensity = vec4(cc_lightColor[i].xyz, cc_lightColor[i].w * multiplier);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 transmitSpecularLighting;\n CCSurfacesLightingCalculateDirectTransmitSpecular(transmitSpecularLighting, lightingData, attenuatedLightColorAndIntensity);\n lightingResult.directTransmitSpecular = transmitSpecularLighting * multiplier * (1.0 - fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, attenuatedLightColorAndIntensity, lightingResult.shadow);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData, lightDirWithLength);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, vec3(1.0));\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n lightingResult.direct2ndSpecular *= multiplier;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, attenuatedLightColorAndIntensity);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = cc_lightPos[i].w;\n miscData.lightPos = cc_lightPos[i].xyz;\n miscData.lightDir = cc_lightDir[i].xyz;\n miscData.lightColorAndIntensity = cc_lightColor[i];\n miscData.lightSizeRangeAngle = cc_lightSizeRangeAngle[i];\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n CCSurfacesAccumulateLightingResult(lightingResultAccumulated, lightingResult);\n }\n }\n #else\n void CCSurfacesLighting(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n CCSurfacesInitializeLightingResult(lightingResult, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, -cc_mainLitDir.xyz);\n lightingResult.shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_mainLitDir.w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n vec4 shadowProjDepthInfo = vec4(0.0);\n vec3 shadowNDCPos;\n bool isExceedShadowMap = true;\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n lightingResult.shadow = CCCSMFactorBase(worldPos, lightingData.N, shadowBias);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec4 shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n isExceedShadowMap = 0 > CCGetCSMLevel(shadowPosWithDepthBias, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n lightingResult.shadow = CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, lightingData.N, shadowBias);\n shadowProjDepthInfo = cc_shadowProjDepthInfo;\n isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowNDCPos.z, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Orthgraphic(SampleShadowMapSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy), shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n #endif\n }\n #endif\n lightingResult.lightmapColor = vec3(0.0);\n #if CC_SURFACES_USE_LIGHT_MAP && !CC_FORWARD_ADD\n float lightmapShadow, lightmapAO;\n GetLightMapColor(lightingResult.lightmapColor, lightmapShadow, lightmapAO, cc_lightingMap, FSInput_lightMapUV.xy, FSInput_lightMapUV.z, surfaceData.worldNormal);\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n lightingResult.shadow *= lightmapShadow;\n #endif\n lightingResult.ao *= lightmapAO;\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n #endif\n vec3 unused;\n CCSurfacesLightingCalculateEnvironment(lightingResult.environmentDiffuse, lightingResult.environmentSpecular, lightingData, cc_ambientSky.w);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF, unused, lightingData, lightingResult.specularColorWithLighting);\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n #if !CC_DISABLE_DIRECTIONAL_LIGHT && !CC_FORWARD_ADD\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateDirect(lightingResult.directDiffuse, lightingResult.directSpecular, lightingData, cc_mainLitColor);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, lightingResult.environmentGF);\n #endif\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n lightingResult.fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n lightingResult.fresnel = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n CCSurfacesLightingCalculateDirectTransmitSpecular(lightingResult.directTransmitSpecular, lightingData, cc_mainLitColor);\n CCSurfacesLightingCalculateEnvironmentTransmitSpecular(lightingResult.environmentTransmitSpecular, lightingData, cc_ambientSky.w);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, -cc_mainLitDir.xyz);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, cc_mainLitColor, lightingResult.shadow);\n CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(lightingResult.environmentTransmitDiffuse, lightingDataTD, cc_ambientSky.w, lightingResult.ao, -cc_mainLitDir.xyz);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData2ndSpecular, -cc_mainLitDir.xyz);\n vec3 diff;\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData2ndSpecular);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateEnvironment2ndSpecular(lightingResult.environment2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.environmentSpecular);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF2ndSpecular, lightingResult.environmentSubLayerF, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular);\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, lightingResult.environmentGF2ndSpecular);\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentSheen(lightingResult.environment2ndSpecular, lightingResult.environmentGF2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, cc_mainLitColor);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = LIGHT_TYPE_DIRECTIONAL;\n miscData.lightPos = vec3(0.0);\n miscData.lightDir = cc_mainLitDir.xyz;\n miscData.lightColorAndIntensity = cc_mainLitColor;\n miscData.lightSizeRangeAngle = vec4(0.0, 0.0, 0.0, 0.0);\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING\n #endif\n #endif\n#endif\nvec4 CCSurfacesDebugDisplayInvalidNumber(vec4 color)\n{\n float index = mod(cc_time.x * 10.0, 2.0);\n vec4 error = index < 1.0 ? vec4(1.0, 0.0, 0.2, 1.0) : vec4(0.0, 1.0, 0.2, 1.0);\n return (isnans(color.rgb) || isinfs(color.rgb)) ? error : color;\n}\nvec4 CCSurfacesDebugDisplayInvalidInputData(vec4 color, vec3 data)\n{\n float index = mod(cc_time.x * 10.0, 2.0);\n vec4 error = index < 1.0 ? vec4(1.0, 0.0, 0.2, 1.0) : vec4(0.0, 1.0, 0.2, 1.0);\n return (isnans(data) || isinfs(data)) ? error : color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && !CC_FORWARD_ADD\n void CCSurfacesDebugViewMeshData(inout vec4 color)\n {\n vec4 white = vec4(1.0, 1.0, 1.0, 1.0);\n vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_VERTEX_COLOR\n color = FSInput_vertexColor;\n #else\n color = white;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_worldNormal * 0.5 + vec3(0.5), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = vec4(FSInput_worldTangent * 0.5 + vec3(0.5), 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n float sign = FSInput_mirrorNormal * 0.5 + 0.5;\n color = vec4(sign, sign, sign, 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FACE_SIDE)) && (cc_surfaceTransform.y != 3.0)))\n {\n float scalar = clamp(FSInput_faceSideSign, 0.0, 1.0);\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UV0)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_texcoord.xy, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UV1)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_texcoord1.xy, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n color = vec4(FSInput_lightMapUV.xy, 0.0, 1.0);\n #else\n color = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH)) && (cc_surfaceTransform.y != 3.0)))\n {\n vec4 clipPos = cc_matProj * cc_matView * vec4(FSInput_worldPos.xyz, 1.0);\n float depth = clipPos.z / clipPos.w;\n color = vec4(depth, depth, depth, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH)) && (cc_surfaceTransform.y != 3.0)))\n {\n vec4 viewPos = cc_matView * vec4(FSInput_worldPos.xyz, 1.0);\n float depth = (-viewPos.z - cc_nearFar.x) / cc_nearFar.y;\n color = vec4(depth, depth, depth, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_WORLD_POS)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_worldPos.xyz, 1.0);\n }\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n bool CCSurfacesDebugViewLightingResult(inout vec4 color, in LightingResult lightingResult)\n {\n bool isSRGBColor = false;\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_LIGHT_MAP)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.lightmapColor;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_EMISSIVE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.emissive;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_AO)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(lightingResult.ao);\n isSRGBColor = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SHADOW)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(lightingResult.shadow);\n isSRGBColor = false;\n }\n vec3 fresnel = lightingResult.fresnel;\n vec3 directTransmitSpecular = vec3(0.0), environmentTransmitSpecular = vec3(0.0);\n vec3 directTransmitDiffuse = vec3(0.0), environmentTransmitDiffuse = vec3(0.0);\n vec3 diffuseColorWithLightingTT = vec3(0.0), specularColorWithLighting2ndSpecular = vec3(0.0);\n vec3 direct2ndSpecular = vec3(0.0), environment2ndSpecular = vec3(0.0);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n directTransmitSpecular = lightingResult.directTransmitSpecular;\n environmentTransmitSpecular = lightingResult.environmentTransmitSpecular;\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n directTransmitDiffuse = lightingResult.directTransmitDiffuse;\n environmentTransmitDiffuse = lightingResult.environmentTransmitDiffuse;\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n direct2ndSpecular = lightingResult.direct2ndSpecular * lightingResult.directGF2ndSpecular;\n environment2ndSpecular = lightingResult.environment2ndSpecular * lightingResult.environmentGF2ndSpecular;\n specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n fresnel = lightingResult.environmentSubLayerF;\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n direct2ndSpecular = lightingResult.directSpecularSubLayers;\n environment2ndSpecular = lightingResult.environmentSpecularSubLayers;\n #endif\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRESNEL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(fresnel);\n isSRGBColor = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environmentTransmitSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environmentTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitSpecular + environmentTransmitSpecular + directTransmitDiffuse + environmentTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = direct2ndSpecular * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environment2ndSpecular * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = (direct2ndSpecular + environment2ndSpecular) * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n return isSRGBColor;\n }\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n void CCSurfacesDebugViewCompositeLightingResult(inout LightingResult lightingResult)\n {\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE)\n lightingResult.directDiffuse = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR)\n lightingResult.directSpecular = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE)\n lightingResult.environmentDiffuse = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR)\n lightingResult.environmentSpecular = vec3(0.0);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE)\n lightingResult.directTransmitDiffuse = lightingResult.environmentTransmitDiffuse = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR)\n lightingResult.directTransmitSpecular = lightingResult.environmentTransmitSpecular = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR)\n lightingResult.direct2ndSpecular = lightingResult.environment2ndSpecular = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_TT\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT)\n lightingResult.directTT = vec3(0.0);\n #endif\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE)\n lightingResult.emissive = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP)\n lightingResult.lightmapColor = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL)\n lightingResult.fresnel = vec3(1.0);\n }\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n layout(location = 0) out vec4 fragColorX;\n void main() {\n #if CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER\n float NoL = dot(-cc_mainLitDir.xyz, FSInput_worldNormal.xyz);\n vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();\n float fogFactor = 1.0;\n #if CC_FORWARD_ADD\n color.rgb = vec3(0.0);\n #endif\n #else\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n vec2 shadowBias = vec2(0.0);\n vec3 colDebugCSMLayer = vec3(1.0);\n #if CC_RECEIVE_SHADOW\n shadowBias = FSInput_shadowBias;\n #if !CC_FORWARD_ADD\n #if CC_USE_DEBUG_VIEW && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION)\n {\n vec4 csmPos;\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int csmLayer = -1;\n csmLayer = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, surfaceData.worldPos);\n bool OutOfRange = csmLayer < 0;\n if (OutOfRange)\n colDebugCSMLayer = vec3(1.0);\n else if (csmLayer == 0)\n colDebugCSMLayer = vec3(1.0, 0.0, 0.0);\n else if (csmLayer == 1)\n colDebugCSMLayer = vec3(0.0, 1.0, 0.0);\n else if (csmLayer == 2)\n colDebugCSMLayer = vec3(0.0, 0.0, 1.0);\n else if (csmLayer == 3)\n colDebugCSMLayer = vec3(0.0, 1.0, 1.0);\n }\n #endif\n #endif\n #endif\n float fogFactor = 1.0;\n #if !CC_FORWARD_ADD\n #if CC_USE_FOG != 4\n #if !CC_USE_ACCURATE_FOG\n fogFactor = FSInput_fogFactor;\n #else\n CC_TRANSFER_FOG_BASE(vec4(FSInput_worldPos, 1.0), fogFactor);\n #endif\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG) {\n fogFactor = 1.0;\n }\n #endif\n #endif\n LightingResult lightingResult;\n CCSurfacesLighting(lightingResult, surfaceData, shadowBias);\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && CC_SURFACES_ENABLE_DEBUG_VIEW\n vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);\n float materialTransparency = CCSurfacesShading(surfaceData, lightingResult).a;\n #if !CC_FORWARD_ADD && !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n CCSurfacesDebugViewMeshData(debugColor);\n if (CCSurfacesDebugViewSurfaceData(debugColor, surfaceData))\n {\n debugColor.a = materialTransparency;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FOG)) && (cc_surfaceTransform.y != 3.0)))\n {\n debugColor.rgb = vec3(1.0 - fogFactor);\n }\n #endif\n #if CC_FORWARD_ADD\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)) && (cc_surfaceTransform.y != 3.0)) ||\n (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n #endif\n {\n if (CCSurfacesDebugViewLightingResult(debugColor, lightingResult))\n {\n debugColor.a = materialTransparency;\n #if !CC_USE_FLOAT_OUTPUT\n debugColor.rgb = HDRToLDR(debugColor.rgb);\n debugColor.rgb = LinearToSRGB(debugColor.rgb);\n #endif\n }\n }\n if (IS_DEBUG_VIEW_ENABLE_WITH_CAMERA) {\n fragColorX = debugColor;\n return;\n }\n #elif CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n CCSurfacesDebugViewCompositeLightingResult(lightingResult);\n #endif\n vec4 color = CCSurfacesShading(surfaceData, lightingResult);\n #if CC_USE_DEBUG_VIEW && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION) {\n color.rgb *= colDebugCSMLayer.rgb;\n }\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = CCSurfacesDebugDisplayInvalidInputData(color, FSInput_worldTangent);\n #endif\n #endif\n #endif\n #if CC_USE_FOG != 4 && (!CC_USE_FLOAT_OUTPUT || CC_IS_TRANSPARENCY_PASS)\n #if !CC_FORWARD_ADD\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FOG\n color.rgb = CCSurfacesLightingModifyFog(fogFactor, color.rgb, surfaceData, lightingResult);\n #else\n CC_APPLY_FOG_BASE(color, fogFactor);\n #endif\n #endif\n #endif\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #else\n color = CCSurfacesDebugDisplayInvalidNumber(color);\n #if !CC_USE_FLOAT_OUTPUT || CC_IS_TRANSPARENCY_PASS\n color.rgb = HDRToLDR(color.rgb);\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n #endif\n fragColorX = color;\n }\n#elif CC_PIPELINE_TYPE == 1\n layout(location = 0) out vec4 albedoOut;\n layout(location = 1) out vec4 emissiveOut;\n layout(location = 2) out vec4 normalOut;\n void main () {\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n albedoOut = CCSurfacesDeferredOutputBaseColor(surfaceData);\n normalOut = CCSurfacesDeferredOutputNormalMR(surfaceData);\n emissiveOut = CCSurfacesDeferredOutputEmissiveAO(surfaceData);\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && CC_SURFACES_ENABLE_DEBUG_VIEW\n vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);\n CCSurfacesDebugViewMeshData(debugColor);\n CCSurfacesDebugViewSurfaceData(debugColor, surfaceData);\n if (IS_DEBUG_VIEW_ENABLE_WITH_CAMERA) {\n albedoOut = debugColor;\n }\n #endif\n }\n#endif"
  4102. },
  4103. "glsl1": {
  4104. "vert": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n attribute vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n attribute vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_shadowLPNNInfo;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n uniform highp vec4 cc_lightingMapUVParam;\n uniform highp vec4 cc_localShadowBias;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n#endif\n uniform vec4 tilingOffset;\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\nvec3 SurfacesVertexModifyLocalNormal(in SurfacesStandardVertexIntermediate In)\n{\n return In.normal.xyz;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec4 SurfacesVertexModifyLocalTangent(in SurfacesStandardVertexIntermediate In)\n {\n return In.tangent;\n }\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\nvec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)\n{\n vec3 worldNormal = In.worldNormal.xyz;\n #if CC_SURFACES_USE_TWO_SIDED\n worldNormal.xyz *= In.worldNormal.w;\n #endif\n return worldNormal;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);\n#endif\n}\nvoid CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId = vec4(0.0);\n #endif\n #if CC_RECEIVE_SHADOW\n In.shadowBiasAndProbeId.xy = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.xy += a_localShadowBiasAndProbeId.xy;\n #else\n In.shadowBiasAndProbeId.xy += cc_localShadowBias.xy;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n In.shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #if USE_INSTANCING\n In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n In.lightmapUV.z = a_lightingMapUVParam.w;\n #else\n In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n In.lightmapUV.z = cc_lightingMapUVParam.w;\n #endif\n#endif\n}\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n In.normal.xyz = SurfacesVertexModifyLocalNormal(In);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = SurfacesVertexModifyLocalTangent(In);\n #endif\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);\n In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;\n In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexTransferFog(In);\n CCSurfacesVertexTransferLightMapUV(In);\n CCSurfacesVertexTransferShadow(In);\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);\n #endif\n CCSurfacesVertexOutput(In);\n}",
  4105. "frag": "\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers: enable\n#endif\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nuniform highp vec4 cc_time;\n uniform mediump vec4 cc_debug_view_mode;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_surfaceTransform;\n uniform mediump vec4 cc_exposure;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_mainLitColor;\n uniform mediump vec4 cc_ambientSky;\n uniform mediump vec4 cc_fogColor;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n uniform mediump vec4 cc_nearFar;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\nbool equalf_mode(float data1, float data2) { return abs(float(data1) - float(data2)) < 0.001; }\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n uniform highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n uniform vec4 cc_lightColor[LIGHTS_PER_PASS];\n uniform vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n uniform vec4 cc_lightDir[LIGHTS_PER_PASS];\n uniform vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n #endif\n#endif\nuniform highp mat4 cc_matLightView;\n uniform highp mat4 cc_matLightViewProj;\n uniform highp vec4 cc_shadowInvProjDepthInfo;\n uniform highp vec4 cc_shadowProjDepthInfo;\n uniform highp vec4 cc_shadowProjInfo;\n uniform mediump vec4 cc_shadowNFLSInfo;\n uniform mediump vec4 cc_shadowWHPBInfo;\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n uniform highp vec4 cc_csmViewDir0[4];\n uniform highp vec4 cc_csmViewDir1[4];\n uniform highp vec4 cc_csmViewDir2[4];\n uniform highp vec4 cc_csmAtlas[4];\n uniform highp mat4 cc_matCSMViewProj[4];\n uniform highp vec4 cc_csmProjDepthInfo[4];\n uniform highp vec4 cc_csmProjInfo[4];\n uniform highp vec4 cc_csmSplitsInfo;\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nhighp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nbool isnan(float val) {\n return (val < 0.0 || 0.0 < val || val == 0.0) ? false : true;\n}\nbool isinf(float x) {\n return x == x * 2.0 && x != 0.0;\n}\nbool isnans(vec2 val) {\n return isnan(val.x) || isnan(val.y);\n}\nbool isnans(vec3 val) {\n return isnan(val.x) || isnan(val.y) || isnan(val.z);\n}\nbool isnans(vec4 val) {\n return isnan(val.x) || isnan(val.y) || isnan(val.z) || isnan(val.w);\n}\nbool isinfs(vec2 val) {\n return isinf(val.x) || isinf(val.y);\n}\nbool isinfs(vec3 val) {\n return isinf(val.x) || isinf(val.y) || isinf(val.z);\n}\nbool isinfs(vec4 val) {\n return isinf(val.x) || isinf(val.y) || isinf(val.z) || isinf(val.w);\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 CalculateBinormal(vec3 normal, vec3 tangent, float mirrorNormal)\n{\n return cross(normal, tangent) * mirrorNormal;\n}\nvec3 CalculateNormalFromTangentSpace(vec3 normalFromTangentSpace, float normalStrength, vec3 normal, vec3 tangent, float mirrorNormal)\n{\n vec3 binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n return (normalFromTangentSpace.x * normalStrength) * normalize(tangent) +\n (normalFromTangentSpace.y * normalStrength) * normalize(binormal) +\n normalFromTangentSpace.z * normalize(normal);\n}\nvec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n}\nvec2 float32x3_to_oct(in vec3 v) {\n vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));\n return (v.z <= 0.0) ? ((1.0 - abs(p.yx)) * signNotZero(p)) : p;\n}\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n float SampleShadowMap (vec3 shadowNDCPos, highp sampler2D shadowMap)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return dot(texture2D(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n #else\n return texture2D(shadowMap, shadowNDCPos.xy).x;\n #endif\n }\n float SampleShadowMapSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block1 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block2 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float block3 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(texture2D(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, texture2D(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture2D(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, texture2D(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(texture2D(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, texture2D(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, texture2D(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, texture2D(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, texture2D(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, texture2D(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, texture2D(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, texture2D(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, texture2D(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, texture2D(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, texture2D(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, texture2D(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, texture2D(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, texture2D(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, texture2D(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, texture2D(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, texture2D(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, texture2D(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, texture2D(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, texture2D(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, texture2D(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, texture2D(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, texture2D(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, texture2D(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, texture2D(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, texture2D(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n #endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture2D(lightingMap, luv);\n \tvec4 dataHigh = texture2D(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture2D(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n void GetLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n \tvec4 lightmap;\n \tvec2 occlusion;\n \tSampleAndDecodeLightMapColor(lightmapColor, dirShadow, ao, lightingMap, luv, lum, worldNormal);\n #if CC_USE_HDR\n lightmapColor.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n }\n#endif\n uniform vec4 baseColor;\n uniform vec4 colorScaleAndCutoff;\n uniform vec4 shadeColor1;\n uniform vec4 shadeColor2;\n uniform vec4 specular;\n uniform vec4 shadeParams;\n uniform vec4 miscParams;\n uniform vec4 emissive;\n uniform vec4 emissiveScaleAndStrenth;\n#if USE_BASE_COLOR_MAP\n uniform sampler2D baseColorMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_1ST_SHADE_MAP\n uniform sampler2D shadeMap1;\n#endif\n#if USE_2ND_SHADE_MAP\n uniform sampler2D shadeMap2;\n#endif\n#if USE_SPECULAR_MAP\n uniform sampler2D specularMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\nvoid SurfacesFragmentModifyBaseColorAndToonShade(out vec4 baseColorAndTransparency, out vec3 shade1, out vec3 shade2)\n{\n shade2 = shadeColor2.rgb * colorScaleAndCutoff.rgb;\n #if USE_2ND_SHADE_MAP\n shade2 *= SRGBToLinear(texture2D(shadeMap2, FSInput_texcoord).rgb);\n #endif\n shade1 = shadeColor1.rgb * colorScaleAndCutoff.rgb;\n #if USE_1ST_SHADE_MAP\n shade1 *= SRGBToLinear(texture2D(shadeMap1, FSInput_texcoord).rgb);\n #if SHADE_MAP_1_AS_SHADE_MAP_2\n shade2 *= shade1.rgb;\n #endif\n #endif\n vec4 color = baseColor;\n #if USE_BASE_COLOR_MAP\n vec4 texColor = texture2D(baseColorMap, FSInput_texcoord);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n color *= texColor;\n #if BASE_COLOR_MAP_AS_SHADE_MAP_1\n shade1 *= texColor.rgb;\n #endif\n #if BASE_COLOR_MAP_AS_SHADE_MAP_2\n shade2 *= texColor.rgb;\n #endif\n #endif\n baseColorAndTransparency = color;\n baseColorAndTransparency.rgb *= colorScaleAndCutoff.xyz;\n #if USE_ALPHA_TEST\n if (baseColorAndTransparency.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n vec3 normal = FSInput_worldNormal;\n #if USE_NORMAL_MAP\n vec3 nmmp = texture2D(normalMap, FSInput_texcoord).xyz - vec3(0.5);\n normal = CalculateNormalFromTangentSpace(nmmp, emissiveScaleAndStrenth.w, normalize(normal.xyz), normalize(FSInput_worldTangent), FSInput_mirrorNormal);\n #endif\n return normalize(normal);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n vec3 emissive = emissive.rgb * emissiveScaleAndStrenth.xyz;\n #if USE_EMISSIVE_MAP\n emissive *= SRGBToLinear(texture2D(emissiveMap, FSInput_texcoord).rgb);\n #endif\n return emissive;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\nvec4 SurfacesFragmentModifyToonStepAndFeather()\n{\n return shadeParams;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\nfloat SurfacesFragmentModifyToonShadowCover()\n{\n return miscParams.x;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nvec4 SurfacesFragmentModifyToonSpecular()\n{\n vec4 specularParam = specular;\n #if USE_SPECULAR_MAP\n specularParam.rgb *= SRGBToLinear(texture2D(specularMap, FSInput_texcoord).rgb);\n #endif\n return specularParam;\n}\nstruct LightingIntermediateData\n{\n vec3 N, H, L, V;\n float distToLight, distToLightSqr;\n float distToCamera, distToCameraSqr;\n float angleAttenuation, distAttenuation;\n float NoL, NoV, NoH, VoH;\n float NoLSat, NoVSat, NoHSat;\n float NoVAbsSat, VoHAbsSat;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPosition, worldPosition_fract_part;\n #else\n vec3 worldPosition;\n #endif\n vec3 T, B;\n float specularParam;\n float ior, layerOpacity;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 shadowPosAndDepth;\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitScatteringParams;\n vec3 outScatteringColor, inScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n};\nvoid CCSurfacesLightingGetIntermediateData_PerPixel(inout LightingIntermediateData data, vec3 worldNormal, vec3 worldPos, vec3 worldTangent, vec3 worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , float anisotropyShape\n#endif\n)\n{\n data.N = worldNormal;\n data.V = cc_cameraPos.xyz - worldPos;\n data.distToCameraSqr = dot(data.V, data.V);\n data.distToCamera = sqrt(data.distToCameraSqr);\n data.V /= data.distToCamera;\n data.angleAttenuation = data.distAttenuation = 1.0;\n data.NoV = dot(data.N, data.V);\n data.NoVSat = max(data.NoV, 0.0);\n data.NoVAbsSat = max(abs(data.NoV), 0.0);\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(data.worldPosition, data.worldPosition_fract_part, worldPos);\n #else\n data.worldPosition = worldPos;\n #endif\n data.T = worldTangent;\n data.B = worldBinormal;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n data.anisotropyShape = anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.outScatteringColor = vec3(1.0);\n data.inScatteringColor = vec3(0.0);\n data.transmitScatteringParams = vec4(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.shadowPosAndDepth = vec4(0.0, 0.0, SURFACES_MAX_TRANSMIT_DEPTH_VALUE, SURFACES_MAX_TRANSMIT_DEPTH_VALUE);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n data.baseColorTT = vec3(0.0);\n data.ttIntensity = data.ttScatterCoef = 0.0;\n#endif\n}\nvoid CCSurfacesLightingGetIntermediateData_PerLight(inout LightingIntermediateData data, vec3 lightDirWithDist)\n{\n data.L = lightDirWithDist;\n data.distToLightSqr = dot(data.L, data.L);\n data.distToLight = sqrt(data.distToLightSqr);\n data.L /= data.distToLight;\n data.H = normalize(data.L + data.V);\n data.NoL = dot(data.N, data.L);\n data.NoH = dot(data.N, data.H);\n data.VoH = dot(data.V, data.H);\n data.NoLSat = max(data.NoL, 0.0);\n data.NoHSat = max(data.NoH, 0.0);\n data.VoHAbsSat = max(abs(data.VoH), 0.0);\n}\nstruct LightingResult\n{\n vec3 diffuseColorWithLighting, specularColorWithLighting;\n vec3 directDiffuse, directSpecular, directGF;\n vec3 environmentDiffuse, environmentSpecular, environmentGF;\n float shadow, ao;\n vec3 lightmapColor;\n vec3 emissive;\n vec3 fresnel;\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n vec3 directDiffuseSubLayers, directSpecularSubLayers;\n vec3 environmentDiffuseSubLayers, environmentSpecularSubLayers;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 directTransmitSpecular, environmentTransmitSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 directTransmitDiffuse, environmentTransmitDiffuse;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 direct2ndSpecular, environment2ndSpecular;\n vec3 specularColorWithLighting2ndSpecular;\n vec3 directGF2ndSpecular, environmentGF2ndSpecular;\n vec3 directSubLayerF, environmentSubLayerF;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 directTT;\n vec3 diffuseColorWithLightingTT;\n#endif\n};\nstruct LightingMiscData\n{\n float lightType;\n vec3 lightPos, lightDir;\n vec4 lightColorAndIntensity;\n vec4 lightSizeRangeAngle;\n};\n#define DiffuseCoefficient_EnergyConservation INV_PI\nfloat SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n}\nfloat GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n}\nfloat GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n}\nfloat GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n}\nfloat CalculateDistanceAttenuation(float distToLightSqr, float lightRadius, float lightRange, float lightType)\n{\n float attRadiusSqrInv = 1.0 / max(lightRange, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float litRadiusSqr = lightRadius * lightRadius;\n float edgeAttenuation = (IS_POINT_LIGHT(lightType) || IS_RANGED_DIRECTIONAL_LIGHT(lightType)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distToLightSqr);\n return GetDistAtt(distToLightSqr, attRadiusSqrInv) * edgeAttenuation;\n}\nfloat CalculateAngleAttenuation(vec3 spotLightDir, vec3 L, float cosAngleOuter)\n{\n float cosInner = max(dot(spotLightDir, L), 0.01);\n float litAngleScale = 1.0 / max(0.001, cosInner - cosAngleOuter);\n float litAngleOffset = -cosAngleOuter * litAngleScale;\n return GetAngleAtt(L, spotLightDir, litAngleScale, litAngleOffset);\n}\nbool CCSurfacesLightingEnableShadow(in float NoL)\n{\n return NoL > 0.0;\n}\nfloat CCSurfacesLightingCalculateDistanceAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in float lightType)\n{\n return CalculateDistanceAttenuation(lightingData.distToLightSqr, lightSizeRangeAngle.x, lightSizeRangeAngle.y, lightType);\n}\nfloat CCSurfacesLightingCalculateAngleAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in vec3 spotLightDir)\n{\n return CalculateAngleAttenuation(spotLightDir, lightingData.L, lightSizeRangeAngle.z);\n}\nvoid CCSurfacesLightingCalculateDirect(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n lightingDiffuse = irradiance;\n#if CC_FORWARD_ADD\n float NL = 0.5 * lightingData.NoL + 0.5;\n lightingDiffuse *= NL;\n#endif\n float NH = 0.5 * lightingData.NoH + 0.5;\n float specularWeight = 1.0 - pow(lightingData.specularParam, 5.0);\n float specularMask = step(specularWeight + EPSILON_LOWP, NH);\n lightingSpecular = irradiance * specularMask;\n}\nvoid CCSurfacesLightingCalculateEnvironment(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n{\n lightingDiffuse = vec3(0.0);\n lightingSpecular = vec3(0.0);\n}\n#if CC_SURFACES_LIGHTING_USE_FRESNEL\nvec3 CCSurfaceLightingCalculateExtraFresnel(in LightingIntermediateData lightingData)\n{\n return vec3(1.0);\n}\n#endif\nvoid CCSurfaceLightingCalculateDirectFresnel(out vec3 fresnel, in LightingIntermediateData lightingData, vec3 specularColor, in vec3 environmentGF)\n{\n fresnel = vec3(1.0);\n}\nvoid CCSurfaceLightingCalculateEnvironmentFresnel(out vec3 integratedGF, out vec3 integratedF, in LightingIntermediateData lightingData, vec3 specularColor)\n{\n integratedF = integratedGF = vec3(1.0);\n}\nstruct SurfacesMaterialData\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPos, worldPos_fract_part;\n #else\n vec3 worldPos;\n #endif\n vec4 baseColor;\n vec4 specular;\n vec3 worldNormal;\n vec3 emissive;\n vec3 shade1;\n vec3 shade2;\n float baseStep;\n float baseFeather;\n float shadeStep;\n float shadeFeather;\n float shadowCover;\n};\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n return FSInput_vertexColor;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_TANGENT_AND_BINORMAL\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_IOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n return vec3(0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_SCATTERING_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_IN_SCATTERING_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_OUT_SCATTERING_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_DIFFUSE_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SSS_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_DUAL_LOBE_SPECULAR_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_PARAMS\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_COLOR\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHARED_DATA\nvoid SurfacesFragmentModifySharedData(inout SurfacesMaterialData surfaceData)\n{\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\nvoid SurfacesFragmentModifyBaseColorAndToonShade(out vec4 baseColorAndTransparency, out vec3 shade1, out vec3 shade2, in vec3 baseColor)\n{\n baseColorAndTransparency = FSInput_vertexColor;\n shade1 = shade2 = vec3(0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\nvec4 SurfacesFragmentModifyToonStepAndFeather()\n{\n return vec3(0.8, 0.001, 0.5, 0.001);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\nfloat SurfacesFragmentModifyToonShadowCover()\n{\n return 0.5;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nvec4 SurfacesFragmentModifyToonSpecular()\n{\n return vec4(1.0, 1.0, 1.0, 0.3);\n}\n#endif\nvoid CCSurfacesFragmentGetMaterialData(inout SurfacesMaterialData surfaceData)\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part, FSInput_worldPos);\n #else\n surfaceData.worldPos = FSInput_worldPos;\n #endif\n surfaceData.worldNormal = SurfacesFragmentModifyWorldNormal();\n surfaceData.emissive = SurfacesFragmentModifyEmissive();\n SurfacesFragmentModifyBaseColorAndToonShade(surfaceData.baseColor, surfaceData.shade1, surfaceData.shade2);\n surfaceData.specular = SurfacesFragmentModifyToonSpecular();\n surfaceData.shadowCover = SurfacesFragmentModifyToonShadowCover();\n vec4 shaderParams = SurfacesFragmentModifyToonStepAndFeather();\n surfaceData.baseStep = shadeParams.x;\n surfaceData.baseFeather = shadeParams.y;\n surfaceData.shadeStep = shadeParams.z;\n surfaceData.shadeFeather = shadeParams.w;\n SurfacesFragmentModifySharedData(surfaceData);\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP)\n surfaceData.worldNormal = normalize(FSInput_worldNormal);\n#endif\n#if CC_USE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO) {\n float brightBase = dot(GRAY_VECTOR, surfaceData.baseColor.rgb);\n float brightShade1 = dot(GRAY_VECTOR, surfaceData.shade1.rgb);\n float brightShade2 = dot(GRAY_VECTOR, surfaceData.shade2.rgb);\n surfaceData.baseColor.rgb = vec3(1.0);\n surfaceData.shade1.rgb = vec3(brightShade1 / brightBase);\n surfaceData.shade2.rgb = vec3(brightShade2 / brightBase);\n surfaceData.specular.rgb = vec3(1.0);\n }\n#endif\n}\nvec3 CCSurfacesGetDiffuseColor(in SurfacesMaterialData surfaceData)\n{\n return surfaceData.shade1;\n}\nvec3 CCSurfacesGetSpecularColor(in SurfacesMaterialData surfaceData)\n{\n return surfaceData.specular.xyz;\n}\nvoid CCSurfacesLightingInitializeColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n diffuseColorWithLighting = vec3(0.0);\n specularColorWithLighting = surfaceData.specular.xyz * surfaceData.baseStep;\n}\nvoid CCSurfacesLightingCalculateColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n float NL = 0.5 * lightingData.NoL + 0.5;\n vec3 diffuse = mix(surfaceData.shade1, surfaceData.shade2,\n clamp(1.0 + (surfaceData.shadeStep - surfaceData.shadeFeather - NL) / surfaceData.shadeFeather, 0.0, 1.0));\n diffuse = mix(surfaceData.baseColor.rgb, diffuse,\n clamp(1.0 + (surfaceData.baseStep - surfaceData.baseFeather - NL) / surfaceData.baseFeather, 0.0, 1.0));\n diffuseColorWithLighting = diffuse * surfaceData.baseStep;\n}\nvoid CCSurfacesInitializeLightingIntermediateData(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesLightingGetIntermediateData_PerPixel(lightingData, surfaceData.worldNormal, worldPos, vec3(0.0), vec3(0.0));\n lightingData.specularParam = surfaceData.specular.a;\n lightingData.ior = 1.0;\n}\nvoid CCSurfacesLightingCalculateIntermediateData_PerLight(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData, vec3 lightDirWithDist)\n{\n CCSurfacesLightingGetIntermediateData_PerLight(lightingData, lightDirWithDist);\n}\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData)\n{\n lightingResult.emissive = surfaceData.emissive;\n}\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult)\n{\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n}\nvoid CCSurfacesAccumulateLightingResult(inout LightingResult lightingResultAccumulated, in LightingResult lightingResult)\n{\n lightingResultAccumulated.directDiffuse += lightingResult.directDiffuse * lightingResult.shadow;\n lightingResultAccumulated.directSpecular += lightingResult.directSpecular * lightingResult.shadow;\n}\n#if CC_PIPELINE_TYPE == 1\n vec4 CCSurfacesDeferredOutputBaseColor(in SurfacesMaterialData surfaceData)\n {\n return surfaceData.baseColor;\n }\n vec4 CCSurfacesDeferredOutputNormalMR(in SurfacesMaterialData surfaceData)\n {\n return vec4(float32x3_to_oct(surfaceData.worldNormal), 0.5, 0.0);\n }\n vec4 CCSurfacesDeferredOutputEmissiveAO(in SurfacesMaterialData surfaceData)\n {\n return vec4(surfaceData.emissive, 1.0);\n }\n#endif\nvec4 CCSurfacesShading(in SurfacesMaterialData surfaceData, in LightingResult lightingResult)\n{\n vec4 color = vec4(0.0, 0.0, 0.0, surfaceData.baseColor.a);\n#if CC_FORWARD_ADD\n color.xyz += lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;\n color.xyz += lightingResult.directSpecular * lightingResult.specularColorWithLighting;\n#else\n float lightmapCoef = 0.0;\n#if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n color.xyz += (\n mix(lightingResult.directDiffuse, lightingResult.lightmapColor, lightmapCoef) * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting)\n * lightingResult.shadow\n ;\n#else\n LightingIntermediateData lightingData;\n lightingData.NoL = -1.0;\n vec3 backLightingDiffuse, backLightingSpecular;\n CCSurfacesLightingInitializeColorWithLighting(backLightingDiffuse, backLightingSpecular, surfaceData, lightingData);\n CCSurfacesLightingCalculateColorWithLighting(backLightingDiffuse, backLightingSpecular, surfaceData, lightingData);\n color.xyz +=\n mix(lightingResult.directDiffuse, lightingResult.lightmapColor, lightmapCoef) * mix(backLightingDiffuse, lightingResult.diffuseColorWithLighting, lightingResult.shadow)\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.shadow\n ;\n#endif\n color.xyz += lightingResult.emissive;\n#endif\n return color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\nbool CCSurfacesDebugViewSurfaceData(inout vec4 color, in SurfacesMaterialData surfaceData)\n{\n bool enableMaterialAlpha = true;\n float scalar;\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(surfaceData.worldNormal * 0.5 + vec3(0.5), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSPARENCY)) && (cc_surfaceTransform.y != 3.0)))\n {\n scalar = surfaceData.baseColor.a;\n color = vec4(scalar, scalar, scalar, 1.0);\n enableMaterialAlpha = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_BASE_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(surfaceData.baseColor.rgb), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(CCSurfacesGetDiffuseColor(surfaceData)), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(CCSurfacesGetSpecularColor(surfaceData)), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY)) && (cc_surfaceTransform.y != 3.0)))\n {\n scalar = surfaceData.specular.a;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n return enableMaterialAlpha;\n}\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n void CCSurfacesLighting(inout LightingResult lightingResultAccumulated, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesInitializeLightingResult(lightingResultAccumulated);\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n LightingResult lightingResult;\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n lightingResultAccumulated.diffuseColorWithLighting = lightingResult.diffuseColorWithLighting;\n lightingResultAccumulated.specularColorWithLighting = lightingResult.specularColorWithLighting;\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 diff;\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData);\n lightingResultAccumulated.specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #endif\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 lightDirWithLength = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -normalize(cc_lightDir[i].xyz) : cc_lightPos[i].xyz - worldPos;\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n vec3 diffuseLighting, specularLighting;\n CCSurfacesLightingCalculateDirect(diffuseLighting, specularLighting, lightingData, cc_lightColor[i]);\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n vec3 fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n vec3 fresnel = vec3(1.0);\n #endif\n lightingResult.fresnel = fresnel;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_lightPos[i].w > 0.0 && cc_lightSizeRangeAngle[i].w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n shadow = CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec3 shadowNDCPos;\n bool isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Perspective(shadowNDCPos.z, shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Perspective(SampleShadowMapSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy), shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n #endif\n }\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n shadow = 1.0;\n #endif\n lightingResult.shadow = shadow;\n float distAtt = 1.0;\n if(IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n distAtt = GetOutOfRange(worldPos, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n distAtt = CCSurfacesLightingCalculateDistanceAttenuation(lightingData, cc_lightSizeRangeAngle[i], cc_lightPos[i].w);\n }\n float angleAtt = 1.0;\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n angleAtt = CCSurfacesLightingCalculateAngleAttenuation(lightingData, cc_lightSizeRangeAngle[i], -cc_lightDir[i].xyz);\n }\n float multiplier = distAtt * angleAtt;\n lightingData.angleAttenuation = angleAtt;\n lightingData.distAttenuation = distAtt;\n lightingResult.directDiffuse = diffuseLighting * multiplier;\n lightingResult.directSpecular = specularLighting * multiplier;\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, vec3(1.0));\n vec4 attenuatedLightColorAndIntensity = vec4(cc_lightColor[i].xyz, cc_lightColor[i].w * multiplier);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 transmitSpecularLighting;\n CCSurfacesLightingCalculateDirectTransmitSpecular(transmitSpecularLighting, lightingData, attenuatedLightColorAndIntensity);\n lightingResult.directTransmitSpecular = transmitSpecularLighting * multiplier * (1.0 - fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, attenuatedLightColorAndIntensity, lightingResult.shadow);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData, lightDirWithLength);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, vec3(1.0));\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n lightingResult.direct2ndSpecular *= multiplier;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, attenuatedLightColorAndIntensity);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = cc_lightPos[i].w;\n miscData.lightPos = cc_lightPos[i].xyz;\n miscData.lightDir = cc_lightDir[i].xyz;\n miscData.lightColorAndIntensity = cc_lightColor[i];\n miscData.lightSizeRangeAngle = cc_lightSizeRangeAngle[i];\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n CCSurfacesAccumulateLightingResult(lightingResultAccumulated, lightingResult);\n }\n }\n #else\n void CCSurfacesLighting(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n CCSurfacesInitializeLightingResult(lightingResult, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, -cc_mainLitDir.xyz);\n lightingResult.shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_mainLitDir.w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n vec4 shadowProjDepthInfo = vec4(0.0);\n vec3 shadowNDCPos;\n bool isExceedShadowMap = true;\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n lightingResult.shadow = CCCSMFactorBase(worldPos, lightingData.N, shadowBias);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec4 shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n isExceedShadowMap = 0 > CCGetCSMLevel(shadowPosWithDepthBias, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n lightingResult.shadow = CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, lightingData.N, shadowBias);\n shadowProjDepthInfo = cc_shadowProjDepthInfo;\n isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowNDCPos.z, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Orthgraphic(SampleShadowMapSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy), shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n #endif\n }\n #endif\n lightingResult.lightmapColor = vec3(0.0);\n #if CC_SURFACES_USE_LIGHT_MAP && !CC_FORWARD_ADD\n float lightmapShadow, lightmapAO;\n GetLightMapColor(lightingResult.lightmapColor, lightmapShadow, lightmapAO, cc_lightingMap, FSInput_lightMapUV.xy, FSInput_lightMapUV.z, surfaceData.worldNormal);\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n lightingResult.shadow *= lightmapShadow;\n #endif\n lightingResult.ao *= lightmapAO;\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n #endif\n vec3 unused;\n CCSurfacesLightingCalculateEnvironment(lightingResult.environmentDiffuse, lightingResult.environmentSpecular, lightingData, cc_ambientSky.w);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF, unused, lightingData, lightingResult.specularColorWithLighting);\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n #if !CC_DISABLE_DIRECTIONAL_LIGHT && !CC_FORWARD_ADD\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateDirect(lightingResult.directDiffuse, lightingResult.directSpecular, lightingData, cc_mainLitColor);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, lightingResult.environmentGF);\n #endif\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n lightingResult.fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n lightingResult.fresnel = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n CCSurfacesLightingCalculateDirectTransmitSpecular(lightingResult.directTransmitSpecular, lightingData, cc_mainLitColor);\n CCSurfacesLightingCalculateEnvironmentTransmitSpecular(lightingResult.environmentTransmitSpecular, lightingData, cc_ambientSky.w);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, -cc_mainLitDir.xyz);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, cc_mainLitColor, lightingResult.shadow);\n CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(lightingResult.environmentTransmitDiffuse, lightingDataTD, cc_ambientSky.w, lightingResult.ao, -cc_mainLitDir.xyz);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData2ndSpecular, -cc_mainLitDir.xyz);\n vec3 diff;\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData2ndSpecular);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateEnvironment2ndSpecular(lightingResult.environment2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.environmentSpecular);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF2ndSpecular, lightingResult.environmentSubLayerF, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular);\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, lightingResult.environmentGF2ndSpecular);\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentSheen(lightingResult.environment2ndSpecular, lightingResult.environmentGF2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, cc_mainLitColor);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = LIGHT_TYPE_DIRECTIONAL;\n miscData.lightPos = vec3(0.0);\n miscData.lightDir = cc_mainLitDir.xyz;\n miscData.lightColorAndIntensity = cc_mainLitColor;\n miscData.lightSizeRangeAngle = vec4(0.0, 0.0, 0.0, 0.0);\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING\n #endif\n #endif\n#endif\nvec4 CCSurfacesDebugDisplayInvalidNumber(vec4 color)\n{\n float index = mod(cc_time.x * 10.0, 2.0);\n vec4 error = index < 1.0 ? vec4(1.0, 0.0, 0.2, 1.0) : vec4(0.0, 1.0, 0.2, 1.0);\n return (isnans(color.rgb) || isinfs(color.rgb)) ? error : color;\n}\nvec4 CCSurfacesDebugDisplayInvalidInputData(vec4 color, vec3 data)\n{\n float index = mod(cc_time.x * 10.0, 2.0);\n vec4 error = index < 1.0 ? vec4(1.0, 0.0, 0.2, 1.0) : vec4(0.0, 1.0, 0.2, 1.0);\n return (isnans(data) || isinfs(data)) ? error : color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && !CC_FORWARD_ADD\n void CCSurfacesDebugViewMeshData(inout vec4 color)\n {\n vec4 white = vec4(1.0, 1.0, 1.0, 1.0);\n vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_VERTEX_COLOR\n color = FSInput_vertexColor;\n #else\n color = white;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_worldNormal * 0.5 + vec3(0.5), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = vec4(FSInput_worldTangent * 0.5 + vec3(0.5), 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n float sign = FSInput_mirrorNormal * 0.5 + 0.5;\n color = vec4(sign, sign, sign, 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FACE_SIDE)) && (cc_surfaceTransform.y != 3.0)))\n {\n float scalar = clamp(FSInput_faceSideSign, 0.0, 1.0);\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UV0)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_texcoord.xy, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UV1)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_texcoord1.xy, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n color = vec4(FSInput_lightMapUV.xy, 0.0, 1.0);\n #else\n color = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH)) && (cc_surfaceTransform.y != 3.0)))\n {\n vec4 clipPos = cc_matProj * cc_matView * vec4(FSInput_worldPos.xyz, 1.0);\n float depth = clipPos.z / clipPos.w;\n color = vec4(depth, depth, depth, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH)) && (cc_surfaceTransform.y != 3.0)))\n {\n vec4 viewPos = cc_matView * vec4(FSInput_worldPos.xyz, 1.0);\n float depth = (-viewPos.z - cc_nearFar.x) / cc_nearFar.y;\n color = vec4(depth, depth, depth, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_WORLD_POS)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_worldPos.xyz, 1.0);\n }\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n bool CCSurfacesDebugViewLightingResult(inout vec4 color, in LightingResult lightingResult)\n {\n bool isSRGBColor = false;\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_LIGHT_MAP)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.lightmapColor;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_EMISSIVE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.emissive;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_AO)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(lightingResult.ao);\n isSRGBColor = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SHADOW)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(lightingResult.shadow);\n isSRGBColor = false;\n }\n vec3 fresnel = lightingResult.fresnel;\n vec3 directTransmitSpecular = vec3(0.0), environmentTransmitSpecular = vec3(0.0);\n vec3 directTransmitDiffuse = vec3(0.0), environmentTransmitDiffuse = vec3(0.0);\n vec3 diffuseColorWithLightingTT = vec3(0.0), specularColorWithLighting2ndSpecular = vec3(0.0);\n vec3 direct2ndSpecular = vec3(0.0), environment2ndSpecular = vec3(0.0);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n directTransmitSpecular = lightingResult.directTransmitSpecular;\n environmentTransmitSpecular = lightingResult.environmentTransmitSpecular;\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n directTransmitDiffuse = lightingResult.directTransmitDiffuse;\n environmentTransmitDiffuse = lightingResult.environmentTransmitDiffuse;\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n direct2ndSpecular = lightingResult.direct2ndSpecular * lightingResult.directGF2ndSpecular;\n environment2ndSpecular = lightingResult.environment2ndSpecular * lightingResult.environmentGF2ndSpecular;\n specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n fresnel = lightingResult.environmentSubLayerF;\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n direct2ndSpecular = lightingResult.directSpecularSubLayers;\n environment2ndSpecular = lightingResult.environmentSpecularSubLayers;\n #endif\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRESNEL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(fresnel);\n isSRGBColor = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environmentTransmitSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environmentTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitSpecular + environmentTransmitSpecular + directTransmitDiffuse + environmentTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = direct2ndSpecular * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environment2ndSpecular * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = (direct2ndSpecular + environment2ndSpecular) * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n return isSRGBColor;\n }\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n void CCSurfacesDebugViewCompositeLightingResult(inout LightingResult lightingResult)\n {\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE)\n lightingResult.directDiffuse = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR)\n lightingResult.directSpecular = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE)\n lightingResult.environmentDiffuse = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR)\n lightingResult.environmentSpecular = vec3(0.0);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE)\n lightingResult.directTransmitDiffuse = lightingResult.environmentTransmitDiffuse = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR)\n lightingResult.directTransmitSpecular = lightingResult.environmentTransmitSpecular = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR)\n lightingResult.direct2ndSpecular = lightingResult.environment2ndSpecular = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_TT\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT)\n lightingResult.directTT = vec3(0.0);\n #endif\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE)\n lightingResult.emissive = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP)\n lightingResult.lightmapColor = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL)\n lightingResult.fresnel = vec3(1.0);\n }\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n void main() {\n #if CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER\n float NoL = dot(-cc_mainLitDir.xyz, FSInput_worldNormal.xyz);\n vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();\n float fogFactor = 1.0;\n #if CC_FORWARD_ADD\n color.rgb = vec3(0.0);\n #endif\n #else\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n vec2 shadowBias = vec2(0.0);\n vec3 colDebugCSMLayer = vec3(1.0);\n #if CC_RECEIVE_SHADOW\n shadowBias = FSInput_shadowBias;\n #if !CC_FORWARD_ADD\n #if CC_USE_DEBUG_VIEW && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION)\n {\n vec4 csmPos;\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int csmLayer = -1;\n csmLayer = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, surfaceData.worldPos);\n bool OutOfRange = csmLayer < 0;\n if (OutOfRange)\n colDebugCSMLayer = vec3(1.0);\n else if (csmLayer == 0)\n colDebugCSMLayer = vec3(1.0, 0.0, 0.0);\n else if (csmLayer == 1)\n colDebugCSMLayer = vec3(0.0, 1.0, 0.0);\n else if (csmLayer == 2)\n colDebugCSMLayer = vec3(0.0, 0.0, 1.0);\n else if (csmLayer == 3)\n colDebugCSMLayer = vec3(0.0, 1.0, 1.0);\n }\n #endif\n #endif\n #endif\n float fogFactor = 1.0;\n #if !CC_FORWARD_ADD\n #if CC_USE_FOG != 4\n #if !CC_USE_ACCURATE_FOG\n fogFactor = FSInput_fogFactor;\n #else\n CC_TRANSFER_FOG_BASE(vec4(FSInput_worldPos, 1.0), fogFactor);\n #endif\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG) {\n fogFactor = 1.0;\n }\n #endif\n #endif\n LightingResult lightingResult;\n CCSurfacesLighting(lightingResult, surfaceData, shadowBias);\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && CC_SURFACES_ENABLE_DEBUG_VIEW\n vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);\n float materialTransparency = CCSurfacesShading(surfaceData, lightingResult).a;\n #if !CC_FORWARD_ADD && !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n CCSurfacesDebugViewMeshData(debugColor);\n if (CCSurfacesDebugViewSurfaceData(debugColor, surfaceData))\n {\n debugColor.a = materialTransparency;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FOG)) && (cc_surfaceTransform.y != 3.0)))\n {\n debugColor.rgb = vec3(1.0 - fogFactor);\n }\n #endif\n #if CC_FORWARD_ADD\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)) && (cc_surfaceTransform.y != 3.0)) ||\n (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n #endif\n {\n if (CCSurfacesDebugViewLightingResult(debugColor, lightingResult))\n {\n debugColor.a = materialTransparency;\n #if !CC_USE_FLOAT_OUTPUT\n debugColor.rgb = HDRToLDR(debugColor.rgb);\n debugColor.rgb = LinearToSRGB(debugColor.rgb);\n #endif\n }\n }\n if (IS_DEBUG_VIEW_ENABLE_WITH_CAMERA) {\n gl_FragData[0] = debugColor;\n return;\n }\n #elif CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n CCSurfacesDebugViewCompositeLightingResult(lightingResult);\n #endif\n vec4 color = CCSurfacesShading(surfaceData, lightingResult);\n #if CC_USE_DEBUG_VIEW && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION) {\n color.rgb *= colDebugCSMLayer.rgb;\n }\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = CCSurfacesDebugDisplayInvalidInputData(color, FSInput_worldTangent);\n #endif\n #endif\n #endif\n #if CC_USE_FOG != 4 && (!CC_USE_FLOAT_OUTPUT || CC_IS_TRANSPARENCY_PASS)\n #if !CC_FORWARD_ADD\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FOG\n color.rgb = CCSurfacesLightingModifyFog(fogFactor, color.rgb, surfaceData, lightingResult);\n #else\n CC_APPLY_FOG_BASE(color, fogFactor);\n #endif\n #endif\n #endif\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #else\n color = CCSurfacesDebugDisplayInvalidNumber(color);\n #if !CC_USE_FLOAT_OUTPUT || CC_IS_TRANSPARENCY_PASS\n color.rgb = HDRToLDR(color.rgb);\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n #endif\n gl_FragData[0] = color;\n }\n#elif CC_PIPELINE_TYPE == 1\n void main () {\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n gl_FragData[0] = CCSurfacesDeferredOutputBaseColor(surfaceData);\n gl_FragData[2] = CCSurfacesDeferredOutputNormalMR(surfaceData);\n gl_FragData[1] = CCSurfacesDeferredOutputEmissiveAO(surfaceData);\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && CC_SURFACES_ENABLE_DEBUG_VIEW\n vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);\n CCSurfacesDebugViewMeshData(debugColor);\n CCSurfacesDebugViewSurfaceData(debugColor, surfaceData);\n if (IS_DEBUG_VIEW_ENABLE_WITH_CAMERA) {\n gl_FragData[0] = debugColor;\n }\n #endif\n }\n#endif"
  4106. },
  4107. "builtins": {
  4108. "globals": {
  4109. "blocks": [
  4110. {
  4111. "name": "CCGlobal",
  4112. "defines": []
  4113. },
  4114. {
  4115. "name": "CCCamera",
  4116. "defines": []
  4117. },
  4118. {
  4119. "name": "CCShadow",
  4120. "defines": []
  4121. },
  4122. {
  4123. "name": "CCCSM",
  4124. "defines": [
  4125. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  4126. ]
  4127. }
  4128. ],
  4129. "samplerTextures": [
  4130. {
  4131. "name": "cc_environment",
  4132. "defines": []
  4133. },
  4134. {
  4135. "name": "cc_diffuseMap",
  4136. "defines": [
  4137. "CC_USE_IBL",
  4138. "CC_USE_DIFFUSEMAP"
  4139. ]
  4140. },
  4141. {
  4142. "name": "cc_shadowMap",
  4143. "defines": [
  4144. "CC_RECEIVE_SHADOW"
  4145. ]
  4146. },
  4147. {
  4148. "name": "cc_spotShadowMap",
  4149. "defines": [
  4150. "CC_RECEIVE_SHADOW"
  4151. ]
  4152. }
  4153. ],
  4154. "buffers": [],
  4155. "images": []
  4156. },
  4157. "locals": {
  4158. "blocks": [
  4159. {
  4160. "name": "CCLocal",
  4161. "defines": [
  4162. "!USE_INSTANCING"
  4163. ]
  4164. },
  4165. {
  4166. "name": "CCMorph",
  4167. "defines": [
  4168. "CC_USE_MORPH"
  4169. ]
  4170. },
  4171. {
  4172. "name": "CCSkinningTexture",
  4173. "defines": [
  4174. "CC_USE_SKINNING",
  4175. "CC_USE_BAKED_ANIMATION"
  4176. ]
  4177. },
  4178. {
  4179. "name": "CCSkinningAnimation",
  4180. "defines": [
  4181. "CC_USE_SKINNING",
  4182. "CC_USE_BAKED_ANIMATION"
  4183. ]
  4184. },
  4185. {
  4186. "name": "CCSkinning",
  4187. "defines": [
  4188. "CC_USE_SKINNING",
  4189. "!CC_USE_BAKED_ANIMATION",
  4190. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  4191. ]
  4192. },
  4193. {
  4194. "name": "CCForwardLight",
  4195. "defines": [
  4196. "CC_FORWARD_ADD",
  4197. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  4198. ]
  4199. },
  4200. {
  4201. "name": "CCSH",
  4202. "defines": [
  4203. "CC_USE_LIGHT_PROBE",
  4204. "!USE_INSTANCING"
  4205. ]
  4206. }
  4207. ],
  4208. "samplerTextures": [
  4209. {
  4210. "name": "cc_PositionDisplacements",
  4211. "defines": [
  4212. "CC_USE_MORPH",
  4213. "CC_MORPH_TARGET_HAS_POSITION"
  4214. ]
  4215. },
  4216. {
  4217. "name": "cc_NormalDisplacements",
  4218. "defines": [
  4219. "CC_USE_MORPH",
  4220. "CC_MORPH_TARGET_HAS_NORMAL"
  4221. ]
  4222. },
  4223. {
  4224. "name": "cc_TangentDisplacements",
  4225. "defines": [
  4226. "CC_USE_MORPH",
  4227. "CC_MORPH_TARGET_HAS_TANGENT"
  4228. ]
  4229. },
  4230. {
  4231. "name": "cc_jointTexture",
  4232. "defines": [
  4233. "CC_USE_SKINNING",
  4234. "CC_USE_BAKED_ANIMATION"
  4235. ]
  4236. },
  4237. {
  4238. "name": "cc_realtimeJoint",
  4239. "defines": [
  4240. "CC_USE_SKINNING",
  4241. "!CC_USE_BAKED_ANIMATION",
  4242. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  4243. ]
  4244. },
  4245. {
  4246. "name": "cc_reflectionProbeCubemap",
  4247. "defines": [
  4248. "CC_USE_REFLECTION_PROBE"
  4249. ]
  4250. },
  4251. {
  4252. "name": "cc_reflectionProbePlanarMap",
  4253. "defines": [
  4254. "CC_USE_REFLECTION_PROBE"
  4255. ]
  4256. },
  4257. {
  4258. "name": "cc_reflectionProbeDataMap",
  4259. "defines": [
  4260. "CC_USE_REFLECTION_PROBE"
  4261. ]
  4262. },
  4263. {
  4264. "name": "cc_reflectionProbeBlendCubemap",
  4265. "defines": [
  4266. "CC_USE_REFLECTION_PROBE"
  4267. ]
  4268. },
  4269. {
  4270. "name": "cc_lightingMap",
  4271. "defines": [
  4272. "CC_USE_LIGHTMAP",
  4273. "!CC_FORWARD_ADD"
  4274. ]
  4275. }
  4276. ],
  4277. "buffers": [],
  4278. "images": []
  4279. },
  4280. "statistics": {
  4281. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 100,
  4282. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 130
  4283. }
  4284. },
  4285. "defines": [
  4286. {
  4287. "name": "USE_COMPATIBLE_LIGHTING",
  4288. "type": "boolean",
  4289. "defines": []
  4290. },
  4291. {
  4292. "name": "USE_NORMAL_MAP",
  4293. "type": "boolean",
  4294. "defines": []
  4295. },
  4296. {
  4297. "name": "USE_INSTANCING",
  4298. "type": "boolean",
  4299. "defines": [],
  4300. "editor": {
  4301. "elevated": true
  4302. }
  4303. },
  4304. {
  4305. "name": "CC_USE_LIGHTMAP",
  4306. "type": "boolean",
  4307. "defines": []
  4308. },
  4309. {
  4310. "name": "CC_USE_SKINNING",
  4311. "type": "boolean",
  4312. "defines": []
  4313. },
  4314. {
  4315. "name": "CC_USE_BAKED_ANIMATION",
  4316. "type": "boolean",
  4317. "defines": [
  4318. "USE_INSTANCING"
  4319. ]
  4320. },
  4321. {
  4322. "name": "CC_RECEIVE_SHADOW",
  4323. "type": "boolean",
  4324. "defines": []
  4325. },
  4326. {
  4327. "name": "CC_USE_REFLECTION_PROBE",
  4328. "type": "number",
  4329. "defines": [],
  4330. "range": [
  4331. 0,
  4332. 3
  4333. ]
  4334. },
  4335. {
  4336. "name": "CC_USE_LIGHT_PROBE",
  4337. "type": "boolean",
  4338. "defines": [],
  4339. "default": 0
  4340. },
  4341. {
  4342. "name": "CC_USE_MORPH",
  4343. "type": "boolean",
  4344. "defines": []
  4345. },
  4346. {
  4347. "name": "CC_FORWARD_ADD",
  4348. "type": "boolean",
  4349. "defines": []
  4350. },
  4351. {
  4352. "name": "CC_USE_FOG",
  4353. "type": "number",
  4354. "defines": [],
  4355. "range": [
  4356. 0,
  4357. 4
  4358. ]
  4359. },
  4360. {
  4361. "name": "CC_USE_ACCURATE_FOG",
  4362. "type": "boolean",
  4363. "defines": [
  4364. "CC_USE_FOG"
  4365. ]
  4366. },
  4367. {
  4368. "name": "CC_MORPH_TARGET_COUNT",
  4369. "type": "number",
  4370. "defines": [
  4371. "CC_USE_MORPH"
  4372. ],
  4373. "range": [
  4374. 2,
  4375. 8
  4376. ]
  4377. },
  4378. {
  4379. "name": "CC_MORPH_TARGET_HAS_POSITION",
  4380. "type": "boolean",
  4381. "defines": [
  4382. "CC_USE_MORPH"
  4383. ]
  4384. },
  4385. {
  4386. "name": "CC_MORPH_TARGET_HAS_NORMAL",
  4387. "type": "boolean",
  4388. "defines": [
  4389. "CC_USE_MORPH"
  4390. ]
  4391. },
  4392. {
  4393. "name": "CC_MORPH_TARGET_HAS_TANGENT",
  4394. "type": "boolean",
  4395. "defines": [
  4396. "CC_USE_MORPH"
  4397. ]
  4398. },
  4399. {
  4400. "name": "CC_MORPH_PRECOMPUTED",
  4401. "type": "boolean",
  4402. "defines": [
  4403. "CC_USE_MORPH"
  4404. ]
  4405. },
  4406. {
  4407. "name": "CC_USE_REAL_TIME_JOINT_TEXTURE",
  4408. "type": "boolean",
  4409. "defines": [
  4410. "CC_USE_SKINNING",
  4411. "!CC_USE_BAKED_ANIMATION"
  4412. ]
  4413. },
  4414. {
  4415. "name": "CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER",
  4416. "type": "number",
  4417. "defines": [],
  4418. "range": [
  4419. 0,
  4420. 1
  4421. ]
  4422. },
  4423. {
  4424. "name": "CC_PIPELINE_TYPE",
  4425. "type": "number",
  4426. "defines": [],
  4427. "range": [
  4428. 0,
  4429. 1
  4430. ]
  4431. },
  4432. {
  4433. "name": "CC_FORCE_FORWARD_SHADING",
  4434. "type": "boolean",
  4435. "defines": [
  4436. "CC_PIPELINE_TYPE"
  4437. ]
  4438. },
  4439. {
  4440. "name": "CC_ENABLE_CLUSTERED_LIGHT_CULLING",
  4441. "type": "number",
  4442. "defines": [],
  4443. "range": [
  4444. 0,
  4445. 3
  4446. ]
  4447. },
  4448. {
  4449. "name": "CC_SUPPORT_CASCADED_SHADOW_MAP",
  4450. "type": "boolean",
  4451. "defines": []
  4452. },
  4453. {
  4454. "name": "CC_USE_IBL",
  4455. "type": "number",
  4456. "defines": [],
  4457. "range": [
  4458. 0,
  4459. 2
  4460. ]
  4461. },
  4462. {
  4463. "name": "CC_USE_DIFFUSEMAP",
  4464. "type": "number",
  4465. "defines": [
  4466. "CC_USE_IBL"
  4467. ],
  4468. "range": [
  4469. 0,
  4470. 2
  4471. ]
  4472. },
  4473. {
  4474. "name": "CC_USE_HDR",
  4475. "type": "boolean",
  4476. "defines": []
  4477. },
  4478. {
  4479. "name": "CC_USE_DEBUG_VIEW",
  4480. "type": "number",
  4481. "defines": [],
  4482. "range": [
  4483. 0,
  4484. 3
  4485. ]
  4486. },
  4487. {
  4488. "name": "CC_TONE_MAPPING_TYPE",
  4489. "type": "number",
  4490. "defines": [
  4491. "CC_USE_HDR"
  4492. ],
  4493. "range": [
  4494. 0,
  4495. 3
  4496. ]
  4497. },
  4498. {
  4499. "name": "HDR_TONE_MAPPING_ACES",
  4500. "type": "boolean",
  4501. "defines": [
  4502. "CC_TONE_MAPPING_TYPE",
  4503. "CC_USE_HDR"
  4504. ]
  4505. },
  4506. {
  4507. "name": "CC_SHADOWMAP_FORMAT",
  4508. "type": "number",
  4509. "defines": [
  4510. "CC_RECEIVE_SHADOW"
  4511. ],
  4512. "range": [
  4513. 0,
  4514. 3
  4515. ]
  4516. },
  4517. {
  4518. "name": "CC_SHADOWMAP_USE_LINEAR_DEPTH",
  4519. "type": "boolean",
  4520. "defines": [
  4521. "CC_RECEIVE_SHADOW"
  4522. ]
  4523. },
  4524. {
  4525. "name": "CC_DIR_SHADOW_PCF_TYPE",
  4526. "type": "number",
  4527. "defines": [
  4528. "CC_RECEIVE_SHADOW"
  4529. ],
  4530. "range": [
  4531. 0,
  4532. 3
  4533. ]
  4534. },
  4535. {
  4536. "name": "CC_CASCADED_LAYERS_TRANSITION",
  4537. "type": "boolean",
  4538. "defines": [
  4539. "CC_RECEIVE_SHADOW",
  4540. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  4541. ]
  4542. },
  4543. {
  4544. "name": "CC_LIGHT_MAP_VERSION",
  4545. "type": "number",
  4546. "defines": [
  4547. "CC_USE_LIGHTMAP",
  4548. "!CC_FORWARD_ADD"
  4549. ],
  4550. "range": [
  4551. 0,
  4552. 3
  4553. ]
  4554. },
  4555. {
  4556. "name": "USE_BASE_COLOR_MAP",
  4557. "type": "boolean",
  4558. "defines": []
  4559. },
  4560. {
  4561. "name": "USE_1ST_SHADE_MAP",
  4562. "type": "boolean",
  4563. "defines": []
  4564. },
  4565. {
  4566. "name": "USE_2ND_SHADE_MAP",
  4567. "type": "boolean",
  4568. "defines": []
  4569. },
  4570. {
  4571. "name": "USE_SPECULAR_MAP",
  4572. "type": "boolean",
  4573. "defines": []
  4574. },
  4575. {
  4576. "name": "USE_EMISSIVE_MAP",
  4577. "type": "boolean",
  4578. "defines": []
  4579. },
  4580. {
  4581. "name": "USE_ALPHA_TEST",
  4582. "type": "boolean",
  4583. "defines": []
  4584. },
  4585. {
  4586. "name": "ALPHA_TEST_CHANNEL",
  4587. "type": "string",
  4588. "defines": [
  4589. "USE_ALPHA_TEST"
  4590. ],
  4591. "options": [
  4592. "a",
  4593. "r",
  4594. "g",
  4595. "b"
  4596. ]
  4597. },
  4598. {
  4599. "name": "SHADE_MAP_1_AS_SHADE_MAP_2",
  4600. "type": "boolean",
  4601. "defines": [
  4602. "USE_1ST_SHADE_MAP"
  4603. ]
  4604. },
  4605. {
  4606. "name": "BASE_COLOR_MAP_AS_SHADE_MAP_1",
  4607. "type": "boolean",
  4608. "defines": [
  4609. "USE_BASE_COLOR_MAP"
  4610. ]
  4611. },
  4612. {
  4613. "name": "BASE_COLOR_MAP_AS_SHADE_MAP_2",
  4614. "type": "boolean",
  4615. "defines": [
  4616. "USE_BASE_COLOR_MAP"
  4617. ]
  4618. },
  4619. {
  4620. "name": "CC_SHADOW_TYPE",
  4621. "type": "number",
  4622. "defines": [
  4623. "CC_RECEIVE_SHADOW"
  4624. ],
  4625. "range": [
  4626. 0,
  4627. 3
  4628. ]
  4629. },
  4630. {
  4631. "name": "CC_DIR_LIGHT_SHADOW_TYPE",
  4632. "type": "number",
  4633. "defines": [
  4634. "CC_RECEIVE_SHADOW",
  4635. "CC_SHADOW_TYPE"
  4636. ],
  4637. "range": [
  4638. 0,
  4639. 3
  4640. ]
  4641. },
  4642. {
  4643. "name": "CC_DISABLE_DIRECTIONAL_LIGHT",
  4644. "type": "boolean",
  4645. "defines": []
  4646. },
  4647. {
  4648. "name": "CC_SURFACES_LIGHTING_DISABLE_DIFFUSE",
  4649. "type": "boolean",
  4650. "defines": [
  4651. "!CC_FORWARD_ADD",
  4652. "!CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER",
  4653. "CC_USE_DEBUG_VIEW",
  4654. "CC_SURFACES_DEBUG_VIEW_SINGLE",
  4655. "CC_SURFACES_ENABLE_DEBUG_VIEW"
  4656. ]
  4657. },
  4658. {
  4659. "name": "CC_USE_FLOAT_OUTPUT",
  4660. "type": "boolean",
  4661. "defines": [
  4662. "CC_USE_FOG"
  4663. ]
  4664. },
  4665. {
  4666. "name": "CC_IS_TRANSPARENCY_PASS",
  4667. "type": "boolean",
  4668. "defines": [
  4669. "CC_USE_FOG",
  4670. "CC_USE_FLOAT_OUTPUT"
  4671. ]
  4672. },
  4673. {
  4674. "name": "CC_USE_RGBE_OUTPUT",
  4675. "type": "boolean",
  4676. "defines": []
  4677. }
  4678. ],
  4679. "name": "builtin-toon|toon-vs|toon-fs"
  4680. },
  4681. {
  4682. "blocks": [
  4683. {
  4684. "name": "Constants",
  4685. "members": [
  4686. {
  4687. "name": "tilingOffset",
  4688. "type": 16,
  4689. "count": 1
  4690. },
  4691. {
  4692. "name": "baseColor",
  4693. "type": 16,
  4694. "count": 1
  4695. },
  4696. {
  4697. "name": "colorScaleAndCutoff",
  4698. "type": 16,
  4699. "count": 1
  4700. },
  4701. {
  4702. "name": "shadeColor1",
  4703. "type": 16,
  4704. "count": 1
  4705. },
  4706. {
  4707. "name": "shadeColor2",
  4708. "type": 16,
  4709. "count": 1
  4710. },
  4711. {
  4712. "name": "specular",
  4713. "type": 16,
  4714. "count": 1
  4715. },
  4716. {
  4717. "name": "shadeParams",
  4718. "type": 16,
  4719. "count": 1
  4720. },
  4721. {
  4722. "name": "miscParams",
  4723. "type": 16,
  4724. "count": 1
  4725. },
  4726. {
  4727. "name": "emissive",
  4728. "type": 16,
  4729. "count": 1
  4730. },
  4731. {
  4732. "name": "emissiveScaleAndStrenth",
  4733. "type": 16,
  4734. "count": 1
  4735. }
  4736. ],
  4737. "defines": [],
  4738. "stageFlags": 17,
  4739. "binding": 0
  4740. }
  4741. ],
  4742. "samplerTextures": [
  4743. {
  4744. "name": "baseColorMap",
  4745. "type": 28,
  4746. "count": 1,
  4747. "defines": [
  4748. "USE_BASE_COLOR_MAP"
  4749. ],
  4750. "stageFlags": 16,
  4751. "binding": 1
  4752. },
  4753. {
  4754. "name": "normalMap",
  4755. "type": 28,
  4756. "count": 1,
  4757. "defines": [
  4758. "USE_NORMAL_MAP"
  4759. ],
  4760. "stageFlags": 16,
  4761. "binding": 2
  4762. },
  4763. {
  4764. "name": "shadeMap1",
  4765. "type": 28,
  4766. "count": 1,
  4767. "defines": [
  4768. "USE_1ST_SHADE_MAP"
  4769. ],
  4770. "stageFlags": 16,
  4771. "binding": 3
  4772. },
  4773. {
  4774. "name": "shadeMap2",
  4775. "type": 28,
  4776. "count": 1,
  4777. "defines": [
  4778. "USE_2ND_SHADE_MAP"
  4779. ],
  4780. "stageFlags": 16,
  4781. "binding": 4
  4782. },
  4783. {
  4784. "name": "specularMap",
  4785. "type": 28,
  4786. "count": 1,
  4787. "defines": [
  4788. "USE_SPECULAR_MAP"
  4789. ],
  4790. "stageFlags": 16,
  4791. "binding": 5
  4792. },
  4793. {
  4794. "name": "emissiveMap",
  4795. "type": 28,
  4796. "count": 1,
  4797. "defines": [
  4798. "USE_EMISSIVE_MAP"
  4799. ],
  4800. "stageFlags": 16,
  4801. "binding": 6
  4802. }
  4803. ],
  4804. "samplers": [],
  4805. "textures": [],
  4806. "buffers": [],
  4807. "images": [],
  4808. "subpassInputs": [],
  4809. "attributes": [
  4810. {
  4811. "name": "a_position",
  4812. "defines": [],
  4813. "format": 32,
  4814. "location": 0
  4815. },
  4816. {
  4817. "name": "a_normal",
  4818. "defines": [],
  4819. "format": 32,
  4820. "location": 1
  4821. },
  4822. {
  4823. "name": "a_texCoord",
  4824. "defines": [],
  4825. "format": 21,
  4826. "location": 2
  4827. },
  4828. {
  4829. "name": "a_tangent",
  4830. "defines": [
  4831. "USE_NORMAL_MAP"
  4832. ],
  4833. "format": 44,
  4834. "location": 3
  4835. },
  4836. {
  4837. "name": "a_color",
  4838. "defines": [],
  4839. "format": 44,
  4840. "location": 6
  4841. },
  4842. {
  4843. "name": "a_texCoord1",
  4844. "defines": [],
  4845. "format": 21,
  4846. "location": 7
  4847. },
  4848. {
  4849. "name": "a_joints",
  4850. "defines": [
  4851. "CC_USE_SKINNING"
  4852. ],
  4853. "location": 4
  4854. },
  4855. {
  4856. "name": "a_weights",
  4857. "defines": [
  4858. "CC_USE_SKINNING"
  4859. ],
  4860. "format": 44,
  4861. "location": 5
  4862. },
  4863. {
  4864. "name": "a_jointAnimInfo",
  4865. "defines": [
  4866. "USE_INSTANCING",
  4867. "CC_USE_BAKED_ANIMATION"
  4868. ],
  4869. "format": 44,
  4870. "isInstanced": true,
  4871. "location": 8
  4872. },
  4873. {
  4874. "name": "a_matWorld0",
  4875. "defines": [
  4876. "USE_INSTANCING"
  4877. ],
  4878. "format": 44,
  4879. "isInstanced": true,
  4880. "location": 9
  4881. },
  4882. {
  4883. "name": "a_matWorld1",
  4884. "defines": [
  4885. "USE_INSTANCING"
  4886. ],
  4887. "format": 44,
  4888. "isInstanced": true,
  4889. "location": 10
  4890. },
  4891. {
  4892. "name": "a_matWorld2",
  4893. "defines": [
  4894. "USE_INSTANCING"
  4895. ],
  4896. "format": 44,
  4897. "isInstanced": true,
  4898. "location": 11
  4899. },
  4900. {
  4901. "name": "a_lightingMapUVParam",
  4902. "defines": [
  4903. "USE_INSTANCING",
  4904. "CC_USE_LIGHTMAP"
  4905. ],
  4906. "format": 44,
  4907. "isInstanced": true,
  4908. "location": 12
  4909. },
  4910. {
  4911. "name": "a_localShadowBiasAndProbeId",
  4912. "defines": [
  4913. "USE_INSTANCING"
  4914. ],
  4915. "format": 44,
  4916. "isInstanced": true,
  4917. "location": 13
  4918. },
  4919. {
  4920. "name": "a_reflectionProbeData",
  4921. "defines": [
  4922. "USE_INSTANCING",
  4923. "CC_USE_REFLECTION_PROBE"
  4924. ],
  4925. "format": 44,
  4926. "isInstanced": true,
  4927. "location": 14
  4928. },
  4929. {
  4930. "name": "a_sh_linear_const_r",
  4931. "defines": [
  4932. "USE_INSTANCING",
  4933. "CC_USE_LIGHT_PROBE"
  4934. ],
  4935. "format": 44,
  4936. "isInstanced": true,
  4937. "location": 15
  4938. },
  4939. {
  4940. "name": "a_sh_linear_const_g",
  4941. "defines": [
  4942. "USE_INSTANCING",
  4943. "CC_USE_LIGHT_PROBE"
  4944. ],
  4945. "format": 44,
  4946. "isInstanced": true,
  4947. "location": 16
  4948. },
  4949. {
  4950. "name": "a_sh_linear_const_b",
  4951. "defines": [
  4952. "USE_INSTANCING",
  4953. "CC_USE_LIGHT_PROBE"
  4954. ],
  4955. "format": 44,
  4956. "isInstanced": true,
  4957. "location": 17
  4958. },
  4959. {
  4960. "name": "a_vertexId",
  4961. "defines": [
  4962. "CC_USE_MORPH"
  4963. ],
  4964. "format": 11,
  4965. "location": 18
  4966. }
  4967. ],
  4968. "varyings": [
  4969. {
  4970. "name": "v_worldPos",
  4971. "type": 15,
  4972. "count": 1,
  4973. "defines": [],
  4974. "stageFlags": 17,
  4975. "location": 0
  4976. },
  4977. {
  4978. "name": "v_normal",
  4979. "type": 16,
  4980. "count": 1,
  4981. "defines": [],
  4982. "stageFlags": 17,
  4983. "location": 1
  4984. },
  4985. {
  4986. "name": "v_uv",
  4987. "type": 14,
  4988. "count": 1,
  4989. "defines": [],
  4990. "stageFlags": 17,
  4991. "location": 2
  4992. },
  4993. {
  4994. "name": "v_color",
  4995. "type": 16,
  4996. "count": 1,
  4997. "defines": [],
  4998. "stageFlags": 17,
  4999. "location": 3
  5000. },
  5001. {
  5002. "name": "v_tangent",
  5003. "type": 16,
  5004. "count": 1,
  5005. "defines": [],
  5006. "stageFlags": 17,
  5007. "location": 4
  5008. },
  5009. {
  5010. "name": "v_uv1",
  5011. "type": 14,
  5012. "count": 1,
  5013. "defines": [],
  5014. "stageFlags": 17,
  5015. "location": 5
  5016. },
  5017. {
  5018. "name": "v_luv",
  5019. "type": 15,
  5020. "count": 1,
  5021. "defines": [
  5022. "CC_USE_LIGHTMAP",
  5023. "!CC_FORWARD_ADD"
  5024. ],
  5025. "stageFlags": 17,
  5026. "location": 6
  5027. },
  5028. {
  5029. "name": "v_shadowBiasAndProbeId",
  5030. "type": 16,
  5031. "count": 1,
  5032. "defines": [],
  5033. "stageFlags": 17,
  5034. "location": 7
  5035. },
  5036. {
  5037. "name": "v_reflectionProbeData",
  5038. "type": 16,
  5039. "count": 1,
  5040. "defines": [
  5041. "CC_USE_REFLECTION_PROBE",
  5042. "USE_INSTANCING"
  5043. ],
  5044. "stageFlags": 17,
  5045. "location": 8
  5046. },
  5047. {
  5048. "name": "v_fogFactor",
  5049. "type": 13,
  5050. "count": 1,
  5051. "defines": [
  5052. "CC_USE_FOG",
  5053. "!CC_USE_ACCURATE_FOG"
  5054. ],
  5055. "stageFlags": 17,
  5056. "location": 9
  5057. },
  5058. {
  5059. "name": "v_localPos",
  5060. "type": 16,
  5061. "count": 1,
  5062. "defines": [],
  5063. "stageFlags": 17,
  5064. "location": 10
  5065. },
  5066. {
  5067. "name": "v_clipPos",
  5068. "type": 16,
  5069. "count": 1,
  5070. "defines": [],
  5071. "stageFlags": 17,
  5072. "location": 11
  5073. },
  5074. {
  5075. "name": "v_sh_linear_const_r",
  5076. "type": 16,
  5077. "count": 1,
  5078. "defines": [
  5079. "CC_USE_LIGHT_PROBE",
  5080. "USE_INSTANCING"
  5081. ],
  5082. "stageFlags": 17,
  5083. "location": 12
  5084. },
  5085. {
  5086. "name": "v_sh_linear_const_g",
  5087. "type": 16,
  5088. "count": 1,
  5089. "defines": [
  5090. "CC_USE_LIGHT_PROBE",
  5091. "USE_INSTANCING"
  5092. ],
  5093. "stageFlags": 17,
  5094. "location": 13
  5095. },
  5096. {
  5097. "name": "v_sh_linear_const_b",
  5098. "type": 16,
  5099. "count": 1,
  5100. "defines": [
  5101. "CC_USE_LIGHT_PROBE",
  5102. "USE_INSTANCING"
  5103. ],
  5104. "stageFlags": 17,
  5105. "location": 14
  5106. },
  5107. {
  5108. "name": "v_clip_depth",
  5109. "type": 14,
  5110. "count": 1,
  5111. "defines": [],
  5112. "stageFlags": 17,
  5113. "location": 15
  5114. }
  5115. ],
  5116. "fragColors": [
  5117. {
  5118. "name": "fragColorX",
  5119. "typename": "vec4",
  5120. "type": 16,
  5121. "count": 1,
  5122. "defines": [],
  5123. "stageFlags": 16,
  5124. "location": 0
  5125. }
  5126. ],
  5127. "descriptors": [
  5128. {
  5129. "rate": 0,
  5130. "blocks": [
  5131. {
  5132. "tags": {
  5133. "builtin": "local"
  5134. },
  5135. "name": "CCLocal",
  5136. "members": [
  5137. {
  5138. "name": "cc_matWorld",
  5139. "typename": "mat4",
  5140. "type": 25,
  5141. "count": 1,
  5142. "precision": "highp "
  5143. },
  5144. {
  5145. "name": "cc_matWorldIT",
  5146. "typename": "mat4",
  5147. "type": 25,
  5148. "count": 1,
  5149. "precision": "highp "
  5150. },
  5151. {
  5152. "name": "cc_lightingMapUVParam",
  5153. "typename": "vec4",
  5154. "type": 16,
  5155. "count": 1,
  5156. "precision": "highp "
  5157. },
  5158. {
  5159. "name": "cc_localShadowBias",
  5160. "typename": "vec4",
  5161. "type": 16,
  5162. "count": 1,
  5163. "precision": "highp "
  5164. },
  5165. {
  5166. "name": "cc_reflectionProbeData1",
  5167. "typename": "vec4",
  5168. "type": 16,
  5169. "count": 1,
  5170. "precision": "highp "
  5171. },
  5172. {
  5173. "name": "cc_reflectionProbeData2",
  5174. "typename": "vec4",
  5175. "type": 16,
  5176. "count": 1,
  5177. "precision": "highp "
  5178. },
  5179. {
  5180. "name": "cc_reflectionProbeBlendData1",
  5181. "typename": "vec4",
  5182. "type": 16,
  5183. "count": 1,
  5184. "precision": "highp "
  5185. },
  5186. {
  5187. "name": "cc_reflectionProbeBlendData2",
  5188. "typename": "vec4",
  5189. "type": 16,
  5190. "count": 1,
  5191. "precision": "highp "
  5192. }
  5193. ],
  5194. "defines": [
  5195. "!USE_INSTANCING"
  5196. ],
  5197. "stageFlags": 17
  5198. },
  5199. {
  5200. "tags": {
  5201. "builtin": "local"
  5202. },
  5203. "name": "CCMorph",
  5204. "members": [
  5205. {
  5206. "name": "cc_displacementWeights",
  5207. "typename": "vec4",
  5208. "type": 16,
  5209. "count": 15,
  5210. "isArray": true
  5211. },
  5212. {
  5213. "name": "cc_displacementTextureInfo",
  5214. "typename": "vec4",
  5215. "type": 16,
  5216. "count": 1
  5217. }
  5218. ],
  5219. "defines": [
  5220. "CC_USE_MORPH"
  5221. ],
  5222. "stageFlags": 1
  5223. },
  5224. {
  5225. "tags": {
  5226. "builtin": "local"
  5227. },
  5228. "name": "CCSkinningTexture",
  5229. "members": [
  5230. {
  5231. "name": "cc_jointTextureInfo",
  5232. "typename": "vec4",
  5233. "type": 16,
  5234. "count": 1,
  5235. "precision": "highp "
  5236. }
  5237. ],
  5238. "defines": [
  5239. "CC_USE_SKINNING",
  5240. "CC_USE_BAKED_ANIMATION"
  5241. ],
  5242. "stageFlags": 1
  5243. },
  5244. {
  5245. "tags": {
  5246. "builtin": "local"
  5247. },
  5248. "name": "CCSkinningAnimation",
  5249. "members": [
  5250. {
  5251. "name": "cc_jointAnimInfo",
  5252. "typename": "vec4",
  5253. "type": 16,
  5254. "count": 1,
  5255. "precision": "highp "
  5256. }
  5257. ],
  5258. "defines": [
  5259. "CC_USE_SKINNING",
  5260. "CC_USE_BAKED_ANIMATION"
  5261. ],
  5262. "stageFlags": 1
  5263. },
  5264. {
  5265. "tags": {
  5266. "builtin": "local"
  5267. },
  5268. "name": "CCSkinning",
  5269. "members": [
  5270. {
  5271. "name": "cc_joints",
  5272. "typename": "vec4",
  5273. "type": 16,
  5274. "count": 0,
  5275. "precision": "highp ",
  5276. "isArray": true
  5277. }
  5278. ],
  5279. "defines": [
  5280. "CC_USE_SKINNING",
  5281. "!CC_USE_BAKED_ANIMATION",
  5282. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  5283. ],
  5284. "stageFlags": 1
  5285. },
  5286. {
  5287. "tags": {
  5288. "builtin": "local"
  5289. },
  5290. "name": "CCForwardLight",
  5291. "members": [
  5292. {
  5293. "name": "cc_lightPos",
  5294. "typename": "vec4",
  5295. "type": 16,
  5296. "count": 0,
  5297. "precision": "highp ",
  5298. "isArray": true
  5299. },
  5300. {
  5301. "name": "cc_lightColor",
  5302. "typename": "vec4",
  5303. "type": 16,
  5304. "count": 0,
  5305. "isArray": true
  5306. },
  5307. {
  5308. "name": "cc_lightSizeRangeAngle",
  5309. "typename": "vec4",
  5310. "type": 16,
  5311. "count": 0,
  5312. "isArray": true
  5313. },
  5314. {
  5315. "name": "cc_lightDir",
  5316. "typename": "vec4",
  5317. "type": 16,
  5318. "count": 0,
  5319. "isArray": true
  5320. },
  5321. {
  5322. "name": "cc_lightBoundingSizeVS",
  5323. "typename": "vec4",
  5324. "type": 16,
  5325. "count": 0,
  5326. "isArray": true
  5327. }
  5328. ],
  5329. "defines": [
  5330. "CC_FORWARD_ADD",
  5331. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  5332. ],
  5333. "stageFlags": 16
  5334. },
  5335. {
  5336. "tags": {
  5337. "builtin": "local"
  5338. },
  5339. "name": "CCSH",
  5340. "members": [
  5341. {
  5342. "name": "cc_sh_linear_const_r",
  5343. "typename": "vec4",
  5344. "type": 16,
  5345. "count": 1
  5346. },
  5347. {
  5348. "name": "cc_sh_linear_const_g",
  5349. "typename": "vec4",
  5350. "type": 16,
  5351. "count": 1
  5352. },
  5353. {
  5354. "name": "cc_sh_linear_const_b",
  5355. "typename": "vec4",
  5356. "type": 16,
  5357. "count": 1
  5358. },
  5359. {
  5360. "name": "cc_sh_quadratic_r",
  5361. "typename": "vec4",
  5362. "type": 16,
  5363. "count": 1
  5364. },
  5365. {
  5366. "name": "cc_sh_quadratic_g",
  5367. "typename": "vec4",
  5368. "type": 16,
  5369. "count": 1
  5370. },
  5371. {
  5372. "name": "cc_sh_quadratic_b",
  5373. "typename": "vec4",
  5374. "type": 16,
  5375. "count": 1
  5376. },
  5377. {
  5378. "name": "cc_sh_quadratic_a",
  5379. "typename": "vec4",
  5380. "type": 16,
  5381. "count": 1
  5382. }
  5383. ],
  5384. "defines": [
  5385. "CC_USE_LIGHT_PROBE",
  5386. "!USE_INSTANCING"
  5387. ],
  5388. "stageFlags": 16
  5389. }
  5390. ],
  5391. "samplerTextures": [
  5392. {
  5393. "tags": {
  5394. "builtin": "local"
  5395. },
  5396. "name": "cc_PositionDisplacements",
  5397. "typename": "sampler2D",
  5398. "type": 28,
  5399. "count": 1,
  5400. "defines": [
  5401. "CC_USE_MORPH",
  5402. "CC_MORPH_TARGET_HAS_POSITION"
  5403. ],
  5404. "stageFlags": 1
  5405. },
  5406. {
  5407. "tags": {
  5408. "builtin": "local"
  5409. },
  5410. "name": "cc_NormalDisplacements",
  5411. "typename": "sampler2D",
  5412. "type": 28,
  5413. "count": 1,
  5414. "defines": [
  5415. "CC_USE_MORPH",
  5416. "CC_MORPH_TARGET_HAS_NORMAL"
  5417. ],
  5418. "stageFlags": 1
  5419. },
  5420. {
  5421. "tags": {
  5422. "builtin": "local"
  5423. },
  5424. "name": "cc_TangentDisplacements",
  5425. "typename": "sampler2D",
  5426. "type": 28,
  5427. "count": 1,
  5428. "defines": [
  5429. "CC_USE_MORPH",
  5430. "CC_MORPH_TARGET_HAS_TANGENT"
  5431. ],
  5432. "stageFlags": 1
  5433. },
  5434. {
  5435. "tags": {
  5436. "builtin": "local"
  5437. },
  5438. "name": "cc_jointTexture",
  5439. "typename": "sampler2D",
  5440. "type": 28,
  5441. "count": 1,
  5442. "precision": "highp ",
  5443. "defines": [
  5444. "CC_USE_SKINNING",
  5445. "CC_USE_BAKED_ANIMATION"
  5446. ],
  5447. "stageFlags": 1
  5448. },
  5449. {
  5450. "tags": {
  5451. "builtin": "local"
  5452. },
  5453. "name": "cc_realtimeJoint",
  5454. "typename": "sampler2D",
  5455. "type": 28,
  5456. "count": 1,
  5457. "precision": "highp ",
  5458. "defines": [
  5459. "CC_USE_SKINNING",
  5460. "!CC_USE_BAKED_ANIMATION",
  5461. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  5462. ],
  5463. "stageFlags": 1
  5464. },
  5465. {
  5466. "tags": {
  5467. "builtin": "local"
  5468. },
  5469. "name": "cc_reflectionProbeCubemap",
  5470. "typename": "samplerCube",
  5471. "type": 31,
  5472. "count": 1,
  5473. "defines": [
  5474. "CC_USE_REFLECTION_PROBE"
  5475. ],
  5476. "stageFlags": 16
  5477. },
  5478. {
  5479. "tags": {
  5480. "builtin": "local"
  5481. },
  5482. "name": "cc_reflectionProbePlanarMap",
  5483. "typename": "sampler2D",
  5484. "type": 28,
  5485. "count": 1,
  5486. "defines": [
  5487. "CC_USE_REFLECTION_PROBE"
  5488. ],
  5489. "stageFlags": 16
  5490. },
  5491. {
  5492. "tags": {
  5493. "builtin": "local"
  5494. },
  5495. "name": "cc_reflectionProbeDataMap",
  5496. "typename": "sampler2D",
  5497. "type": 28,
  5498. "count": 1,
  5499. "defines": [
  5500. "CC_USE_REFLECTION_PROBE"
  5501. ],
  5502. "stageFlags": 16
  5503. },
  5504. {
  5505. "tags": {
  5506. "builtin": "local"
  5507. },
  5508. "name": "cc_reflectionProbeBlendCubemap",
  5509. "typename": "samplerCube",
  5510. "type": 31,
  5511. "count": 1,
  5512. "defines": [
  5513. "CC_USE_REFLECTION_PROBE"
  5514. ],
  5515. "stageFlags": 16
  5516. },
  5517. {
  5518. "tags": {
  5519. "builtin": "local"
  5520. },
  5521. "name": "cc_lightingMap",
  5522. "typename": "sampler2D",
  5523. "type": 28,
  5524. "count": 1,
  5525. "defines": [
  5526. "CC_USE_LIGHTMAP",
  5527. "!CC_FORWARD_ADD"
  5528. ],
  5529. "stageFlags": 16
  5530. }
  5531. ],
  5532. "samplers": [],
  5533. "textures": [],
  5534. "buffers": [],
  5535. "images": [],
  5536. "subpassInputs": []
  5537. },
  5538. {
  5539. "rate": 1,
  5540. "blocks": [
  5541. {
  5542. "name": "Constants",
  5543. "members": [
  5544. {
  5545. "name": "tilingOffset",
  5546. "type": 16,
  5547. "count": 1
  5548. },
  5549. {
  5550. "name": "baseColor",
  5551. "type": 16,
  5552. "count": 1
  5553. },
  5554. {
  5555. "name": "colorScaleAndCutoff",
  5556. "type": 16,
  5557. "count": 1
  5558. },
  5559. {
  5560. "name": "shadeColor1",
  5561. "type": 16,
  5562. "count": 1
  5563. },
  5564. {
  5565. "name": "shadeColor2",
  5566. "type": 16,
  5567. "count": 1
  5568. },
  5569. {
  5570. "name": "specular",
  5571. "type": 16,
  5572. "count": 1
  5573. },
  5574. {
  5575. "name": "shadeParams",
  5576. "type": 16,
  5577. "count": 1
  5578. },
  5579. {
  5580. "name": "miscParams",
  5581. "type": 16,
  5582. "count": 1
  5583. },
  5584. {
  5585. "name": "emissive",
  5586. "type": 16,
  5587. "count": 1
  5588. },
  5589. {
  5590. "name": "emissiveScaleAndStrenth",
  5591. "type": 16,
  5592. "count": 1
  5593. }
  5594. ],
  5595. "defines": [],
  5596. "stageFlags": 17,
  5597. "binding": 0
  5598. }
  5599. ],
  5600. "samplerTextures": [
  5601. {
  5602. "name": "baseColorMap",
  5603. "type": 28,
  5604. "count": 1,
  5605. "defines": [
  5606. "USE_BASE_COLOR_MAP"
  5607. ],
  5608. "stageFlags": 16,
  5609. "binding": 1
  5610. },
  5611. {
  5612. "name": "normalMap",
  5613. "type": 28,
  5614. "count": 1,
  5615. "defines": [
  5616. "USE_NORMAL_MAP"
  5617. ],
  5618. "stageFlags": 16,
  5619. "binding": 2
  5620. },
  5621. {
  5622. "name": "shadeMap1",
  5623. "type": 28,
  5624. "count": 1,
  5625. "defines": [
  5626. "USE_1ST_SHADE_MAP"
  5627. ],
  5628. "stageFlags": 16,
  5629. "binding": 3
  5630. },
  5631. {
  5632. "name": "shadeMap2",
  5633. "type": 28,
  5634. "count": 1,
  5635. "defines": [
  5636. "USE_2ND_SHADE_MAP"
  5637. ],
  5638. "stageFlags": 16,
  5639. "binding": 4
  5640. },
  5641. {
  5642. "name": "specularMap",
  5643. "type": 28,
  5644. "count": 1,
  5645. "defines": [
  5646. "USE_SPECULAR_MAP"
  5647. ],
  5648. "stageFlags": 16,
  5649. "binding": 5
  5650. },
  5651. {
  5652. "name": "emissiveMap",
  5653. "type": 28,
  5654. "count": 1,
  5655. "defines": [
  5656. "USE_EMISSIVE_MAP"
  5657. ],
  5658. "stageFlags": 16,
  5659. "binding": 6
  5660. }
  5661. ],
  5662. "samplers": [],
  5663. "textures": [],
  5664. "buffers": [],
  5665. "images": [],
  5666. "subpassInputs": []
  5667. },
  5668. {
  5669. "rate": 2,
  5670. "blocks": [],
  5671. "samplerTextures": [],
  5672. "samplers": [],
  5673. "textures": [],
  5674. "buffers": [],
  5675. "images": [],
  5676. "subpassInputs": []
  5677. },
  5678. {
  5679. "rate": 3,
  5680. "blocks": [
  5681. {
  5682. "tags": {
  5683. "builtin": "global"
  5684. },
  5685. "name": "CCGlobal",
  5686. "members": [
  5687. {
  5688. "name": "cc_time",
  5689. "typename": "vec4",
  5690. "type": 16,
  5691. "count": 1,
  5692. "precision": "highp "
  5693. },
  5694. {
  5695. "name": "cc_screenSize",
  5696. "typename": "vec4",
  5697. "type": 16,
  5698. "count": 1,
  5699. "precision": "mediump "
  5700. },
  5701. {
  5702. "name": "cc_nativeSize",
  5703. "typename": "vec4",
  5704. "type": 16,
  5705. "count": 1,
  5706. "precision": "mediump "
  5707. },
  5708. {
  5709. "name": "cc_probeInfo",
  5710. "typename": "vec4",
  5711. "type": 16,
  5712. "count": 1,
  5713. "precision": "mediump "
  5714. },
  5715. {
  5716. "name": "cc_debug_view_mode",
  5717. "typename": "vec4",
  5718. "type": 16,
  5719. "count": 1,
  5720. "precision": "mediump "
  5721. }
  5722. ],
  5723. "defines": [],
  5724. "stageFlags": 17
  5725. },
  5726. {
  5727. "tags": {
  5728. "builtin": "global"
  5729. },
  5730. "name": "CCCamera",
  5731. "members": [
  5732. {
  5733. "name": "cc_matView",
  5734. "typename": "mat4",
  5735. "type": 25,
  5736. "count": 1,
  5737. "precision": "highp "
  5738. },
  5739. {
  5740. "name": "cc_matViewInv",
  5741. "typename": "mat4",
  5742. "type": 25,
  5743. "count": 1,
  5744. "precision": "highp "
  5745. },
  5746. {
  5747. "name": "cc_matProj",
  5748. "typename": "mat4",
  5749. "type": 25,
  5750. "count": 1,
  5751. "precision": "highp "
  5752. },
  5753. {
  5754. "name": "cc_matProjInv",
  5755. "typename": "mat4",
  5756. "type": 25,
  5757. "count": 1,
  5758. "precision": "highp "
  5759. },
  5760. {
  5761. "name": "cc_matViewProj",
  5762. "typename": "mat4",
  5763. "type": 25,
  5764. "count": 1,
  5765. "precision": "highp "
  5766. },
  5767. {
  5768. "name": "cc_matViewProjInv",
  5769. "typename": "mat4",
  5770. "type": 25,
  5771. "count": 1,
  5772. "precision": "highp "
  5773. },
  5774. {
  5775. "name": "cc_cameraPos",
  5776. "typename": "vec4",
  5777. "type": 16,
  5778. "count": 1,
  5779. "precision": "highp "
  5780. },
  5781. {
  5782. "name": "cc_surfaceTransform",
  5783. "typename": "vec4",
  5784. "type": 16,
  5785. "count": 1,
  5786. "precision": "mediump "
  5787. },
  5788. {
  5789. "name": "cc_screenScale",
  5790. "typename": "vec4",
  5791. "type": 16,
  5792. "count": 1,
  5793. "precision": "mediump "
  5794. },
  5795. {
  5796. "name": "cc_exposure",
  5797. "typename": "vec4",
  5798. "type": 16,
  5799. "count": 1,
  5800. "precision": "mediump "
  5801. },
  5802. {
  5803. "name": "cc_mainLitDir",
  5804. "typename": "vec4",
  5805. "type": 16,
  5806. "count": 1,
  5807. "precision": "mediump "
  5808. },
  5809. {
  5810. "name": "cc_mainLitColor",
  5811. "typename": "vec4",
  5812. "type": 16,
  5813. "count": 1,
  5814. "precision": "mediump "
  5815. },
  5816. {
  5817. "name": "cc_ambientSky",
  5818. "typename": "vec4",
  5819. "type": 16,
  5820. "count": 1,
  5821. "precision": "mediump "
  5822. },
  5823. {
  5824. "name": "cc_ambientGround",
  5825. "typename": "vec4",
  5826. "type": 16,
  5827. "count": 1,
  5828. "precision": "mediump "
  5829. },
  5830. {
  5831. "name": "cc_fogColor",
  5832. "typename": "vec4",
  5833. "type": 16,
  5834. "count": 1,
  5835. "precision": "mediump "
  5836. },
  5837. {
  5838. "name": "cc_fogBase",
  5839. "typename": "vec4",
  5840. "type": 16,
  5841. "count": 1,
  5842. "precision": "mediump "
  5843. },
  5844. {
  5845. "name": "cc_fogAdd",
  5846. "typename": "vec4",
  5847. "type": 16,
  5848. "count": 1,
  5849. "precision": "mediump "
  5850. },
  5851. {
  5852. "name": "cc_nearFar",
  5853. "typename": "vec4",
  5854. "type": 16,
  5855. "count": 1,
  5856. "precision": "mediump "
  5857. },
  5858. {
  5859. "name": "cc_viewPort",
  5860. "typename": "vec4",
  5861. "type": 16,
  5862. "count": 1,
  5863. "precision": "mediump "
  5864. }
  5865. ],
  5866. "defines": [],
  5867. "stageFlags": 17
  5868. },
  5869. {
  5870. "tags": {
  5871. "builtin": "global"
  5872. },
  5873. "name": "CCShadow",
  5874. "members": [
  5875. {
  5876. "name": "cc_matLightView",
  5877. "typename": "mat4",
  5878. "type": 25,
  5879. "count": 1,
  5880. "precision": "highp "
  5881. },
  5882. {
  5883. "name": "cc_matLightViewProj",
  5884. "typename": "mat4",
  5885. "type": 25,
  5886. "count": 1,
  5887. "precision": "highp "
  5888. },
  5889. {
  5890. "name": "cc_shadowInvProjDepthInfo",
  5891. "typename": "vec4",
  5892. "type": 16,
  5893. "count": 1,
  5894. "precision": "highp "
  5895. },
  5896. {
  5897. "name": "cc_shadowProjDepthInfo",
  5898. "typename": "vec4",
  5899. "type": 16,
  5900. "count": 1,
  5901. "precision": "highp "
  5902. },
  5903. {
  5904. "name": "cc_shadowProjInfo",
  5905. "typename": "vec4",
  5906. "type": 16,
  5907. "count": 1,
  5908. "precision": "highp "
  5909. },
  5910. {
  5911. "name": "cc_shadowNFLSInfo",
  5912. "typename": "vec4",
  5913. "type": 16,
  5914. "count": 1,
  5915. "precision": "mediump "
  5916. },
  5917. {
  5918. "name": "cc_shadowWHPBInfo",
  5919. "typename": "vec4",
  5920. "type": 16,
  5921. "count": 1,
  5922. "precision": "mediump "
  5923. },
  5924. {
  5925. "name": "cc_shadowLPNNInfo",
  5926. "typename": "vec4",
  5927. "type": 16,
  5928. "count": 1,
  5929. "precision": "mediump "
  5930. },
  5931. {
  5932. "name": "cc_shadowColor",
  5933. "typename": "vec4",
  5934. "type": 16,
  5935. "count": 1,
  5936. "precision": "lowp "
  5937. },
  5938. {
  5939. "name": "cc_planarNDInfo",
  5940. "typename": "vec4",
  5941. "type": 16,
  5942. "count": 1,
  5943. "precision": "mediump "
  5944. }
  5945. ],
  5946. "defines": [],
  5947. "stageFlags": 17
  5948. },
  5949. {
  5950. "tags": {
  5951. "builtin": "global"
  5952. },
  5953. "name": "CCCSM",
  5954. "members": [
  5955. {
  5956. "name": "cc_csmViewDir0",
  5957. "typename": "vec4",
  5958. "type": 16,
  5959. "count": 4,
  5960. "precision": "highp ",
  5961. "isArray": true
  5962. },
  5963. {
  5964. "name": "cc_csmViewDir1",
  5965. "typename": "vec4",
  5966. "type": 16,
  5967. "count": 4,
  5968. "precision": "highp ",
  5969. "isArray": true
  5970. },
  5971. {
  5972. "name": "cc_csmViewDir2",
  5973. "typename": "vec4",
  5974. "type": 16,
  5975. "count": 4,
  5976. "precision": "highp ",
  5977. "isArray": true
  5978. },
  5979. {
  5980. "name": "cc_csmAtlas",
  5981. "typename": "vec4",
  5982. "type": 16,
  5983. "count": 4,
  5984. "precision": "highp ",
  5985. "isArray": true
  5986. },
  5987. {
  5988. "name": "cc_matCSMViewProj",
  5989. "typename": "mat4",
  5990. "type": 25,
  5991. "count": 4,
  5992. "precision": "highp ",
  5993. "isArray": true
  5994. },
  5995. {
  5996. "name": "cc_csmProjDepthInfo",
  5997. "typename": "vec4",
  5998. "type": 16,
  5999. "count": 4,
  6000. "precision": "highp ",
  6001. "isArray": true
  6002. },
  6003. {
  6004. "name": "cc_csmProjInfo",
  6005. "typename": "vec4",
  6006. "type": 16,
  6007. "count": 4,
  6008. "precision": "highp ",
  6009. "isArray": true
  6010. },
  6011. {
  6012. "name": "cc_csmSplitsInfo",
  6013. "typename": "vec4",
  6014. "type": 16,
  6015. "count": 1,
  6016. "precision": "highp "
  6017. }
  6018. ],
  6019. "defines": [
  6020. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  6021. ],
  6022. "stageFlags": 16
  6023. }
  6024. ],
  6025. "samplerTextures": [
  6026. {
  6027. "tags": {
  6028. "builtin": "global"
  6029. },
  6030. "name": "cc_environment",
  6031. "typename": "samplerCube",
  6032. "type": 31,
  6033. "count": 1,
  6034. "defines": [],
  6035. "stageFlags": 16
  6036. },
  6037. {
  6038. "tags": {
  6039. "builtin": "global"
  6040. },
  6041. "name": "cc_diffuseMap",
  6042. "typename": "samplerCube",
  6043. "type": 31,
  6044. "count": 1,
  6045. "defines": [
  6046. "CC_USE_IBL",
  6047. "CC_USE_DIFFUSEMAP"
  6048. ],
  6049. "stageFlags": 16
  6050. },
  6051. {
  6052. "tags": {
  6053. "builtin": "global"
  6054. },
  6055. "name": "cc_shadowMap",
  6056. "typename": "sampler2D",
  6057. "type": 28,
  6058. "count": 1,
  6059. "precision": "highp ",
  6060. "defines": [
  6061. "CC_RECEIVE_SHADOW"
  6062. ],
  6063. "stageFlags": 16
  6064. },
  6065. {
  6066. "tags": {
  6067. "builtin": "global"
  6068. },
  6069. "name": "cc_spotShadowMap",
  6070. "typename": "sampler2D",
  6071. "type": 28,
  6072. "count": 1,
  6073. "precision": "highp ",
  6074. "defines": [
  6075. "CC_RECEIVE_SHADOW"
  6076. ],
  6077. "stageFlags": 16
  6078. }
  6079. ],
  6080. "samplers": [],
  6081. "textures": [],
  6082. "buffers": [],
  6083. "images": [],
  6084. "subpassInputs": []
  6085. }
  6086. ],
  6087. "hash": 2622802007,
  6088. "glsl4": {
  6089. "vert": "#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 3) in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 6) in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n layout(location = 7) in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 8) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 9) in vec4 a_matWorld0;\n layout(location = 10) in vec4 a_matWorld1;\n layout(location = 11) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 12) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 13) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 14) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 15) in vec4 a_sh_linear_const_r;\n layout(location = 16) in vec4 a_sh_linear_const_g;\n layout(location = 17) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nlayout(location = 0) out highp vec3 v_worldPos;\nlayout(location = 1) out vec4 v_normal;\nlayout(location = 2) out vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 3) out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 4) out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n layout(location = 5) out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 6) out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 7) out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 8) out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n layout(location = 9) out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n layout(location = 10) out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n layout(location = 11) out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 12) out mediump vec4 v_sh_linear_const_r;\n layout(location = 13) out mediump vec4 v_sh_linear_const_g;\n layout(location = 14) out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(set = 2, binding = 3) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(set = 2, binding = 2) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n layout(set = 2, binding = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n #endif\n#endif\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nlayout(location = 15) out highp vec2 v_clip_depth;\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matLightViewProj * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexOutput(In);\n v_clip_depth = In.clipPos.zw;\n}",
  6090. "frag": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nlayout(location = 0) in highp vec3 v_worldPos;\nlayout(location = 1) in vec4 v_normal;\nlayout(location = 2) in vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 3) in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 4) in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n layout(location = 5) in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 6) in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 7) in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 8) in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n layout(location = 9) in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n layout(location = 10) in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n layout(location = 11) in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 12) in mediump vec4 v_sh_linear_const_r;\n layout(location = 13) in mediump vec4 v_sh_linear_const_g;\n layout(location = 14) in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(set = 2, binding = 1) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(set = 2, binding = 6) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nlayout(set = 0, binding = 5) uniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n layout(set = 0, binding = 7) uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 15) uniform samplerCube cc_reflectionProbeCubemap;\n layout(set = 2, binding = 16) uniform sampler2D cc_reflectionProbePlanarMap;\n layout(set = 2, binding = 17) uniform sampler2D cc_reflectionProbeDataMap;\n layout(set = 2, binding = 18) uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n ret = fract(ret);\n ret -= vec4(ret.yzw, 0.0) / 255.0;\n return ret;\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(set = 2, binding = 11) uniform sampler2D cc_lightingMap;\n#endif\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#if USE_BASE_COLOR_MAP\n layout(set = 1, binding = 1) uniform sampler2D baseColorMap;\n#endif\n#if USE_NORMAL_MAP\n layout(set = 1, binding = 2) uniform sampler2D normalMap;\n#endif\n#if USE_1ST_SHADE_MAP\n layout(set = 1, binding = 3) uniform sampler2D shadeMap1;\n#endif\n#if USE_2ND_SHADE_MAP\n layout(set = 1, binding = 4) uniform sampler2D shadeMap2;\n#endif\n#if USE_SPECULAR_MAP\n layout(set = 1, binding = 5) uniform sampler2D specularMap;\n#endif\n#if USE_EMISSIVE_MAP\n layout(set = 1, binding = 6) uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\nvoid SurfacesFragmentAlphaClipOnly()\n{\n #if USE_ALPHA_TEST\n float alpha = baseColor.ALPHA_TEST_CHANNEL;\n #if USE_BASE_COLOR_MAP\n alpha = texture(baseColorMap, FSInput_texcoord).ALPHA_TEST_CHANNEL;\n #endif\n if (alpha < colorScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nlayout(location = 15) in highp vec2 v_clip_depth;\nlayout(location = 0) out vec4 fragColorX;\nvoid main () {\n#ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n SurfacesFragmentAlphaClipOnly();\n#endif\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n if (IS_SPOT_LIGHT(cc_shadowLPNNInfo.x)) {\n clipDepth = CCGetLinearDepth(FSInput_worldPos.xyz);\n }\n #endif\n #if CC_SHADOWMAP_FORMAT == 1\n fragColorX = packDepthToRGBA(clipDepth);\n #else\n fragColorX = vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}"
  6091. },
  6092. "glsl3": {
  6093. "vert": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nout highp vec3 v_worldPos;\nout vec4 v_normal;\nout vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n out mediump vec4 v_sh_linear_const_r;\n out mediump vec4 v_sh_linear_const_g;\n out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n #endif\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nout highp vec2 v_clip_depth;\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matLightViewProj * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexOutput(In);\n v_clip_depth = In.clipPos.zw;\n}",
  6094. "frag": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nin highp vec3 v_worldPos;\nin vec4 v_normal;\nin vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n in mediump vec4 v_sh_linear_const_r;\n in mediump vec4 v_sh_linear_const_g;\n in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(std140) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n ret = fract(ret);\n ret -= vec4(ret.yzw, 0.0) / 255.0;\n return ret;\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#if USE_BASE_COLOR_MAP\n uniform sampler2D baseColorMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_1ST_SHADE_MAP\n uniform sampler2D shadeMap1;\n#endif\n#if USE_2ND_SHADE_MAP\n uniform sampler2D shadeMap2;\n#endif\n#if USE_SPECULAR_MAP\n uniform sampler2D specularMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\nvoid SurfacesFragmentAlphaClipOnly()\n{\n #if USE_ALPHA_TEST\n float alpha = baseColor.ALPHA_TEST_CHANNEL;\n #if USE_BASE_COLOR_MAP\n alpha = texture(baseColorMap, FSInput_texcoord).ALPHA_TEST_CHANNEL;\n #endif\n if (alpha < colorScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nin highp vec2 v_clip_depth;\nlayout(location = 0) out vec4 fragColorX;\nvoid main () {\n#ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n SurfacesFragmentAlphaClipOnly();\n#endif\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n if (IS_SPOT_LIGHT(cc_shadowLPNNInfo.x)) {\n clipDepth = CCGetLinearDepth(FSInput_worldPos.xyz);\n }\n #endif\n #if CC_SHADOWMAP_FORMAT == 1\n fragColorX = packDepthToRGBA(clipDepth);\n #else\n fragColorX = vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}"
  6095. },
  6096. "glsl1": {
  6097. "vert": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n attribute vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n attribute vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nuniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matLightViewProj;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n #endif\n#endif\n uniform vec4 tilingOffset;\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvarying highp vec2 v_clip_depth;\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matLightViewProj * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexOutput(In);\n v_clip_depth = In.clipPos.zw;\n}",
  6098. "frag": "\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nuniform mediump vec4 cc_debug_view_mode;\nuniform mediump vec4 cc_surfaceTransform;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n #endif\n#endif\nuniform highp mat4 cc_matLightView;\n uniform mediump vec4 cc_shadowNFLSInfo;\n uniform mediump vec4 cc_shadowLPNNInfo;\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n #endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n ret = fract(ret);\n ret -= vec4(ret.yzw, 0.0) / 255.0;\n return ret;\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n #endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n#endif\n uniform vec4 baseColor;\n uniform vec4 colorScaleAndCutoff;\n#if USE_BASE_COLOR_MAP\n uniform sampler2D baseColorMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_1ST_SHADE_MAP\n uniform sampler2D shadeMap1;\n#endif\n#if USE_2ND_SHADE_MAP\n uniform sampler2D shadeMap2;\n#endif\n#if USE_SPECULAR_MAP\n uniform sampler2D specularMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\nvoid SurfacesFragmentAlphaClipOnly()\n{\n #if USE_ALPHA_TEST\n float alpha = baseColor.ALPHA_TEST_CHANNEL;\n #if USE_BASE_COLOR_MAP\n alpha = texture2D(baseColorMap, FSInput_texcoord).ALPHA_TEST_CHANNEL;\n #endif\n if (alpha < colorScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nvarying highp vec2 v_clip_depth;\nvoid main () {\n#ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n SurfacesFragmentAlphaClipOnly();\n#endif\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n if (IS_SPOT_LIGHT(cc_shadowLPNNInfo.x)) {\n clipDepth = CCGetLinearDepth(FSInput_worldPos.xyz);\n }\n #endif\n #if CC_SHADOWMAP_FORMAT == 1\n gl_FragColor = packDepthToRGBA(clipDepth);\n #else\n gl_FragColor = vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}"
  6099. },
  6100. "builtins": {
  6101. "globals": {
  6102. "blocks": [
  6103. {
  6104. "name": "CCGlobal",
  6105. "defines": []
  6106. },
  6107. {
  6108. "name": "CCCamera",
  6109. "defines": []
  6110. },
  6111. {
  6112. "name": "CCShadow",
  6113. "defines": []
  6114. },
  6115. {
  6116. "name": "CCCSM",
  6117. "defines": [
  6118. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  6119. ]
  6120. }
  6121. ],
  6122. "samplerTextures": [
  6123. {
  6124. "name": "cc_environment",
  6125. "defines": []
  6126. },
  6127. {
  6128. "name": "cc_diffuseMap",
  6129. "defines": [
  6130. "CC_USE_IBL",
  6131. "CC_USE_DIFFUSEMAP"
  6132. ]
  6133. },
  6134. {
  6135. "name": "cc_shadowMap",
  6136. "defines": [
  6137. "CC_RECEIVE_SHADOW"
  6138. ]
  6139. },
  6140. {
  6141. "name": "cc_spotShadowMap",
  6142. "defines": [
  6143. "CC_RECEIVE_SHADOW"
  6144. ]
  6145. }
  6146. ],
  6147. "buffers": [],
  6148. "images": []
  6149. },
  6150. "locals": {
  6151. "blocks": [
  6152. {
  6153. "name": "CCLocal",
  6154. "defines": [
  6155. "!USE_INSTANCING"
  6156. ]
  6157. },
  6158. {
  6159. "name": "CCMorph",
  6160. "defines": [
  6161. "CC_USE_MORPH"
  6162. ]
  6163. },
  6164. {
  6165. "name": "CCSkinningTexture",
  6166. "defines": [
  6167. "CC_USE_SKINNING",
  6168. "CC_USE_BAKED_ANIMATION"
  6169. ]
  6170. },
  6171. {
  6172. "name": "CCSkinningAnimation",
  6173. "defines": [
  6174. "CC_USE_SKINNING",
  6175. "CC_USE_BAKED_ANIMATION"
  6176. ]
  6177. },
  6178. {
  6179. "name": "CCSkinning",
  6180. "defines": [
  6181. "CC_USE_SKINNING",
  6182. "!CC_USE_BAKED_ANIMATION",
  6183. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  6184. ]
  6185. },
  6186. {
  6187. "name": "CCForwardLight",
  6188. "defines": [
  6189. "CC_FORWARD_ADD",
  6190. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  6191. ]
  6192. },
  6193. {
  6194. "name": "CCSH",
  6195. "defines": [
  6196. "CC_USE_LIGHT_PROBE",
  6197. "!USE_INSTANCING"
  6198. ]
  6199. }
  6200. ],
  6201. "samplerTextures": [
  6202. {
  6203. "name": "cc_PositionDisplacements",
  6204. "defines": [
  6205. "CC_USE_MORPH",
  6206. "CC_MORPH_TARGET_HAS_POSITION"
  6207. ]
  6208. },
  6209. {
  6210. "name": "cc_NormalDisplacements",
  6211. "defines": [
  6212. "CC_USE_MORPH",
  6213. "CC_MORPH_TARGET_HAS_NORMAL"
  6214. ]
  6215. },
  6216. {
  6217. "name": "cc_TangentDisplacements",
  6218. "defines": [
  6219. "CC_USE_MORPH",
  6220. "CC_MORPH_TARGET_HAS_TANGENT"
  6221. ]
  6222. },
  6223. {
  6224. "name": "cc_jointTexture",
  6225. "defines": [
  6226. "CC_USE_SKINNING",
  6227. "CC_USE_BAKED_ANIMATION"
  6228. ]
  6229. },
  6230. {
  6231. "name": "cc_realtimeJoint",
  6232. "defines": [
  6233. "CC_USE_SKINNING",
  6234. "!CC_USE_BAKED_ANIMATION",
  6235. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  6236. ]
  6237. },
  6238. {
  6239. "name": "cc_reflectionProbeCubemap",
  6240. "defines": [
  6241. "CC_USE_REFLECTION_PROBE"
  6242. ]
  6243. },
  6244. {
  6245. "name": "cc_reflectionProbePlanarMap",
  6246. "defines": [
  6247. "CC_USE_REFLECTION_PROBE"
  6248. ]
  6249. },
  6250. {
  6251. "name": "cc_reflectionProbeDataMap",
  6252. "defines": [
  6253. "CC_USE_REFLECTION_PROBE"
  6254. ]
  6255. },
  6256. {
  6257. "name": "cc_reflectionProbeBlendCubemap",
  6258. "defines": [
  6259. "CC_USE_REFLECTION_PROBE"
  6260. ]
  6261. },
  6262. {
  6263. "name": "cc_lightingMap",
  6264. "defines": [
  6265. "CC_USE_LIGHTMAP",
  6266. "!CC_FORWARD_ADD"
  6267. ]
  6268. }
  6269. ],
  6270. "buffers": [],
  6271. "images": []
  6272. },
  6273. "statistics": {
  6274. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 100,
  6275. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 130
  6276. }
  6277. },
  6278. "defines": [
  6279. {
  6280. "name": "USE_COMPATIBLE_LIGHTING",
  6281. "type": "boolean",
  6282. "defines": []
  6283. },
  6284. {
  6285. "name": "USE_NORMAL_MAP",
  6286. "type": "boolean",
  6287. "defines": []
  6288. },
  6289. {
  6290. "name": "USE_INSTANCING",
  6291. "type": "boolean",
  6292. "defines": [],
  6293. "editor": {
  6294. "elevated": true
  6295. }
  6296. },
  6297. {
  6298. "name": "CC_USE_LIGHTMAP",
  6299. "type": "boolean",
  6300. "defines": []
  6301. },
  6302. {
  6303. "name": "CC_USE_SKINNING",
  6304. "type": "boolean",
  6305. "defines": []
  6306. },
  6307. {
  6308. "name": "CC_USE_BAKED_ANIMATION",
  6309. "type": "boolean",
  6310. "defines": [
  6311. "USE_INSTANCING"
  6312. ]
  6313. },
  6314. {
  6315. "name": "CC_RECEIVE_SHADOW",
  6316. "type": "boolean",
  6317. "defines": []
  6318. },
  6319. {
  6320. "name": "CC_USE_REFLECTION_PROBE",
  6321. "type": "number",
  6322. "defines": [],
  6323. "range": [
  6324. 0,
  6325. 3
  6326. ]
  6327. },
  6328. {
  6329. "name": "CC_USE_LIGHT_PROBE",
  6330. "type": "boolean",
  6331. "defines": [],
  6332. "default": 0
  6333. },
  6334. {
  6335. "name": "CC_USE_MORPH",
  6336. "type": "boolean",
  6337. "defines": []
  6338. },
  6339. {
  6340. "name": "CC_FORWARD_ADD",
  6341. "type": "boolean",
  6342. "defines": []
  6343. },
  6344. {
  6345. "name": "CC_USE_FOG",
  6346. "type": "number",
  6347. "defines": [],
  6348. "range": [
  6349. 0,
  6350. 4
  6351. ]
  6352. },
  6353. {
  6354. "name": "CC_USE_ACCURATE_FOG",
  6355. "type": "boolean",
  6356. "defines": [
  6357. "CC_USE_FOG"
  6358. ]
  6359. },
  6360. {
  6361. "name": "CC_MORPH_TARGET_COUNT",
  6362. "type": "number",
  6363. "defines": [
  6364. "CC_USE_MORPH"
  6365. ],
  6366. "range": [
  6367. 2,
  6368. 8
  6369. ]
  6370. },
  6371. {
  6372. "name": "CC_MORPH_TARGET_HAS_POSITION",
  6373. "type": "boolean",
  6374. "defines": [
  6375. "CC_USE_MORPH"
  6376. ]
  6377. },
  6378. {
  6379. "name": "CC_MORPH_TARGET_HAS_NORMAL",
  6380. "type": "boolean",
  6381. "defines": [
  6382. "CC_USE_MORPH"
  6383. ]
  6384. },
  6385. {
  6386. "name": "CC_MORPH_TARGET_HAS_TANGENT",
  6387. "type": "boolean",
  6388. "defines": [
  6389. "CC_USE_MORPH"
  6390. ]
  6391. },
  6392. {
  6393. "name": "CC_MORPH_PRECOMPUTED",
  6394. "type": "boolean",
  6395. "defines": [
  6396. "CC_USE_MORPH"
  6397. ]
  6398. },
  6399. {
  6400. "name": "CC_USE_REAL_TIME_JOINT_TEXTURE",
  6401. "type": "boolean",
  6402. "defines": [
  6403. "CC_USE_SKINNING",
  6404. "!CC_USE_BAKED_ANIMATION"
  6405. ]
  6406. },
  6407. {
  6408. "name": "CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER",
  6409. "type": "number",
  6410. "defines": [],
  6411. "range": [
  6412. 0,
  6413. 1
  6414. ]
  6415. },
  6416. {
  6417. "name": "CC_PIPELINE_TYPE",
  6418. "type": "number",
  6419. "defines": [],
  6420. "range": [
  6421. 0,
  6422. 1
  6423. ]
  6424. },
  6425. {
  6426. "name": "CC_FORCE_FORWARD_SHADING",
  6427. "type": "boolean",
  6428. "defines": [
  6429. "CC_PIPELINE_TYPE"
  6430. ]
  6431. },
  6432. {
  6433. "name": "CC_ENABLE_CLUSTERED_LIGHT_CULLING",
  6434. "type": "number",
  6435. "defines": [
  6436. "CC_FORWARD_ADD"
  6437. ],
  6438. "range": [
  6439. 0,
  6440. 3
  6441. ]
  6442. },
  6443. {
  6444. "name": "CC_SUPPORT_CASCADED_SHADOW_MAP",
  6445. "type": "boolean",
  6446. "defines": []
  6447. },
  6448. {
  6449. "name": "CC_USE_IBL",
  6450. "type": "number",
  6451. "defines": [],
  6452. "range": [
  6453. 0,
  6454. 2
  6455. ]
  6456. },
  6457. {
  6458. "name": "CC_USE_DIFFUSEMAP",
  6459. "type": "number",
  6460. "defines": [
  6461. "CC_USE_IBL"
  6462. ],
  6463. "range": [
  6464. 0,
  6465. 2
  6466. ]
  6467. },
  6468. {
  6469. "name": "USE_BASE_COLOR_MAP",
  6470. "type": "boolean",
  6471. "defines": []
  6472. },
  6473. {
  6474. "name": "USE_1ST_SHADE_MAP",
  6475. "type": "boolean",
  6476. "defines": []
  6477. },
  6478. {
  6479. "name": "USE_2ND_SHADE_MAP",
  6480. "type": "boolean",
  6481. "defines": []
  6482. },
  6483. {
  6484. "name": "USE_SPECULAR_MAP",
  6485. "type": "boolean",
  6486. "defines": []
  6487. },
  6488. {
  6489. "name": "USE_EMISSIVE_MAP",
  6490. "type": "boolean",
  6491. "defines": []
  6492. },
  6493. {
  6494. "name": "USE_ALPHA_TEST",
  6495. "type": "boolean",
  6496. "defines": []
  6497. },
  6498. {
  6499. "name": "ALPHA_TEST_CHANNEL",
  6500. "type": "string",
  6501. "defines": [
  6502. "USE_ALPHA_TEST"
  6503. ],
  6504. "options": [
  6505. "a",
  6506. "r",
  6507. "g",
  6508. "b"
  6509. ]
  6510. },
  6511. {
  6512. "name": "CC_SHADOWMAP_USE_LINEAR_DEPTH",
  6513. "type": "boolean",
  6514. "defines": []
  6515. },
  6516. {
  6517. "name": "CC_SHADOWMAP_FORMAT",
  6518. "type": "number",
  6519. "defines": [],
  6520. "range": [
  6521. 0,
  6522. 3
  6523. ]
  6524. }
  6525. ],
  6526. "name": "builtin-toon|shadow-caster-vs|shadow-caster-fs"
  6527. },
  6528. {
  6529. "blocks": [
  6530. {
  6531. "name": "Constants",
  6532. "members": [
  6533. {
  6534. "name": "tilingOffset",
  6535. "type": 16,
  6536. "count": 1
  6537. },
  6538. {
  6539. "name": "baseColor",
  6540. "type": 16,
  6541. "count": 1
  6542. },
  6543. {
  6544. "name": "colorScaleAndCutoff",
  6545. "type": 16,
  6546. "count": 1
  6547. },
  6548. {
  6549. "name": "shadeColor1",
  6550. "type": 16,
  6551. "count": 1
  6552. },
  6553. {
  6554. "name": "shadeColor2",
  6555. "type": 16,
  6556. "count": 1
  6557. },
  6558. {
  6559. "name": "specular",
  6560. "type": 16,
  6561. "count": 1
  6562. },
  6563. {
  6564. "name": "shadeParams",
  6565. "type": 16,
  6566. "count": 1
  6567. },
  6568. {
  6569. "name": "miscParams",
  6570. "type": 16,
  6571. "count": 1
  6572. },
  6573. {
  6574. "name": "emissive",
  6575. "type": 16,
  6576. "count": 1
  6577. },
  6578. {
  6579. "name": "emissiveScaleAndStrenth",
  6580. "type": 16,
  6581. "count": 1
  6582. }
  6583. ],
  6584. "defines": [],
  6585. "stageFlags": 17,
  6586. "binding": 0
  6587. }
  6588. ],
  6589. "samplerTextures": [
  6590. {
  6591. "name": "baseColorMap",
  6592. "type": 28,
  6593. "count": 1,
  6594. "defines": [
  6595. "USE_BASE_COLOR_MAP"
  6596. ],
  6597. "stageFlags": 16,
  6598. "binding": 1
  6599. },
  6600. {
  6601. "name": "normalMap",
  6602. "type": 28,
  6603. "count": 1,
  6604. "defines": [
  6605. "USE_NORMAL_MAP"
  6606. ],
  6607. "stageFlags": 16,
  6608. "binding": 2
  6609. },
  6610. {
  6611. "name": "shadeMap1",
  6612. "type": 28,
  6613. "count": 1,
  6614. "defines": [
  6615. "USE_1ST_SHADE_MAP"
  6616. ],
  6617. "stageFlags": 16,
  6618. "binding": 3
  6619. },
  6620. {
  6621. "name": "shadeMap2",
  6622. "type": 28,
  6623. "count": 1,
  6624. "defines": [
  6625. "USE_2ND_SHADE_MAP"
  6626. ],
  6627. "stageFlags": 16,
  6628. "binding": 4
  6629. },
  6630. {
  6631. "name": "specularMap",
  6632. "type": 28,
  6633. "count": 1,
  6634. "defines": [
  6635. "USE_SPECULAR_MAP"
  6636. ],
  6637. "stageFlags": 16,
  6638. "binding": 5
  6639. },
  6640. {
  6641. "name": "emissiveMap",
  6642. "type": 28,
  6643. "count": 1,
  6644. "defines": [
  6645. "USE_EMISSIVE_MAP"
  6646. ],
  6647. "stageFlags": 16,
  6648. "binding": 6
  6649. }
  6650. ],
  6651. "samplers": [],
  6652. "textures": [],
  6653. "buffers": [],
  6654. "images": [],
  6655. "subpassInputs": [],
  6656. "attributes": [
  6657. {
  6658. "name": "a_position",
  6659. "defines": [],
  6660. "format": 32,
  6661. "location": 0
  6662. },
  6663. {
  6664. "name": "a_normal",
  6665. "defines": [],
  6666. "format": 32,
  6667. "location": 1
  6668. },
  6669. {
  6670. "name": "a_texCoord",
  6671. "defines": [],
  6672. "format": 21,
  6673. "location": 2
  6674. },
  6675. {
  6676. "name": "a_tangent",
  6677. "defines": [
  6678. "USE_NORMAL_MAP"
  6679. ],
  6680. "format": 44,
  6681. "location": 3
  6682. },
  6683. {
  6684. "name": "a_color",
  6685. "defines": [],
  6686. "format": 44,
  6687. "location": 6
  6688. },
  6689. {
  6690. "name": "a_texCoord1",
  6691. "defines": [],
  6692. "format": 21,
  6693. "location": 7
  6694. },
  6695. {
  6696. "name": "a_joints",
  6697. "defines": [
  6698. "CC_USE_SKINNING"
  6699. ],
  6700. "location": 4
  6701. },
  6702. {
  6703. "name": "a_weights",
  6704. "defines": [
  6705. "CC_USE_SKINNING"
  6706. ],
  6707. "format": 44,
  6708. "location": 5
  6709. },
  6710. {
  6711. "name": "a_jointAnimInfo",
  6712. "defines": [
  6713. "USE_INSTANCING",
  6714. "CC_USE_BAKED_ANIMATION"
  6715. ],
  6716. "format": 44,
  6717. "isInstanced": true,
  6718. "location": 8
  6719. },
  6720. {
  6721. "name": "a_matWorld0",
  6722. "defines": [
  6723. "USE_INSTANCING"
  6724. ],
  6725. "format": 44,
  6726. "isInstanced": true,
  6727. "location": 9
  6728. },
  6729. {
  6730. "name": "a_matWorld1",
  6731. "defines": [
  6732. "USE_INSTANCING"
  6733. ],
  6734. "format": 44,
  6735. "isInstanced": true,
  6736. "location": 10
  6737. },
  6738. {
  6739. "name": "a_matWorld2",
  6740. "defines": [
  6741. "USE_INSTANCING"
  6742. ],
  6743. "format": 44,
  6744. "isInstanced": true,
  6745. "location": 11
  6746. },
  6747. {
  6748. "name": "a_lightingMapUVParam",
  6749. "defines": [
  6750. "USE_INSTANCING",
  6751. "CC_USE_LIGHTMAP"
  6752. ],
  6753. "format": 44,
  6754. "isInstanced": true,
  6755. "location": 12
  6756. },
  6757. {
  6758. "name": "a_localShadowBiasAndProbeId",
  6759. "defines": [
  6760. "USE_INSTANCING"
  6761. ],
  6762. "format": 44,
  6763. "isInstanced": true,
  6764. "location": 13
  6765. },
  6766. {
  6767. "name": "a_reflectionProbeData",
  6768. "defines": [
  6769. "USE_INSTANCING",
  6770. "CC_USE_REFLECTION_PROBE"
  6771. ],
  6772. "format": 44,
  6773. "isInstanced": true,
  6774. "location": 14
  6775. },
  6776. {
  6777. "name": "a_sh_linear_const_r",
  6778. "defines": [
  6779. "USE_INSTANCING",
  6780. "CC_USE_LIGHT_PROBE"
  6781. ],
  6782. "format": 44,
  6783. "isInstanced": true,
  6784. "location": 15
  6785. },
  6786. {
  6787. "name": "a_sh_linear_const_g",
  6788. "defines": [
  6789. "USE_INSTANCING",
  6790. "CC_USE_LIGHT_PROBE"
  6791. ],
  6792. "format": 44,
  6793. "isInstanced": true,
  6794. "location": 16
  6795. },
  6796. {
  6797. "name": "a_sh_linear_const_b",
  6798. "defines": [
  6799. "USE_INSTANCING",
  6800. "CC_USE_LIGHT_PROBE"
  6801. ],
  6802. "format": 44,
  6803. "isInstanced": true,
  6804. "location": 17
  6805. },
  6806. {
  6807. "name": "a_vertexId",
  6808. "defines": [
  6809. "CC_USE_MORPH"
  6810. ],
  6811. "format": 11,
  6812. "location": 18
  6813. }
  6814. ],
  6815. "varyings": [
  6816. {
  6817. "name": "v_worldPos",
  6818. "type": 15,
  6819. "count": 1,
  6820. "defines": [],
  6821. "stageFlags": 17,
  6822. "location": 0
  6823. },
  6824. {
  6825. "name": "v_normal",
  6826. "type": 16,
  6827. "count": 1,
  6828. "defines": [],
  6829. "stageFlags": 17,
  6830. "location": 1
  6831. },
  6832. {
  6833. "name": "v_uv",
  6834. "type": 14,
  6835. "count": 1,
  6836. "defines": [],
  6837. "stageFlags": 17,
  6838. "location": 2
  6839. },
  6840. {
  6841. "name": "v_color",
  6842. "type": 16,
  6843. "count": 1,
  6844. "defines": [],
  6845. "stageFlags": 17,
  6846. "location": 3
  6847. },
  6848. {
  6849. "name": "v_tangent",
  6850. "type": 16,
  6851. "count": 1,
  6852. "defines": [],
  6853. "stageFlags": 17,
  6854. "location": 4
  6855. },
  6856. {
  6857. "name": "v_uv1",
  6858. "type": 14,
  6859. "count": 1,
  6860. "defines": [],
  6861. "stageFlags": 17,
  6862. "location": 5
  6863. },
  6864. {
  6865. "name": "v_luv",
  6866. "type": 15,
  6867. "count": 1,
  6868. "defines": [
  6869. "CC_USE_LIGHTMAP",
  6870. "!CC_FORWARD_ADD"
  6871. ],
  6872. "stageFlags": 17,
  6873. "location": 6
  6874. },
  6875. {
  6876. "name": "v_shadowBiasAndProbeId",
  6877. "type": 16,
  6878. "count": 1,
  6879. "defines": [],
  6880. "stageFlags": 17,
  6881. "location": 7
  6882. },
  6883. {
  6884. "name": "v_reflectionProbeData",
  6885. "type": 16,
  6886. "count": 1,
  6887. "defines": [
  6888. "CC_USE_REFLECTION_PROBE",
  6889. "USE_INSTANCING"
  6890. ],
  6891. "stageFlags": 17,
  6892. "location": 8
  6893. },
  6894. {
  6895. "name": "v_fogFactor",
  6896. "type": 13,
  6897. "count": 1,
  6898. "defines": [
  6899. "CC_USE_FOG",
  6900. "!CC_USE_ACCURATE_FOG"
  6901. ],
  6902. "stageFlags": 17,
  6903. "location": 9
  6904. },
  6905. {
  6906. "name": "v_localPos",
  6907. "type": 16,
  6908. "count": 1,
  6909. "defines": [],
  6910. "stageFlags": 17,
  6911. "location": 10
  6912. },
  6913. {
  6914. "name": "v_clipPos",
  6915. "type": 16,
  6916. "count": 1,
  6917. "defines": [],
  6918. "stageFlags": 17,
  6919. "location": 11
  6920. },
  6921. {
  6922. "name": "v_sh_linear_const_r",
  6923. "type": 16,
  6924. "count": 1,
  6925. "defines": [
  6926. "CC_USE_LIGHT_PROBE",
  6927. "USE_INSTANCING"
  6928. ],
  6929. "stageFlags": 17,
  6930. "location": 12
  6931. },
  6932. {
  6933. "name": "v_sh_linear_const_g",
  6934. "type": 16,
  6935. "count": 1,
  6936. "defines": [
  6937. "CC_USE_LIGHT_PROBE",
  6938. "USE_INSTANCING"
  6939. ],
  6940. "stageFlags": 17,
  6941. "location": 13
  6942. },
  6943. {
  6944. "name": "v_sh_linear_const_b",
  6945. "type": 16,
  6946. "count": 1,
  6947. "defines": [
  6948. "CC_USE_LIGHT_PROBE",
  6949. "USE_INSTANCING"
  6950. ],
  6951. "stageFlags": 17,
  6952. "location": 14
  6953. },
  6954. {
  6955. "name": "v_dist",
  6956. "type": 13,
  6957. "count": 1,
  6958. "defines": [],
  6959. "stageFlags": 17,
  6960. "location": 15
  6961. }
  6962. ],
  6963. "fragColors": [
  6964. {
  6965. "name": "fragColorX",
  6966. "typename": "vec4",
  6967. "type": 16,
  6968. "count": 1,
  6969. "defines": [],
  6970. "stageFlags": 16,
  6971. "location": 0
  6972. }
  6973. ],
  6974. "descriptors": [
  6975. {
  6976. "rate": 0,
  6977. "blocks": [
  6978. {
  6979. "tags": {
  6980. "builtin": "local"
  6981. },
  6982. "name": "CCLocal",
  6983. "members": [
  6984. {
  6985. "name": "cc_matWorld",
  6986. "typename": "mat4",
  6987. "type": 25,
  6988. "count": 1,
  6989. "precision": "highp "
  6990. },
  6991. {
  6992. "name": "cc_matWorldIT",
  6993. "typename": "mat4",
  6994. "type": 25,
  6995. "count": 1,
  6996. "precision": "highp "
  6997. },
  6998. {
  6999. "name": "cc_lightingMapUVParam",
  7000. "typename": "vec4",
  7001. "type": 16,
  7002. "count": 1,
  7003. "precision": "highp "
  7004. },
  7005. {
  7006. "name": "cc_localShadowBias",
  7007. "typename": "vec4",
  7008. "type": 16,
  7009. "count": 1,
  7010. "precision": "highp "
  7011. },
  7012. {
  7013. "name": "cc_reflectionProbeData1",
  7014. "typename": "vec4",
  7015. "type": 16,
  7016. "count": 1,
  7017. "precision": "highp "
  7018. },
  7019. {
  7020. "name": "cc_reflectionProbeData2",
  7021. "typename": "vec4",
  7022. "type": 16,
  7023. "count": 1,
  7024. "precision": "highp "
  7025. },
  7026. {
  7027. "name": "cc_reflectionProbeBlendData1",
  7028. "typename": "vec4",
  7029. "type": 16,
  7030. "count": 1,
  7031. "precision": "highp "
  7032. },
  7033. {
  7034. "name": "cc_reflectionProbeBlendData2",
  7035. "typename": "vec4",
  7036. "type": 16,
  7037. "count": 1,
  7038. "precision": "highp "
  7039. }
  7040. ],
  7041. "defines": [
  7042. "!USE_INSTANCING"
  7043. ],
  7044. "stageFlags": 17
  7045. },
  7046. {
  7047. "tags": {
  7048. "builtin": "local"
  7049. },
  7050. "name": "CCMorph",
  7051. "members": [
  7052. {
  7053. "name": "cc_displacementWeights",
  7054. "typename": "vec4",
  7055. "type": 16,
  7056. "count": 15,
  7057. "isArray": true
  7058. },
  7059. {
  7060. "name": "cc_displacementTextureInfo",
  7061. "typename": "vec4",
  7062. "type": 16,
  7063. "count": 1
  7064. }
  7065. ],
  7066. "defines": [
  7067. "CC_USE_MORPH"
  7068. ],
  7069. "stageFlags": 1
  7070. },
  7071. {
  7072. "tags": {
  7073. "builtin": "local"
  7074. },
  7075. "name": "CCSkinningTexture",
  7076. "members": [
  7077. {
  7078. "name": "cc_jointTextureInfo",
  7079. "typename": "vec4",
  7080. "type": 16,
  7081. "count": 1,
  7082. "precision": "highp "
  7083. }
  7084. ],
  7085. "defines": [
  7086. "CC_USE_SKINNING",
  7087. "CC_USE_BAKED_ANIMATION"
  7088. ],
  7089. "stageFlags": 1
  7090. },
  7091. {
  7092. "tags": {
  7093. "builtin": "local"
  7094. },
  7095. "name": "CCSkinningAnimation",
  7096. "members": [
  7097. {
  7098. "name": "cc_jointAnimInfo",
  7099. "typename": "vec4",
  7100. "type": 16,
  7101. "count": 1,
  7102. "precision": "highp "
  7103. }
  7104. ],
  7105. "defines": [
  7106. "CC_USE_SKINNING",
  7107. "CC_USE_BAKED_ANIMATION"
  7108. ],
  7109. "stageFlags": 1
  7110. },
  7111. {
  7112. "tags": {
  7113. "builtin": "local"
  7114. },
  7115. "name": "CCSkinning",
  7116. "members": [
  7117. {
  7118. "name": "cc_joints",
  7119. "typename": "vec4",
  7120. "type": 16,
  7121. "count": 0,
  7122. "precision": "highp ",
  7123. "isArray": true
  7124. }
  7125. ],
  7126. "defines": [
  7127. "CC_USE_SKINNING",
  7128. "!CC_USE_BAKED_ANIMATION",
  7129. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  7130. ],
  7131. "stageFlags": 1
  7132. },
  7133. {
  7134. "tags": {
  7135. "builtin": "local"
  7136. },
  7137. "name": "CCForwardLight",
  7138. "members": [
  7139. {
  7140. "name": "cc_lightPos",
  7141. "typename": "vec4",
  7142. "type": 16,
  7143. "count": 0,
  7144. "precision": "highp ",
  7145. "isArray": true
  7146. },
  7147. {
  7148. "name": "cc_lightColor",
  7149. "typename": "vec4",
  7150. "type": 16,
  7151. "count": 0,
  7152. "isArray": true
  7153. },
  7154. {
  7155. "name": "cc_lightSizeRangeAngle",
  7156. "typename": "vec4",
  7157. "type": 16,
  7158. "count": 0,
  7159. "isArray": true
  7160. },
  7161. {
  7162. "name": "cc_lightDir",
  7163. "typename": "vec4",
  7164. "type": 16,
  7165. "count": 0,
  7166. "isArray": true
  7167. },
  7168. {
  7169. "name": "cc_lightBoundingSizeVS",
  7170. "typename": "vec4",
  7171. "type": 16,
  7172. "count": 0,
  7173. "isArray": true
  7174. }
  7175. ],
  7176. "defines": [
  7177. "CC_FORWARD_ADD",
  7178. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  7179. ],
  7180. "stageFlags": 16
  7181. },
  7182. {
  7183. "tags": {
  7184. "builtin": "local"
  7185. },
  7186. "name": "CCSH",
  7187. "members": [
  7188. {
  7189. "name": "cc_sh_linear_const_r",
  7190. "typename": "vec4",
  7191. "type": 16,
  7192. "count": 1
  7193. },
  7194. {
  7195. "name": "cc_sh_linear_const_g",
  7196. "typename": "vec4",
  7197. "type": 16,
  7198. "count": 1
  7199. },
  7200. {
  7201. "name": "cc_sh_linear_const_b",
  7202. "typename": "vec4",
  7203. "type": 16,
  7204. "count": 1
  7205. },
  7206. {
  7207. "name": "cc_sh_quadratic_r",
  7208. "typename": "vec4",
  7209. "type": 16,
  7210. "count": 1
  7211. },
  7212. {
  7213. "name": "cc_sh_quadratic_g",
  7214. "typename": "vec4",
  7215. "type": 16,
  7216. "count": 1
  7217. },
  7218. {
  7219. "name": "cc_sh_quadratic_b",
  7220. "typename": "vec4",
  7221. "type": 16,
  7222. "count": 1
  7223. },
  7224. {
  7225. "name": "cc_sh_quadratic_a",
  7226. "typename": "vec4",
  7227. "type": 16,
  7228. "count": 1
  7229. }
  7230. ],
  7231. "defines": [
  7232. "CC_USE_LIGHT_PROBE",
  7233. "!USE_INSTANCING"
  7234. ],
  7235. "stageFlags": 16
  7236. }
  7237. ],
  7238. "samplerTextures": [
  7239. {
  7240. "tags": {
  7241. "builtin": "local"
  7242. },
  7243. "name": "cc_PositionDisplacements",
  7244. "typename": "sampler2D",
  7245. "type": 28,
  7246. "count": 1,
  7247. "defines": [
  7248. "CC_USE_MORPH",
  7249. "CC_MORPH_TARGET_HAS_POSITION"
  7250. ],
  7251. "stageFlags": 1
  7252. },
  7253. {
  7254. "tags": {
  7255. "builtin": "local"
  7256. },
  7257. "name": "cc_NormalDisplacements",
  7258. "typename": "sampler2D",
  7259. "type": 28,
  7260. "count": 1,
  7261. "defines": [
  7262. "CC_USE_MORPH",
  7263. "CC_MORPH_TARGET_HAS_NORMAL"
  7264. ],
  7265. "stageFlags": 1
  7266. },
  7267. {
  7268. "tags": {
  7269. "builtin": "local"
  7270. },
  7271. "name": "cc_TangentDisplacements",
  7272. "typename": "sampler2D",
  7273. "type": 28,
  7274. "count": 1,
  7275. "defines": [
  7276. "CC_USE_MORPH",
  7277. "CC_MORPH_TARGET_HAS_TANGENT"
  7278. ],
  7279. "stageFlags": 1
  7280. },
  7281. {
  7282. "tags": {
  7283. "builtin": "local"
  7284. },
  7285. "name": "cc_jointTexture",
  7286. "typename": "sampler2D",
  7287. "type": 28,
  7288. "count": 1,
  7289. "precision": "highp ",
  7290. "defines": [
  7291. "CC_USE_SKINNING",
  7292. "CC_USE_BAKED_ANIMATION"
  7293. ],
  7294. "stageFlags": 1
  7295. },
  7296. {
  7297. "tags": {
  7298. "builtin": "local"
  7299. },
  7300. "name": "cc_realtimeJoint",
  7301. "typename": "sampler2D",
  7302. "type": 28,
  7303. "count": 1,
  7304. "precision": "highp ",
  7305. "defines": [
  7306. "CC_USE_SKINNING",
  7307. "!CC_USE_BAKED_ANIMATION",
  7308. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  7309. ],
  7310. "stageFlags": 1
  7311. },
  7312. {
  7313. "tags": {
  7314. "builtin": "local"
  7315. },
  7316. "name": "cc_reflectionProbeCubemap",
  7317. "typename": "samplerCube",
  7318. "type": 31,
  7319. "count": 1,
  7320. "defines": [
  7321. "CC_USE_REFLECTION_PROBE"
  7322. ],
  7323. "stageFlags": 16
  7324. },
  7325. {
  7326. "tags": {
  7327. "builtin": "local"
  7328. },
  7329. "name": "cc_reflectionProbePlanarMap",
  7330. "typename": "sampler2D",
  7331. "type": 28,
  7332. "count": 1,
  7333. "defines": [
  7334. "CC_USE_REFLECTION_PROBE"
  7335. ],
  7336. "stageFlags": 16
  7337. },
  7338. {
  7339. "tags": {
  7340. "builtin": "local"
  7341. },
  7342. "name": "cc_reflectionProbeDataMap",
  7343. "typename": "sampler2D",
  7344. "type": 28,
  7345. "count": 1,
  7346. "defines": [
  7347. "CC_USE_REFLECTION_PROBE"
  7348. ],
  7349. "stageFlags": 16
  7350. },
  7351. {
  7352. "tags": {
  7353. "builtin": "local"
  7354. },
  7355. "name": "cc_reflectionProbeBlendCubemap",
  7356. "typename": "samplerCube",
  7357. "type": 31,
  7358. "count": 1,
  7359. "defines": [
  7360. "CC_USE_REFLECTION_PROBE"
  7361. ],
  7362. "stageFlags": 16
  7363. },
  7364. {
  7365. "tags": {
  7366. "builtin": "local"
  7367. },
  7368. "name": "cc_lightingMap",
  7369. "typename": "sampler2D",
  7370. "type": 28,
  7371. "count": 1,
  7372. "defines": [
  7373. "CC_USE_LIGHTMAP",
  7374. "!CC_FORWARD_ADD"
  7375. ],
  7376. "stageFlags": 16
  7377. }
  7378. ],
  7379. "samplers": [],
  7380. "textures": [],
  7381. "buffers": [],
  7382. "images": [],
  7383. "subpassInputs": []
  7384. },
  7385. {
  7386. "rate": 1,
  7387. "blocks": [
  7388. {
  7389. "name": "Constants",
  7390. "members": [
  7391. {
  7392. "name": "tilingOffset",
  7393. "type": 16,
  7394. "count": 1
  7395. },
  7396. {
  7397. "name": "baseColor",
  7398. "type": 16,
  7399. "count": 1
  7400. },
  7401. {
  7402. "name": "colorScaleAndCutoff",
  7403. "type": 16,
  7404. "count": 1
  7405. },
  7406. {
  7407. "name": "shadeColor1",
  7408. "type": 16,
  7409. "count": 1
  7410. },
  7411. {
  7412. "name": "shadeColor2",
  7413. "type": 16,
  7414. "count": 1
  7415. },
  7416. {
  7417. "name": "specular",
  7418. "type": 16,
  7419. "count": 1
  7420. },
  7421. {
  7422. "name": "shadeParams",
  7423. "type": 16,
  7424. "count": 1
  7425. },
  7426. {
  7427. "name": "miscParams",
  7428. "type": 16,
  7429. "count": 1
  7430. },
  7431. {
  7432. "name": "emissive",
  7433. "type": 16,
  7434. "count": 1
  7435. },
  7436. {
  7437. "name": "emissiveScaleAndStrenth",
  7438. "type": 16,
  7439. "count": 1
  7440. }
  7441. ],
  7442. "defines": [],
  7443. "stageFlags": 17,
  7444. "binding": 0
  7445. }
  7446. ],
  7447. "samplerTextures": [
  7448. {
  7449. "name": "baseColorMap",
  7450. "type": 28,
  7451. "count": 1,
  7452. "defines": [
  7453. "USE_BASE_COLOR_MAP"
  7454. ],
  7455. "stageFlags": 16,
  7456. "binding": 1
  7457. },
  7458. {
  7459. "name": "normalMap",
  7460. "type": 28,
  7461. "count": 1,
  7462. "defines": [
  7463. "USE_NORMAL_MAP"
  7464. ],
  7465. "stageFlags": 16,
  7466. "binding": 2
  7467. },
  7468. {
  7469. "name": "shadeMap1",
  7470. "type": 28,
  7471. "count": 1,
  7472. "defines": [
  7473. "USE_1ST_SHADE_MAP"
  7474. ],
  7475. "stageFlags": 16,
  7476. "binding": 3
  7477. },
  7478. {
  7479. "name": "shadeMap2",
  7480. "type": 28,
  7481. "count": 1,
  7482. "defines": [
  7483. "USE_2ND_SHADE_MAP"
  7484. ],
  7485. "stageFlags": 16,
  7486. "binding": 4
  7487. },
  7488. {
  7489. "name": "specularMap",
  7490. "type": 28,
  7491. "count": 1,
  7492. "defines": [
  7493. "USE_SPECULAR_MAP"
  7494. ],
  7495. "stageFlags": 16,
  7496. "binding": 5
  7497. },
  7498. {
  7499. "name": "emissiveMap",
  7500. "type": 28,
  7501. "count": 1,
  7502. "defines": [
  7503. "USE_EMISSIVE_MAP"
  7504. ],
  7505. "stageFlags": 16,
  7506. "binding": 6
  7507. }
  7508. ],
  7509. "samplers": [],
  7510. "textures": [],
  7511. "buffers": [],
  7512. "images": [],
  7513. "subpassInputs": []
  7514. },
  7515. {
  7516. "rate": 2,
  7517. "blocks": [],
  7518. "samplerTextures": [],
  7519. "samplers": [],
  7520. "textures": [],
  7521. "buffers": [],
  7522. "images": [],
  7523. "subpassInputs": []
  7524. },
  7525. {
  7526. "rate": 3,
  7527. "blocks": [
  7528. {
  7529. "tags": {
  7530. "builtin": "global"
  7531. },
  7532. "name": "CCGlobal",
  7533. "members": [
  7534. {
  7535. "name": "cc_time",
  7536. "typename": "vec4",
  7537. "type": 16,
  7538. "count": 1,
  7539. "precision": "highp "
  7540. },
  7541. {
  7542. "name": "cc_screenSize",
  7543. "typename": "vec4",
  7544. "type": 16,
  7545. "count": 1,
  7546. "precision": "mediump "
  7547. },
  7548. {
  7549. "name": "cc_nativeSize",
  7550. "typename": "vec4",
  7551. "type": 16,
  7552. "count": 1,
  7553. "precision": "mediump "
  7554. },
  7555. {
  7556. "name": "cc_probeInfo",
  7557. "typename": "vec4",
  7558. "type": 16,
  7559. "count": 1,
  7560. "precision": "mediump "
  7561. },
  7562. {
  7563. "name": "cc_debug_view_mode",
  7564. "typename": "vec4",
  7565. "type": 16,
  7566. "count": 1,
  7567. "precision": "mediump "
  7568. }
  7569. ],
  7570. "defines": [],
  7571. "stageFlags": 17
  7572. },
  7573. {
  7574. "tags": {
  7575. "builtin": "global"
  7576. },
  7577. "name": "CCCamera",
  7578. "members": [
  7579. {
  7580. "name": "cc_matView",
  7581. "typename": "mat4",
  7582. "type": 25,
  7583. "count": 1,
  7584. "precision": "highp "
  7585. },
  7586. {
  7587. "name": "cc_matViewInv",
  7588. "typename": "mat4",
  7589. "type": 25,
  7590. "count": 1,
  7591. "precision": "highp "
  7592. },
  7593. {
  7594. "name": "cc_matProj",
  7595. "typename": "mat4",
  7596. "type": 25,
  7597. "count": 1,
  7598. "precision": "highp "
  7599. },
  7600. {
  7601. "name": "cc_matProjInv",
  7602. "typename": "mat4",
  7603. "type": 25,
  7604. "count": 1,
  7605. "precision": "highp "
  7606. },
  7607. {
  7608. "name": "cc_matViewProj",
  7609. "typename": "mat4",
  7610. "type": 25,
  7611. "count": 1,
  7612. "precision": "highp "
  7613. },
  7614. {
  7615. "name": "cc_matViewProjInv",
  7616. "typename": "mat4",
  7617. "type": 25,
  7618. "count": 1,
  7619. "precision": "highp "
  7620. },
  7621. {
  7622. "name": "cc_cameraPos",
  7623. "typename": "vec4",
  7624. "type": 16,
  7625. "count": 1,
  7626. "precision": "highp "
  7627. },
  7628. {
  7629. "name": "cc_surfaceTransform",
  7630. "typename": "vec4",
  7631. "type": 16,
  7632. "count": 1,
  7633. "precision": "mediump "
  7634. },
  7635. {
  7636. "name": "cc_screenScale",
  7637. "typename": "vec4",
  7638. "type": 16,
  7639. "count": 1,
  7640. "precision": "mediump "
  7641. },
  7642. {
  7643. "name": "cc_exposure",
  7644. "typename": "vec4",
  7645. "type": 16,
  7646. "count": 1,
  7647. "precision": "mediump "
  7648. },
  7649. {
  7650. "name": "cc_mainLitDir",
  7651. "typename": "vec4",
  7652. "type": 16,
  7653. "count": 1,
  7654. "precision": "mediump "
  7655. },
  7656. {
  7657. "name": "cc_mainLitColor",
  7658. "typename": "vec4",
  7659. "type": 16,
  7660. "count": 1,
  7661. "precision": "mediump "
  7662. },
  7663. {
  7664. "name": "cc_ambientSky",
  7665. "typename": "vec4",
  7666. "type": 16,
  7667. "count": 1,
  7668. "precision": "mediump "
  7669. },
  7670. {
  7671. "name": "cc_ambientGround",
  7672. "typename": "vec4",
  7673. "type": 16,
  7674. "count": 1,
  7675. "precision": "mediump "
  7676. },
  7677. {
  7678. "name": "cc_fogColor",
  7679. "typename": "vec4",
  7680. "type": 16,
  7681. "count": 1,
  7682. "precision": "mediump "
  7683. },
  7684. {
  7685. "name": "cc_fogBase",
  7686. "typename": "vec4",
  7687. "type": 16,
  7688. "count": 1,
  7689. "precision": "mediump "
  7690. },
  7691. {
  7692. "name": "cc_fogAdd",
  7693. "typename": "vec4",
  7694. "type": 16,
  7695. "count": 1,
  7696. "precision": "mediump "
  7697. },
  7698. {
  7699. "name": "cc_nearFar",
  7700. "typename": "vec4",
  7701. "type": 16,
  7702. "count": 1,
  7703. "precision": "mediump "
  7704. },
  7705. {
  7706. "name": "cc_viewPort",
  7707. "typename": "vec4",
  7708. "type": 16,
  7709. "count": 1,
  7710. "precision": "mediump "
  7711. }
  7712. ],
  7713. "defines": [],
  7714. "stageFlags": 17
  7715. },
  7716. {
  7717. "tags": {
  7718. "builtin": "global"
  7719. },
  7720. "name": "CCShadow",
  7721. "members": [
  7722. {
  7723. "name": "cc_matLightView",
  7724. "typename": "mat4",
  7725. "type": 25,
  7726. "count": 1,
  7727. "precision": "highp "
  7728. },
  7729. {
  7730. "name": "cc_matLightViewProj",
  7731. "typename": "mat4",
  7732. "type": 25,
  7733. "count": 1,
  7734. "precision": "highp "
  7735. },
  7736. {
  7737. "name": "cc_shadowInvProjDepthInfo",
  7738. "typename": "vec4",
  7739. "type": 16,
  7740. "count": 1,
  7741. "precision": "highp "
  7742. },
  7743. {
  7744. "name": "cc_shadowProjDepthInfo",
  7745. "typename": "vec4",
  7746. "type": 16,
  7747. "count": 1,
  7748. "precision": "highp "
  7749. },
  7750. {
  7751. "name": "cc_shadowProjInfo",
  7752. "typename": "vec4",
  7753. "type": 16,
  7754. "count": 1,
  7755. "precision": "highp "
  7756. },
  7757. {
  7758. "name": "cc_shadowNFLSInfo",
  7759. "typename": "vec4",
  7760. "type": 16,
  7761. "count": 1,
  7762. "precision": "mediump "
  7763. },
  7764. {
  7765. "name": "cc_shadowWHPBInfo",
  7766. "typename": "vec4",
  7767. "type": 16,
  7768. "count": 1,
  7769. "precision": "mediump "
  7770. },
  7771. {
  7772. "name": "cc_shadowLPNNInfo",
  7773. "typename": "vec4",
  7774. "type": 16,
  7775. "count": 1,
  7776. "precision": "mediump "
  7777. },
  7778. {
  7779. "name": "cc_shadowColor",
  7780. "typename": "vec4",
  7781. "type": 16,
  7782. "count": 1,
  7783. "precision": "lowp "
  7784. },
  7785. {
  7786. "name": "cc_planarNDInfo",
  7787. "typename": "vec4",
  7788. "type": 16,
  7789. "count": 1,
  7790. "precision": "mediump "
  7791. }
  7792. ],
  7793. "defines": [],
  7794. "stageFlags": 17
  7795. },
  7796. {
  7797. "tags": {
  7798. "builtin": "global"
  7799. },
  7800. "name": "CCCSM",
  7801. "members": [
  7802. {
  7803. "name": "cc_csmViewDir0",
  7804. "typename": "vec4",
  7805. "type": 16,
  7806. "count": 4,
  7807. "precision": "highp ",
  7808. "isArray": true
  7809. },
  7810. {
  7811. "name": "cc_csmViewDir1",
  7812. "typename": "vec4",
  7813. "type": 16,
  7814. "count": 4,
  7815. "precision": "highp ",
  7816. "isArray": true
  7817. },
  7818. {
  7819. "name": "cc_csmViewDir2",
  7820. "typename": "vec4",
  7821. "type": 16,
  7822. "count": 4,
  7823. "precision": "highp ",
  7824. "isArray": true
  7825. },
  7826. {
  7827. "name": "cc_csmAtlas",
  7828. "typename": "vec4",
  7829. "type": 16,
  7830. "count": 4,
  7831. "precision": "highp ",
  7832. "isArray": true
  7833. },
  7834. {
  7835. "name": "cc_matCSMViewProj",
  7836. "typename": "mat4",
  7837. "type": 25,
  7838. "count": 4,
  7839. "precision": "highp ",
  7840. "isArray": true
  7841. },
  7842. {
  7843. "name": "cc_csmProjDepthInfo",
  7844. "typename": "vec4",
  7845. "type": 16,
  7846. "count": 4,
  7847. "precision": "highp ",
  7848. "isArray": true
  7849. },
  7850. {
  7851. "name": "cc_csmProjInfo",
  7852. "typename": "vec4",
  7853. "type": 16,
  7854. "count": 4,
  7855. "precision": "highp ",
  7856. "isArray": true
  7857. },
  7858. {
  7859. "name": "cc_csmSplitsInfo",
  7860. "typename": "vec4",
  7861. "type": 16,
  7862. "count": 1,
  7863. "precision": "highp "
  7864. }
  7865. ],
  7866. "defines": [
  7867. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  7868. ],
  7869. "stageFlags": 16
  7870. }
  7871. ],
  7872. "samplerTextures": [
  7873. {
  7874. "tags": {
  7875. "builtin": "global"
  7876. },
  7877. "name": "cc_environment",
  7878. "typename": "samplerCube",
  7879. "type": 31,
  7880. "count": 1,
  7881. "defines": [],
  7882. "stageFlags": 16
  7883. },
  7884. {
  7885. "tags": {
  7886. "builtin": "global"
  7887. },
  7888. "name": "cc_diffuseMap",
  7889. "typename": "samplerCube",
  7890. "type": 31,
  7891. "count": 1,
  7892. "defines": [
  7893. "CC_USE_IBL",
  7894. "CC_USE_DIFFUSEMAP"
  7895. ],
  7896. "stageFlags": 16
  7897. },
  7898. {
  7899. "tags": {
  7900. "builtin": "global"
  7901. },
  7902. "name": "cc_shadowMap",
  7903. "typename": "sampler2D",
  7904. "type": 28,
  7905. "count": 1,
  7906. "precision": "highp ",
  7907. "defines": [
  7908. "CC_RECEIVE_SHADOW"
  7909. ],
  7910. "stageFlags": 16
  7911. },
  7912. {
  7913. "tags": {
  7914. "builtin": "global"
  7915. },
  7916. "name": "cc_spotShadowMap",
  7917. "typename": "sampler2D",
  7918. "type": 28,
  7919. "count": 1,
  7920. "precision": "highp ",
  7921. "defines": [
  7922. "CC_RECEIVE_SHADOW"
  7923. ],
  7924. "stageFlags": 16
  7925. }
  7926. ],
  7927. "samplers": [],
  7928. "textures": [],
  7929. "buffers": [],
  7930. "images": [],
  7931. "subpassInputs": []
  7932. }
  7933. ],
  7934. "hash": 2666727366,
  7935. "glsl4": {
  7936. "vert": "#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 3) in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 6) in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n layout(location = 7) in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 8) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 9) in vec4 a_matWorld0;\n layout(location = 10) in vec4 a_matWorld1;\n layout(location = 11) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 12) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 13) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 14) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 15) in vec4 a_sh_linear_const_r;\n layout(location = 16) in vec4 a_sh_linear_const_g;\n layout(location = 17) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nlayout(location = 0) out highp vec3 v_worldPos;\nlayout(location = 1) out vec4 v_normal;\nlayout(location = 2) out vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 3) out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 4) out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n layout(location = 5) out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 6) out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 7) out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 8) out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n layout(location = 9) out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n layout(location = 10) out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n layout(location = 11) out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 12) out mediump vec4 v_sh_linear_const_r;\n layout(location = 13) out mediump vec4 v_sh_linear_const_g;\n layout(location = 14) out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(set = 2, binding = 4) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n layout(set = 2, binding = 8) uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n layout(set = 2, binding = 9) uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n layout(set = 2, binding = 10) uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(set = 2, binding = 3) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(set = 2, binding = 2) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n layout(set = 2, binding = 7) uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n layout(set = 2, binding = 7) uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(set = 2, binding = 3) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n #endif\n#endif\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nlayout(location = 15) out highp float v_dist;\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n vec4 shadowPos = CalculatePlanarShadowPos(In.worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n In.worldPos = shadowPos.xyz;\n In.clipPos = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexOutput(In);\n v_dist = shadowPos.w;\n}",
  7937. "frag": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nlayout(location = 0) in highp vec3 v_worldPos;\nlayout(location = 1) in vec4 v_normal;\nlayout(location = 2) in vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n layout(location = 3) in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n layout(location = 4) in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n layout(location = 5) in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 6) in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 7) in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 8) in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n layout(location = 9) in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n layout(location = 10) in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n layout(location = 11) in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 12) in mediump vec4 v_sh_linear_const_r;\n layout(location = 13) in mediump vec4 v_sh_linear_const_g;\n layout(location = 14) in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(set = 2, binding = 1) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(set = 2, binding = 6) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(set = 0, binding = 2) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(set = 0, binding = 3) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nlayout(set = 0, binding = 5) uniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n layout(set = 0, binding = 7) uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 15) uniform samplerCube cc_reflectionProbeCubemap;\n layout(set = 2, binding = 16) uniform sampler2D cc_reflectionProbePlanarMap;\n layout(set = 2, binding = 17) uniform sampler2D cc_reflectionProbeDataMap;\n layout(set = 2, binding = 18) uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\n#if CC_RECEIVE_SHADOW\n layout(set = 0, binding = 4) uniform highp sampler2D cc_shadowMap;\n layout(set = 0, binding = 6) uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(set = 2, binding = 11) uniform sampler2D cc_lightingMap;\n#endif\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#if USE_BASE_COLOR_MAP\n layout(set = 1, binding = 1) uniform sampler2D baseColorMap;\n#endif\n#if USE_NORMAL_MAP\n layout(set = 1, binding = 2) uniform sampler2D normalMap;\n#endif\n#if USE_1ST_SHADE_MAP\n layout(set = 1, binding = 3) uniform sampler2D shadeMap1;\n#endif\n#if USE_2ND_SHADE_MAP\n layout(set = 1, binding = 4) uniform sampler2D shadeMap2;\n#endif\n#if USE_SPECULAR_MAP\n layout(set = 1, binding = 5) uniform sampler2D specularMap;\n#endif\n#if USE_EMISSIVE_MAP\n layout(set = 1, binding = 6) uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\nvoid SurfacesFragmentAlphaClipOnly()\n{\n #if USE_ALPHA_TEST\n float alpha = baseColor.ALPHA_TEST_CHANNEL;\n #if USE_BASE_COLOR_MAP\n alpha = texture(baseColorMap, FSInput_texcoord).ALPHA_TEST_CHANNEL;\n #endif\n if (alpha < colorScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nlayout(location = 15) in highp float v_dist;\nlayout(location = 0) out vec4 fragColorX;\nvoid main () {\n#ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n SurfacesFragmentAlphaClipOnly();\n#endif\n if(v_dist < 0.0)\n discard;\n fragColorX = cc_shadowColor;\n}"
  7938. },
  7939. "glsl3": {
  7940. "vert": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nout highp vec3 v_worldPos;\nout vec4 v_normal;\nout vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n out mediump vec4 v_sh_linear_const_r;\n out mediump vec4 v_sh_linear_const_g;\n out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n #endif\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nout highp float v_dist;\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n vec4 shadowPos = CalculatePlanarShadowPos(In.worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n In.worldPos = shadowPos.xyz;\n In.clipPos = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexOutput(In);\n v_dist = shadowPos.w;\n}",
  7941. "frag": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nin highp vec3 v_worldPos;\nin vec4 v_normal;\nin vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n in mediump vec4 v_sh_linear_const_r;\n in mediump vec4 v_sh_linear_const_g;\n in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(std140) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 baseColor;\n vec4 colorScaleAndCutoff;\n vec4 shadeColor1;\n vec4 shadeColor2;\n vec4 specular;\n vec4 shadeParams;\n vec4 miscParams;\n vec4 emissive;\n vec4 emissiveScaleAndStrenth;\n};\n#if USE_BASE_COLOR_MAP\n uniform sampler2D baseColorMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_1ST_SHADE_MAP\n uniform sampler2D shadeMap1;\n#endif\n#if USE_2ND_SHADE_MAP\n uniform sampler2D shadeMap2;\n#endif\n#if USE_SPECULAR_MAP\n uniform sampler2D specularMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\nvoid SurfacesFragmentAlphaClipOnly()\n{\n #if USE_ALPHA_TEST\n float alpha = baseColor.ALPHA_TEST_CHANNEL;\n #if USE_BASE_COLOR_MAP\n alpha = texture(baseColorMap, FSInput_texcoord).ALPHA_TEST_CHANNEL;\n #endif\n if (alpha < colorScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nin highp float v_dist;\nlayout(location = 0) out vec4 fragColorX;\nvoid main () {\n#ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n SurfacesFragmentAlphaClipOnly();\n#endif\n if(v_dist < 0.0)\n discard;\n fragColorX = cc_shadowColor;\n}"
  7942. },
  7943. "glsl1": {
  7944. "vert": "\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n attribute vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n attribute vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_nearFar;\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_planarNDInfo;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n #endif\n#endif\n uniform vec4 tilingOffset;\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nvarying highp float v_dist;\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n vec4 shadowPos = CalculatePlanarShadowPos(In.worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n In.worldPos = shadowPos.xyz;\n In.clipPos = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexOutput(In);\n v_dist = shadowPos.w;\n}",
  7945. "frag": "\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\n#define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING\n#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nuniform mediump vec4 cc_debug_view_mode;\nuniform mediump vec4 cc_surfaceTransform;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n #endif\n#endif\nuniform lowp vec4 cc_shadowColor;\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n #endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n #endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n#endif\n uniform vec4 baseColor;\n uniform vec4 colorScaleAndCutoff;\n#if USE_BASE_COLOR_MAP\n uniform sampler2D baseColorMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_1ST_SHADE_MAP\n uniform sampler2D shadeMap1;\n#endif\n#if USE_2ND_SHADE_MAP\n uniform sampler2D shadeMap2;\n#endif\n#if USE_SPECULAR_MAP\n uniform sampler2D specularMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\nvoid SurfacesFragmentAlphaClipOnly()\n{\n #if USE_ALPHA_TEST\n float alpha = baseColor.ALPHA_TEST_CHANNEL;\n #if USE_BASE_COLOR_MAP\n alpha = texture2D(baseColorMap, FSInput_texcoord).ALPHA_TEST_CHANNEL;\n #endif\n if (alpha < colorScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER\n#define CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR\nvarying highp float v_dist;\nvoid main () {\n#ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n SurfacesFragmentAlphaClipOnly();\n#endif\n if(v_dist < 0.0)\n discard;\n gl_FragColor = cc_shadowColor;\n}"
  7946. },
  7947. "builtins": {
  7948. "globals": {
  7949. "blocks": [
  7950. {
  7951. "name": "CCGlobal",
  7952. "defines": []
  7953. },
  7954. {
  7955. "name": "CCCamera",
  7956. "defines": []
  7957. },
  7958. {
  7959. "name": "CCShadow",
  7960. "defines": []
  7961. },
  7962. {
  7963. "name": "CCCSM",
  7964. "defines": [
  7965. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  7966. ]
  7967. }
  7968. ],
  7969. "samplerTextures": [
  7970. {
  7971. "name": "cc_environment",
  7972. "defines": []
  7973. },
  7974. {
  7975. "name": "cc_diffuseMap",
  7976. "defines": [
  7977. "CC_USE_IBL",
  7978. "CC_USE_DIFFUSEMAP"
  7979. ]
  7980. },
  7981. {
  7982. "name": "cc_shadowMap",
  7983. "defines": [
  7984. "CC_RECEIVE_SHADOW"
  7985. ]
  7986. },
  7987. {
  7988. "name": "cc_spotShadowMap",
  7989. "defines": [
  7990. "CC_RECEIVE_SHADOW"
  7991. ]
  7992. }
  7993. ],
  7994. "buffers": [],
  7995. "images": []
  7996. },
  7997. "locals": {
  7998. "blocks": [
  7999. {
  8000. "name": "CCLocal",
  8001. "defines": [
  8002. "!USE_INSTANCING"
  8003. ]
  8004. },
  8005. {
  8006. "name": "CCMorph",
  8007. "defines": [
  8008. "CC_USE_MORPH"
  8009. ]
  8010. },
  8011. {
  8012. "name": "CCSkinningTexture",
  8013. "defines": [
  8014. "CC_USE_SKINNING",
  8015. "CC_USE_BAKED_ANIMATION"
  8016. ]
  8017. },
  8018. {
  8019. "name": "CCSkinningAnimation",
  8020. "defines": [
  8021. "CC_USE_SKINNING",
  8022. "CC_USE_BAKED_ANIMATION"
  8023. ]
  8024. },
  8025. {
  8026. "name": "CCSkinning",
  8027. "defines": [
  8028. "CC_USE_SKINNING",
  8029. "!CC_USE_BAKED_ANIMATION",
  8030. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  8031. ]
  8032. },
  8033. {
  8034. "name": "CCForwardLight",
  8035. "defines": [
  8036. "CC_FORWARD_ADD",
  8037. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  8038. ]
  8039. },
  8040. {
  8041. "name": "CCSH",
  8042. "defines": [
  8043. "CC_USE_LIGHT_PROBE",
  8044. "!USE_INSTANCING"
  8045. ]
  8046. }
  8047. ],
  8048. "samplerTextures": [
  8049. {
  8050. "name": "cc_PositionDisplacements",
  8051. "defines": [
  8052. "CC_USE_MORPH",
  8053. "CC_MORPH_TARGET_HAS_POSITION"
  8054. ]
  8055. },
  8056. {
  8057. "name": "cc_NormalDisplacements",
  8058. "defines": [
  8059. "CC_USE_MORPH",
  8060. "CC_MORPH_TARGET_HAS_NORMAL"
  8061. ]
  8062. },
  8063. {
  8064. "name": "cc_TangentDisplacements",
  8065. "defines": [
  8066. "CC_USE_MORPH",
  8067. "CC_MORPH_TARGET_HAS_TANGENT"
  8068. ]
  8069. },
  8070. {
  8071. "name": "cc_jointTexture",
  8072. "defines": [
  8073. "CC_USE_SKINNING",
  8074. "CC_USE_BAKED_ANIMATION"
  8075. ]
  8076. },
  8077. {
  8078. "name": "cc_realtimeJoint",
  8079. "defines": [
  8080. "CC_USE_SKINNING",
  8081. "!CC_USE_BAKED_ANIMATION",
  8082. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  8083. ]
  8084. },
  8085. {
  8086. "name": "cc_reflectionProbeCubemap",
  8087. "defines": [
  8088. "CC_USE_REFLECTION_PROBE"
  8089. ]
  8090. },
  8091. {
  8092. "name": "cc_reflectionProbePlanarMap",
  8093. "defines": [
  8094. "CC_USE_REFLECTION_PROBE"
  8095. ]
  8096. },
  8097. {
  8098. "name": "cc_reflectionProbeDataMap",
  8099. "defines": [
  8100. "CC_USE_REFLECTION_PROBE"
  8101. ]
  8102. },
  8103. {
  8104. "name": "cc_reflectionProbeBlendCubemap",
  8105. "defines": [
  8106. "CC_USE_REFLECTION_PROBE"
  8107. ]
  8108. },
  8109. {
  8110. "name": "cc_lightingMap",
  8111. "defines": [
  8112. "CC_USE_LIGHTMAP",
  8113. "!CC_FORWARD_ADD"
  8114. ]
  8115. }
  8116. ],
  8117. "buffers": [],
  8118. "images": []
  8119. },
  8120. "statistics": {
  8121. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 100,
  8122. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 130
  8123. }
  8124. },
  8125. "defines": [
  8126. {
  8127. "name": "USE_COMPATIBLE_LIGHTING",
  8128. "type": "boolean",
  8129. "defines": []
  8130. },
  8131. {
  8132. "name": "USE_NORMAL_MAP",
  8133. "type": "boolean",
  8134. "defines": []
  8135. },
  8136. {
  8137. "name": "USE_INSTANCING",
  8138. "type": "boolean",
  8139. "defines": [],
  8140. "editor": {
  8141. "elevated": true
  8142. }
  8143. },
  8144. {
  8145. "name": "CC_USE_LIGHTMAP",
  8146. "type": "boolean",
  8147. "defines": []
  8148. },
  8149. {
  8150. "name": "CC_USE_SKINNING",
  8151. "type": "boolean",
  8152. "defines": []
  8153. },
  8154. {
  8155. "name": "CC_USE_BAKED_ANIMATION",
  8156. "type": "boolean",
  8157. "defines": [
  8158. "USE_INSTANCING"
  8159. ]
  8160. },
  8161. {
  8162. "name": "CC_RECEIVE_SHADOW",
  8163. "type": "boolean",
  8164. "defines": []
  8165. },
  8166. {
  8167. "name": "CC_USE_REFLECTION_PROBE",
  8168. "type": "number",
  8169. "defines": [],
  8170. "range": [
  8171. 0,
  8172. 3
  8173. ]
  8174. },
  8175. {
  8176. "name": "CC_USE_LIGHT_PROBE",
  8177. "type": "boolean",
  8178. "defines": [],
  8179. "default": 0
  8180. },
  8181. {
  8182. "name": "CC_USE_MORPH",
  8183. "type": "boolean",
  8184. "defines": []
  8185. },
  8186. {
  8187. "name": "CC_FORWARD_ADD",
  8188. "type": "boolean",
  8189. "defines": []
  8190. },
  8191. {
  8192. "name": "CC_USE_FOG",
  8193. "type": "number",
  8194. "defines": [],
  8195. "range": [
  8196. 0,
  8197. 4
  8198. ]
  8199. },
  8200. {
  8201. "name": "CC_USE_ACCURATE_FOG",
  8202. "type": "boolean",
  8203. "defines": [
  8204. "CC_USE_FOG"
  8205. ]
  8206. },
  8207. {
  8208. "name": "CC_MORPH_TARGET_COUNT",
  8209. "type": "number",
  8210. "defines": [
  8211. "CC_USE_MORPH"
  8212. ],
  8213. "range": [
  8214. 2,
  8215. 8
  8216. ]
  8217. },
  8218. {
  8219. "name": "CC_MORPH_TARGET_HAS_POSITION",
  8220. "type": "boolean",
  8221. "defines": [
  8222. "CC_USE_MORPH"
  8223. ]
  8224. },
  8225. {
  8226. "name": "CC_MORPH_TARGET_HAS_NORMAL",
  8227. "type": "boolean",
  8228. "defines": [
  8229. "CC_USE_MORPH"
  8230. ]
  8231. },
  8232. {
  8233. "name": "CC_MORPH_TARGET_HAS_TANGENT",
  8234. "type": "boolean",
  8235. "defines": [
  8236. "CC_USE_MORPH"
  8237. ]
  8238. },
  8239. {
  8240. "name": "CC_MORPH_PRECOMPUTED",
  8241. "type": "boolean",
  8242. "defines": [
  8243. "CC_USE_MORPH"
  8244. ]
  8245. },
  8246. {
  8247. "name": "CC_USE_REAL_TIME_JOINT_TEXTURE",
  8248. "type": "boolean",
  8249. "defines": [
  8250. "CC_USE_SKINNING",
  8251. "!CC_USE_BAKED_ANIMATION"
  8252. ]
  8253. },
  8254. {
  8255. "name": "CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER",
  8256. "type": "number",
  8257. "defines": [],
  8258. "range": [
  8259. 0,
  8260. 1
  8261. ]
  8262. },
  8263. {
  8264. "name": "CC_PIPELINE_TYPE",
  8265. "type": "number",
  8266. "defines": [],
  8267. "range": [
  8268. 0,
  8269. 1
  8270. ]
  8271. },
  8272. {
  8273. "name": "CC_FORCE_FORWARD_SHADING",
  8274. "type": "boolean",
  8275. "defines": [
  8276. "CC_PIPELINE_TYPE"
  8277. ]
  8278. },
  8279. {
  8280. "name": "CC_ENABLE_CLUSTERED_LIGHT_CULLING",
  8281. "type": "number",
  8282. "defines": [
  8283. "CC_FORWARD_ADD"
  8284. ],
  8285. "range": [
  8286. 0,
  8287. 3
  8288. ]
  8289. },
  8290. {
  8291. "name": "CC_SUPPORT_CASCADED_SHADOW_MAP",
  8292. "type": "boolean",
  8293. "defines": []
  8294. },
  8295. {
  8296. "name": "CC_USE_IBL",
  8297. "type": "number",
  8298. "defines": [],
  8299. "range": [
  8300. 0,
  8301. 2
  8302. ]
  8303. },
  8304. {
  8305. "name": "CC_USE_DIFFUSEMAP",
  8306. "type": "number",
  8307. "defines": [
  8308. "CC_USE_IBL"
  8309. ],
  8310. "range": [
  8311. 0,
  8312. 2
  8313. ]
  8314. },
  8315. {
  8316. "name": "USE_BASE_COLOR_MAP",
  8317. "type": "boolean",
  8318. "defines": []
  8319. },
  8320. {
  8321. "name": "USE_1ST_SHADE_MAP",
  8322. "type": "boolean",
  8323. "defines": []
  8324. },
  8325. {
  8326. "name": "USE_2ND_SHADE_MAP",
  8327. "type": "boolean",
  8328. "defines": []
  8329. },
  8330. {
  8331. "name": "USE_SPECULAR_MAP",
  8332. "type": "boolean",
  8333. "defines": []
  8334. },
  8335. {
  8336. "name": "USE_EMISSIVE_MAP",
  8337. "type": "boolean",
  8338. "defines": []
  8339. },
  8340. {
  8341. "name": "USE_ALPHA_TEST",
  8342. "type": "boolean",
  8343. "defines": []
  8344. },
  8345. {
  8346. "name": "ALPHA_TEST_CHANNEL",
  8347. "type": "string",
  8348. "defines": [
  8349. "USE_ALPHA_TEST"
  8350. ],
  8351. "options": [
  8352. "a",
  8353. "r",
  8354. "g",
  8355. "b"
  8356. ]
  8357. }
  8358. ],
  8359. "name": "builtin-toon|planar-shadow-vs|planar-shadow-fs"
  8360. }
  8361. ],
  8362. "combinations": [],
  8363. "hideInEditor": false
  8364. }