1baf0fc9-befa-459c-8bdd-af1a450a0319.json 541 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "legacy/standard",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "name": "opaque",
  10. "passes": [
  11. {
  12. "program": "legacy/standard|standard-vs|standard-fs",
  13. "properties": {
  14. "tilingOffset": {
  15. "value": [
  16. 1,
  17. 1,
  18. 0,
  19. 0
  20. ],
  21. "type": 16
  22. },
  23. "mainColor": {
  24. "value": [
  25. 1,
  26. 1,
  27. 1,
  28. 1
  29. ],
  30. "linear": true,
  31. "editor": {
  32. "displayName": "Albedo",
  33. "type": "color"
  34. },
  35. "type": 16,
  36. "handleInfo": [
  37. "albedo",
  38. 0,
  39. 16
  40. ]
  41. },
  42. "albedoScale": {
  43. "value": [
  44. 1,
  45. 1,
  46. 1
  47. ],
  48. "type": 15,
  49. "handleInfo": [
  50. "albedoScaleAndCutoff",
  51. 0,
  52. 15
  53. ]
  54. },
  55. "alphaThreshold": {
  56. "value": [
  57. 0.5
  58. ],
  59. "editor": {
  60. "parent": "USE_ALPHA_TEST",
  61. "slide": true,
  62. "range": [
  63. 0,
  64. 1
  65. ],
  66. "step": 0.001
  67. },
  68. "type": 13,
  69. "handleInfo": [
  70. "albedoScaleAndCutoff",
  71. 3,
  72. 13
  73. ]
  74. },
  75. "occlusion": {
  76. "value": [
  77. 0
  78. ],
  79. "editor": {
  80. "slide": true,
  81. "range": [
  82. 0,
  83. 1
  84. ],
  85. "step": 0.001
  86. },
  87. "type": 13,
  88. "handleInfo": [
  89. "pbrParams",
  90. 0,
  91. 13
  92. ]
  93. },
  94. "roughness": {
  95. "value": [
  96. 0.5
  97. ],
  98. "editor": {
  99. "slide": true,
  100. "range": [
  101. 0,
  102. 1
  103. ],
  104. "step": 0.001
  105. },
  106. "type": 13,
  107. "handleInfo": [
  108. "pbrParams",
  109. 1,
  110. 13
  111. ]
  112. },
  113. "metallic": {
  114. "value": [
  115. 0
  116. ],
  117. "editor": {
  118. "slide": true,
  119. "range": [
  120. 0,
  121. 1
  122. ],
  123. "step": 0.001
  124. },
  125. "type": 13,
  126. "handleInfo": [
  127. "pbrParams",
  128. 2,
  129. 13
  130. ]
  131. },
  132. "specularIntensity": {
  133. "value": [
  134. 0.5
  135. ],
  136. "editor": {
  137. "slide": true,
  138. "range": [
  139. 0,
  140. 1
  141. ],
  142. "step": 0.001
  143. },
  144. "type": 13,
  145. "handleInfo": [
  146. "pbrParams",
  147. 3,
  148. 13
  149. ]
  150. },
  151. "emissive": {
  152. "value": [
  153. 0,
  154. 0,
  155. 0,
  156. 1
  157. ],
  158. "linear": true,
  159. "editor": {
  160. "type": "color"
  161. },
  162. "type": 16
  163. },
  164. "emissiveScale": {
  165. "value": [
  166. 1,
  167. 1,
  168. 1
  169. ],
  170. "type": 15,
  171. "handleInfo": [
  172. "emissiveScaleParam",
  173. 0,
  174. 15
  175. ]
  176. },
  177. "normalStrength": {
  178. "value": [
  179. 1
  180. ],
  181. "editor": {
  182. "parent": "USE_NORMAL_MAP",
  183. "slide": true,
  184. "range": [
  185. 0,
  186. 5
  187. ],
  188. "step": 0.001
  189. },
  190. "type": 13,
  191. "handleInfo": [
  192. "emissiveScaleParam",
  193. 3,
  194. 13
  195. ]
  196. },
  197. "mainTexture": {
  198. "value": "grey",
  199. "editor": {
  200. "displayName": "AlbedoMap"
  201. },
  202. "type": 28,
  203. "handleInfo": [
  204. "albedoMap",
  205. 0,
  206. 28
  207. ]
  208. },
  209. "normalMap": {
  210. "value": "normal",
  211. "type": 28
  212. },
  213. "pbrMap": {
  214. "value": "grey",
  215. "type": 28
  216. },
  217. "metallicRoughnessMap": {
  218. "value": "grey",
  219. "type": 28
  220. },
  221. "occlusionMap": {
  222. "value": "white",
  223. "type": 28
  224. },
  225. "emissiveMap": {
  226. "value": "grey",
  227. "type": 28
  228. },
  229. "albedo": {
  230. "type": 16,
  231. "editor": {
  232. "visible": false,
  233. "deprecated": true
  234. },
  235. "value": [
  236. 1,
  237. 1,
  238. 1,
  239. 1
  240. ]
  241. },
  242. "albedoScaleAndCutoff": {
  243. "type": 16,
  244. "editor": {
  245. "visible": false,
  246. "deprecated": true
  247. },
  248. "value": [
  249. 1,
  250. 1,
  251. 1,
  252. 0.5
  253. ]
  254. },
  255. "pbrParams": {
  256. "type": 16,
  257. "editor": {
  258. "visible": false,
  259. "deprecated": true
  260. },
  261. "value": [
  262. 0,
  263. 0.5,
  264. 0,
  265. 0.5
  266. ]
  267. },
  268. "emissiveScaleParam": {
  269. "type": 16,
  270. "editor": {
  271. "visible": false,
  272. "deprecated": true
  273. },
  274. "value": [
  275. 1,
  276. 1,
  277. 1,
  278. 1
  279. ]
  280. },
  281. "albedoMap": {
  282. "type": 28,
  283. "editor": {
  284. "visible": false,
  285. "deprecated": true
  286. },
  287. "value": "grey"
  288. }
  289. }
  290. },
  291. {
  292. "phase": "forward-add",
  293. "propertyIndex": 0,
  294. "embeddedMacros": {
  295. "CC_FORWARD_ADD": true
  296. },
  297. "blendState": {
  298. "targets": [
  299. {
  300. "blend": true,
  301. "blendSrc": 1,
  302. "blendDst": 1,
  303. "blendSrcAlpha": 0,
  304. "blendDstAlpha": 1
  305. }
  306. ]
  307. },
  308. "program": "legacy/standard|standard-vs|standard-fs",
  309. "depthStencilState": {
  310. "depthFunc": 2,
  311. "depthTest": true,
  312. "depthWrite": false
  313. }
  314. },
  315. {
  316. "phase": "shadow-caster",
  317. "propertyIndex": 0,
  318. "rasterizerState": {
  319. "cullMode": 1
  320. },
  321. "program": "legacy/standard|shadow-caster-vs:vert|shadow-caster-fs:frag",
  322. "properties": {
  323. "tilingOffset": {
  324. "value": [
  325. 1,
  326. 1,
  327. 0,
  328. 0
  329. ],
  330. "type": 16
  331. },
  332. "mainColor": {
  333. "value": [
  334. 1,
  335. 1,
  336. 1,
  337. 1
  338. ],
  339. "editor": {
  340. "displayName": "Albedo",
  341. "type": "color"
  342. },
  343. "type": 16,
  344. "handleInfo": [
  345. "albedo",
  346. 0,
  347. 16
  348. ]
  349. },
  350. "albedoScale": {
  351. "value": [
  352. 1,
  353. 1,
  354. 1
  355. ],
  356. "type": 15,
  357. "handleInfo": [
  358. "albedoScaleAndCutoff",
  359. 0,
  360. 15
  361. ]
  362. },
  363. "alphaThreshold": {
  364. "value": [
  365. 0.5
  366. ],
  367. "editor": {
  368. "parent": "USE_ALPHA_TEST"
  369. },
  370. "type": 13,
  371. "handleInfo": [
  372. "albedoScaleAndCutoff",
  373. 3,
  374. 13
  375. ]
  376. },
  377. "mainTexture": {
  378. "value": "grey",
  379. "editor": {
  380. "displayName": "AlbedoMap"
  381. },
  382. "type": 28,
  383. "handleInfo": [
  384. "albedoMap",
  385. 0,
  386. 28
  387. ]
  388. },
  389. "albedo": {
  390. "type": 16,
  391. "editor": {
  392. "visible": false,
  393. "deprecated": true
  394. },
  395. "value": [
  396. 1,
  397. 1,
  398. 1,
  399. 1
  400. ]
  401. },
  402. "albedoScaleAndCutoff": {
  403. "type": 16,
  404. "editor": {
  405. "visible": false,
  406. "deprecated": true
  407. },
  408. "value": [
  409. 1,
  410. 1,
  411. 1,
  412. 0.5
  413. ]
  414. },
  415. "albedoMap": {
  416. "type": 28,
  417. "editor": {
  418. "visible": false,
  419. "deprecated": true
  420. },
  421. "value": "grey"
  422. }
  423. }
  424. },
  425. {
  426. "phase": "planar-shadow",
  427. "propertyIndex": 0,
  428. "blendState": {
  429. "targets": [
  430. {
  431. "blend": true,
  432. "blendSrc": 2,
  433. "blendDst": 4,
  434. "blendDstAlpha": 4
  435. }
  436. ]
  437. },
  438. "program": "legacy/standard|planar-shadow-vs:vert|planar-shadow-fs:frag",
  439. "depthStencilState": {
  440. "depthTest": true,
  441. "depthWrite": false,
  442. "stencilTestFront": true,
  443. "stencilFuncFront": 5,
  444. "stencilPassOpFront": 2,
  445. "stencilRefBack": 128,
  446. "stencilRefFront": 128,
  447. "stencilReadMaskBack": 128,
  448. "stencilReadMaskFront": 128,
  449. "stencilWriteMaskBack": 128,
  450. "stencilWriteMaskFront": 128
  451. }
  452. },
  453. {
  454. "pass": "gbuffer",
  455. "phase": "gbuffer",
  456. "embeddedMacros": {
  457. "CC_PIPELINE_TYPE": 1
  458. },
  459. "propertyIndex": 0,
  460. "program": "legacy/standard|standard-vs|standard-fs"
  461. }
  462. ]
  463. },
  464. {
  465. "name": "transparent",
  466. "passes": [
  467. {
  468. "embeddedMacros": {
  469. "CC_FORCE_FORWARD_SHADING": true
  470. },
  471. "blendState": {
  472. "targets": [
  473. {
  474. "blend": true,
  475. "blendSrc": 2,
  476. "blendDst": 4,
  477. "blendDstAlpha": 4
  478. }
  479. ]
  480. },
  481. "program": "legacy/standard|standard-vs|standard-fs",
  482. "depthStencilState": {
  483. "depthTest": true,
  484. "depthWrite": false
  485. },
  486. "properties": {
  487. "tilingOffset": {
  488. "value": [
  489. 1,
  490. 1,
  491. 0,
  492. 0
  493. ],
  494. "type": 16
  495. },
  496. "mainColor": {
  497. "value": [
  498. 1,
  499. 1,
  500. 1,
  501. 1
  502. ],
  503. "linear": true,
  504. "editor": {
  505. "displayName": "Albedo",
  506. "type": "color"
  507. },
  508. "type": 16,
  509. "handleInfo": [
  510. "albedo",
  511. 0,
  512. 16
  513. ]
  514. },
  515. "albedoScale": {
  516. "value": [
  517. 1,
  518. 1,
  519. 1
  520. ],
  521. "type": 15,
  522. "handleInfo": [
  523. "albedoScaleAndCutoff",
  524. 0,
  525. 15
  526. ]
  527. },
  528. "alphaThreshold": {
  529. "value": [
  530. 0.5
  531. ],
  532. "editor": {
  533. "parent": "USE_ALPHA_TEST",
  534. "slide": true,
  535. "range": [
  536. 0,
  537. 1
  538. ],
  539. "step": 0.001
  540. },
  541. "type": 13,
  542. "handleInfo": [
  543. "albedoScaleAndCutoff",
  544. 3,
  545. 13
  546. ]
  547. },
  548. "occlusion": {
  549. "value": [
  550. 0
  551. ],
  552. "editor": {
  553. "slide": true,
  554. "range": [
  555. 0,
  556. 1
  557. ],
  558. "step": 0.001
  559. },
  560. "type": 13,
  561. "handleInfo": [
  562. "pbrParams",
  563. 0,
  564. 13
  565. ]
  566. },
  567. "roughness": {
  568. "value": [
  569. 0.5
  570. ],
  571. "editor": {
  572. "slide": true,
  573. "range": [
  574. 0,
  575. 1
  576. ],
  577. "step": 0.001
  578. },
  579. "type": 13,
  580. "handleInfo": [
  581. "pbrParams",
  582. 1,
  583. 13
  584. ]
  585. },
  586. "metallic": {
  587. "value": [
  588. 0
  589. ],
  590. "editor": {
  591. "slide": true,
  592. "range": [
  593. 0,
  594. 1
  595. ],
  596. "step": 0.001
  597. },
  598. "type": 13,
  599. "handleInfo": [
  600. "pbrParams",
  601. 2,
  602. 13
  603. ]
  604. },
  605. "specularIntensity": {
  606. "value": [
  607. 0.5
  608. ],
  609. "editor": {
  610. "slide": true,
  611. "range": [
  612. 0,
  613. 1
  614. ],
  615. "step": 0.001
  616. },
  617. "type": 13,
  618. "handleInfo": [
  619. "pbrParams",
  620. 3,
  621. 13
  622. ]
  623. },
  624. "emissive": {
  625. "value": [
  626. 0,
  627. 0,
  628. 0,
  629. 1
  630. ],
  631. "linear": true,
  632. "editor": {
  633. "type": "color"
  634. },
  635. "type": 16
  636. },
  637. "emissiveScale": {
  638. "value": [
  639. 1,
  640. 1,
  641. 1
  642. ],
  643. "type": 15,
  644. "handleInfo": [
  645. "emissiveScaleParam",
  646. 0,
  647. 15
  648. ]
  649. },
  650. "normalStrength": {
  651. "value": [
  652. 1
  653. ],
  654. "editor": {
  655. "parent": "USE_NORMAL_MAP",
  656. "slide": true,
  657. "range": [
  658. 0,
  659. 5
  660. ],
  661. "step": 0.001
  662. },
  663. "type": 13,
  664. "handleInfo": [
  665. "emissiveScaleParam",
  666. 3,
  667. 13
  668. ]
  669. },
  670. "mainTexture": {
  671. "value": "grey",
  672. "editor": {
  673. "displayName": "AlbedoMap"
  674. },
  675. "type": 28,
  676. "handleInfo": [
  677. "albedoMap",
  678. 0,
  679. 28
  680. ]
  681. },
  682. "normalMap": {
  683. "value": "normal",
  684. "type": 28
  685. },
  686. "pbrMap": {
  687. "value": "grey",
  688. "type": 28
  689. },
  690. "metallicRoughnessMap": {
  691. "value": "grey",
  692. "type": 28
  693. },
  694. "occlusionMap": {
  695. "value": "white",
  696. "type": 28
  697. },
  698. "emissiveMap": {
  699. "value": "grey",
  700. "type": 28
  701. },
  702. "albedo": {
  703. "type": 16,
  704. "editor": {
  705. "visible": false,
  706. "deprecated": true
  707. },
  708. "value": [
  709. 1,
  710. 1,
  711. 1,
  712. 1
  713. ]
  714. },
  715. "albedoScaleAndCutoff": {
  716. "type": 16,
  717. "editor": {
  718. "visible": false,
  719. "deprecated": true
  720. },
  721. "value": [
  722. 1,
  723. 1,
  724. 1,
  725. 0.5
  726. ]
  727. },
  728. "pbrParams": {
  729. "type": 16,
  730. "editor": {
  731. "visible": false,
  732. "deprecated": true
  733. },
  734. "value": [
  735. 0,
  736. 0.5,
  737. 0,
  738. 0.5
  739. ]
  740. },
  741. "emissiveScaleParam": {
  742. "type": 16,
  743. "editor": {
  744. "visible": false,
  745. "deprecated": true
  746. },
  747. "value": [
  748. 1,
  749. 1,
  750. 1,
  751. 1
  752. ]
  753. },
  754. "albedoMap": {
  755. "type": 28,
  756. "editor": {
  757. "visible": false,
  758. "deprecated": true
  759. },
  760. "value": "grey"
  761. }
  762. }
  763. },
  764. {
  765. "phase": "forward-add",
  766. "propertyIndex": 0,
  767. "embeddedMacros": {
  768. "CC_FORWARD_ADD": true
  769. },
  770. "blendState": {
  771. "targets": [
  772. {
  773. "blend": true,
  774. "blendSrc": 1,
  775. "blendDst": 1,
  776. "blendSrcAlpha": 0,
  777. "blendDstAlpha": 1
  778. }
  779. ]
  780. },
  781. "program": "legacy/standard|standard-vs|standard-fs",
  782. "depthStencilState": {
  783. "depthFunc": 2,
  784. "depthTest": true,
  785. "depthWrite": false
  786. }
  787. },
  788. {
  789. "phase": "shadow-caster",
  790. "propertyIndex": 0,
  791. "rasterizerState": {
  792. "cullMode": 1
  793. },
  794. "program": "legacy/standard|shadow-caster-vs:vert|shadow-caster-fs:frag",
  795. "properties": {
  796. "tilingOffset": {
  797. "value": [
  798. 1,
  799. 1,
  800. 0,
  801. 0
  802. ],
  803. "type": 16
  804. },
  805. "mainColor": {
  806. "value": [
  807. 1,
  808. 1,
  809. 1,
  810. 1
  811. ],
  812. "editor": {
  813. "displayName": "Albedo",
  814. "type": "color"
  815. },
  816. "type": 16,
  817. "handleInfo": [
  818. "albedo",
  819. 0,
  820. 16
  821. ]
  822. },
  823. "albedoScale": {
  824. "value": [
  825. 1,
  826. 1,
  827. 1
  828. ],
  829. "type": 15,
  830. "handleInfo": [
  831. "albedoScaleAndCutoff",
  832. 0,
  833. 15
  834. ]
  835. },
  836. "alphaThreshold": {
  837. "value": [
  838. 0.5
  839. ],
  840. "editor": {
  841. "parent": "USE_ALPHA_TEST"
  842. },
  843. "type": 13,
  844. "handleInfo": [
  845. "albedoScaleAndCutoff",
  846. 3,
  847. 13
  848. ]
  849. },
  850. "mainTexture": {
  851. "value": "grey",
  852. "editor": {
  853. "displayName": "AlbedoMap"
  854. },
  855. "type": 28,
  856. "handleInfo": [
  857. "albedoMap",
  858. 0,
  859. 28
  860. ]
  861. },
  862. "albedo": {
  863. "type": 16,
  864. "editor": {
  865. "visible": false,
  866. "deprecated": true
  867. },
  868. "value": [
  869. 1,
  870. 1,
  871. 1,
  872. 1
  873. ]
  874. },
  875. "albedoScaleAndCutoff": {
  876. "type": 16,
  877. "editor": {
  878. "visible": false,
  879. "deprecated": true
  880. },
  881. "value": [
  882. 1,
  883. 1,
  884. 1,
  885. 0.5
  886. ]
  887. },
  888. "albedoMap": {
  889. "type": 28,
  890. "editor": {
  891. "visible": false,
  892. "deprecated": true
  893. },
  894. "value": "grey"
  895. }
  896. }
  897. },
  898. {
  899. "phase": "planar-shadow",
  900. "propertyIndex": 0,
  901. "blendState": {
  902. "targets": [
  903. {
  904. "blend": true,
  905. "blendSrc": 2,
  906. "blendDst": 4,
  907. "blendDstAlpha": 4
  908. }
  909. ]
  910. },
  911. "program": "legacy/standard|planar-shadow-vs:vert|planar-shadow-fs:frag",
  912. "depthStencilState": {
  913. "depthTest": true,
  914. "depthWrite": false,
  915. "stencilTestFront": true,
  916. "stencilFuncFront": 5,
  917. "stencilPassOpFront": 2,
  918. "stencilRefBack": 128,
  919. "stencilRefFront": 128,
  920. "stencilReadMaskBack": 128,
  921. "stencilReadMaskFront": 128,
  922. "stencilWriteMaskBack": 128,
  923. "stencilWriteMaskFront": 128
  924. }
  925. },
  926. {
  927. "phase": "deferred-forward",
  928. "embeddedMacros": {
  929. "CC_PIPELINE_TYPE": 0
  930. },
  931. "propertyIndex": 0,
  932. "blendState": {
  933. "targets": [
  934. {
  935. "blend": true,
  936. "blendSrc": 2,
  937. "blendDst": 4,
  938. "blendDstAlpha": 4
  939. }
  940. ]
  941. },
  942. "program": "legacy/standard|standard-vs|standard-fs",
  943. "depthStencilState": {
  944. "depthTest": true,
  945. "depthWrite": false
  946. }
  947. }
  948. ]
  949. }
  950. ],
  951. "shaders": [
  952. {
  953. "blocks": [
  954. {
  955. "name": "Constants",
  956. "members": [
  957. {
  958. "name": "tilingOffset",
  959. "type": 16,
  960. "count": 1
  961. },
  962. {
  963. "name": "albedo",
  964. "type": 16,
  965. "count": 1
  966. },
  967. {
  968. "name": "albedoScaleAndCutoff",
  969. "type": 16,
  970. "count": 1
  971. },
  972. {
  973. "name": "pbrParams",
  974. "type": 16,
  975. "count": 1
  976. },
  977. {
  978. "name": "emissive",
  979. "type": 16,
  980. "count": 1
  981. },
  982. {
  983. "name": "emissiveScaleParam",
  984. "type": 16,
  985. "count": 1
  986. }
  987. ],
  988. "defines": [],
  989. "stageFlags": 17,
  990. "binding": 0
  991. }
  992. ],
  993. "samplerTextures": [
  994. {
  995. "name": "albedoMap",
  996. "type": 28,
  997. "count": 1,
  998. "defines": [
  999. "USE_ALBEDO_MAP"
  1000. ],
  1001. "stageFlags": 16,
  1002. "binding": 1
  1003. },
  1004. {
  1005. "name": "normalMap",
  1006. "type": 28,
  1007. "count": 1,
  1008. "defines": [
  1009. "USE_NORMAL_MAP"
  1010. ],
  1011. "stageFlags": 16,
  1012. "binding": 2
  1013. },
  1014. {
  1015. "name": "pbrMap",
  1016. "type": 28,
  1017. "count": 1,
  1018. "defines": [
  1019. "USE_PBR_MAP"
  1020. ],
  1021. "stageFlags": 16,
  1022. "binding": 3
  1023. },
  1024. {
  1025. "name": "metallicRoughnessMap",
  1026. "type": 28,
  1027. "count": 1,
  1028. "defines": [
  1029. "USE_METALLIC_ROUGHNESS_MAP"
  1030. ],
  1031. "stageFlags": 16,
  1032. "binding": 4
  1033. },
  1034. {
  1035. "name": "occlusionMap",
  1036. "type": 28,
  1037. "count": 1,
  1038. "defines": [
  1039. "USE_OCCLUSION_MAP"
  1040. ],
  1041. "stageFlags": 16,
  1042. "binding": 5
  1043. },
  1044. {
  1045. "name": "emissiveMap",
  1046. "type": 28,
  1047. "count": 1,
  1048. "defines": [
  1049. "USE_EMISSIVE_MAP"
  1050. ],
  1051. "stageFlags": 16,
  1052. "binding": 6
  1053. }
  1054. ],
  1055. "samplers": [],
  1056. "textures": [],
  1057. "buffers": [
  1058. {
  1059. "name": "b_ccLightsBuffer",
  1060. "memoryAccess": 1,
  1061. "defines": [
  1062. "CC_FORWARD_ADD",
  1063. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  1064. ],
  1065. "stageFlags": 16,
  1066. "binding": 7
  1067. },
  1068. {
  1069. "name": "b_clusterLightIndicesBuffer",
  1070. "memoryAccess": 1,
  1071. "defines": [
  1072. "CC_FORWARD_ADD",
  1073. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  1074. ],
  1075. "stageFlags": 16,
  1076. "binding": 8
  1077. },
  1078. {
  1079. "name": "b_clusterLightGridBuffer",
  1080. "memoryAccess": 1,
  1081. "defines": [
  1082. "CC_FORWARD_ADD",
  1083. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  1084. ],
  1085. "stageFlags": 16,
  1086. "binding": 9
  1087. }
  1088. ],
  1089. "images": [],
  1090. "subpassInputs": [],
  1091. "attributes": [
  1092. {
  1093. "name": "a_position",
  1094. "defines": [],
  1095. "format": 32,
  1096. "location": 0
  1097. },
  1098. {
  1099. "name": "a_normal",
  1100. "defines": [],
  1101. "format": 32,
  1102. "location": 1
  1103. },
  1104. {
  1105. "name": "a_texCoord",
  1106. "defines": [],
  1107. "format": 21,
  1108. "location": 2
  1109. },
  1110. {
  1111. "name": "a_tangent",
  1112. "defines": [],
  1113. "format": 44,
  1114. "location": 3
  1115. },
  1116. {
  1117. "name": "a_joints",
  1118. "defines": [
  1119. "CC_USE_SKINNING"
  1120. ],
  1121. "location": 4
  1122. },
  1123. {
  1124. "name": "a_weights",
  1125. "defines": [
  1126. "CC_USE_SKINNING"
  1127. ],
  1128. "format": 44,
  1129. "location": 5
  1130. },
  1131. {
  1132. "name": "a_jointAnimInfo",
  1133. "defines": [
  1134. "USE_INSTANCING",
  1135. "CC_USE_BAKED_ANIMATION"
  1136. ],
  1137. "format": 44,
  1138. "isInstanced": true,
  1139. "location": 6
  1140. },
  1141. {
  1142. "name": "a_matWorld0",
  1143. "defines": [
  1144. "USE_INSTANCING"
  1145. ],
  1146. "format": 44,
  1147. "isInstanced": true,
  1148. "location": 7
  1149. },
  1150. {
  1151. "name": "a_matWorld1",
  1152. "defines": [
  1153. "USE_INSTANCING"
  1154. ],
  1155. "format": 44,
  1156. "isInstanced": true,
  1157. "location": 8
  1158. },
  1159. {
  1160. "name": "a_matWorld2",
  1161. "defines": [
  1162. "USE_INSTANCING"
  1163. ],
  1164. "format": 44,
  1165. "isInstanced": true,
  1166. "location": 9
  1167. },
  1168. {
  1169. "name": "a_lightingMapUVParam",
  1170. "defines": [
  1171. "USE_INSTANCING",
  1172. "CC_USE_LIGHTMAP"
  1173. ],
  1174. "format": 44,
  1175. "isInstanced": true,
  1176. "location": 10
  1177. },
  1178. {
  1179. "name": "a_localShadowBiasAndProbeId",
  1180. "defines": [
  1181. "USE_INSTANCING"
  1182. ],
  1183. "format": 44,
  1184. "isInstanced": true,
  1185. "location": 11
  1186. },
  1187. {
  1188. "name": "a_reflectionProbeData",
  1189. "defines": [
  1190. "USE_INSTANCING",
  1191. "CC_USE_REFLECTION_PROBE"
  1192. ],
  1193. "format": 44,
  1194. "isInstanced": true,
  1195. "location": 12
  1196. },
  1197. {
  1198. "name": "a_sh_linear_const_r",
  1199. "defines": [
  1200. "USE_INSTANCING",
  1201. "CC_USE_LIGHT_PROBE"
  1202. ],
  1203. "format": 44,
  1204. "isInstanced": true,
  1205. "location": 13
  1206. },
  1207. {
  1208. "name": "a_sh_linear_const_g",
  1209. "defines": [
  1210. "USE_INSTANCING",
  1211. "CC_USE_LIGHT_PROBE"
  1212. ],
  1213. "format": 44,
  1214. "isInstanced": true,
  1215. "location": 14
  1216. },
  1217. {
  1218. "name": "a_sh_linear_const_b",
  1219. "defines": [
  1220. "USE_INSTANCING",
  1221. "CC_USE_LIGHT_PROBE"
  1222. ],
  1223. "format": 44,
  1224. "isInstanced": true,
  1225. "location": 15
  1226. },
  1227. {
  1228. "name": "a_vertexId",
  1229. "defines": [
  1230. "CC_USE_MORPH"
  1231. ],
  1232. "format": 11,
  1233. "location": 16
  1234. },
  1235. {
  1236. "name": "a_color",
  1237. "defines": [
  1238. "USE_VERTEX_COLOR"
  1239. ],
  1240. "format": 44,
  1241. "location": 17
  1242. },
  1243. {
  1244. "name": "a_texCoord1",
  1245. "defines": [],
  1246. "format": 21,
  1247. "location": 18
  1248. }
  1249. ],
  1250. "varyings": [
  1251. {
  1252. "name": "v_fog_factor",
  1253. "type": 13,
  1254. "count": 1,
  1255. "defines": [
  1256. "!CC_USE_ACCURATE_FOG"
  1257. ],
  1258. "stageFlags": 17,
  1259. "location": 0
  1260. },
  1261. {
  1262. "name": "v_shadowPos",
  1263. "type": 16,
  1264. "count": 1,
  1265. "defines": [],
  1266. "stageFlags": 17,
  1267. "location": 1
  1268. },
  1269. {
  1270. "name": "v_sh_linear_const_r",
  1271. "type": 16,
  1272. "count": 1,
  1273. "defines": [
  1274. "CC_USE_LIGHT_PROBE",
  1275. "USE_INSTANCING"
  1276. ],
  1277. "stageFlags": 17,
  1278. "location": 2
  1279. },
  1280. {
  1281. "name": "v_sh_linear_const_g",
  1282. "type": 16,
  1283. "count": 1,
  1284. "defines": [
  1285. "CC_USE_LIGHT_PROBE",
  1286. "USE_INSTANCING"
  1287. ],
  1288. "stageFlags": 17,
  1289. "location": 3
  1290. },
  1291. {
  1292. "name": "v_sh_linear_const_b",
  1293. "type": 16,
  1294. "count": 1,
  1295. "defines": [
  1296. "CC_USE_LIGHT_PROBE",
  1297. "USE_INSTANCING"
  1298. ],
  1299. "stageFlags": 17,
  1300. "location": 4
  1301. },
  1302. {
  1303. "name": "v_color",
  1304. "type": 16,
  1305. "count": 1,
  1306. "defines": [
  1307. "USE_VERTEX_COLOR"
  1308. ],
  1309. "stageFlags": 17,
  1310. "location": 5
  1311. },
  1312. {
  1313. "name": "v_position",
  1314. "type": 15,
  1315. "count": 1,
  1316. "defines": [],
  1317. "stageFlags": 17,
  1318. "location": 6
  1319. },
  1320. {
  1321. "name": "v_normal",
  1322. "type": 15,
  1323. "count": 1,
  1324. "defines": [],
  1325. "stageFlags": 17,
  1326. "location": 7
  1327. },
  1328. {
  1329. "name": "v_uv",
  1330. "type": 14,
  1331. "count": 1,
  1332. "defines": [],
  1333. "stageFlags": 17,
  1334. "location": 8
  1335. },
  1336. {
  1337. "name": "v_uv1",
  1338. "type": 14,
  1339. "count": 1,
  1340. "defines": [
  1341. "HAS_SECOND_UV"
  1342. ],
  1343. "stageFlags": 17,
  1344. "location": 9
  1345. },
  1346. {
  1347. "name": "v_shadowBiasAndProbeId",
  1348. "type": 16,
  1349. "count": 1,
  1350. "defines": [],
  1351. "stageFlags": 17,
  1352. "location": 10
  1353. },
  1354. {
  1355. "name": "v_reflectionProbeData",
  1356. "type": 16,
  1357. "count": 1,
  1358. "defines": [
  1359. "CC_USE_REFLECTION_PROBE",
  1360. "USE_INSTANCING"
  1361. ],
  1362. "stageFlags": 17,
  1363. "location": 11
  1364. },
  1365. {
  1366. "name": "v_tangent",
  1367. "type": 16,
  1368. "count": 1,
  1369. "defines": [
  1370. "USE_NORMAL_MAP"
  1371. ],
  1372. "stageFlags": 17,
  1373. "location": 12
  1374. },
  1375. {
  1376. "name": "v_luv",
  1377. "type": 15,
  1378. "count": 1,
  1379. "defines": [
  1380. "CC_USE_LIGHTMAP",
  1381. "!CC_FORWARD_ADD"
  1382. ],
  1383. "stageFlags": 17,
  1384. "location": 13
  1385. }
  1386. ],
  1387. "fragColors": [
  1388. {
  1389. "name": "fragColorX",
  1390. "typename": "vec4",
  1391. "type": 16,
  1392. "count": 1,
  1393. "defines": [
  1394. "CC_FORWARD_ADD"
  1395. ],
  1396. "stageFlags": 16,
  1397. "location": 0
  1398. },
  1399. {
  1400. "name": "albedoOut",
  1401. "typename": "vec4",
  1402. "type": 16,
  1403. "count": 1,
  1404. "defines": [
  1405. "CC_FORWARD_ADD",
  1406. "CC_PIPELINE_TYPE"
  1407. ],
  1408. "stageFlags": 16,
  1409. "location": 1
  1410. },
  1411. {
  1412. "name": "emissiveOut",
  1413. "typename": "vec4",
  1414. "type": 16,
  1415. "count": 1,
  1416. "defines": [
  1417. "CC_FORWARD_ADD",
  1418. "CC_PIPELINE_TYPE"
  1419. ],
  1420. "stageFlags": 16,
  1421. "location": 2
  1422. },
  1423. {
  1424. "name": "normalOut",
  1425. "typename": "vec4",
  1426. "type": 16,
  1427. "count": 1,
  1428. "defines": [
  1429. "CC_FORWARD_ADD",
  1430. "CC_PIPELINE_TYPE"
  1431. ],
  1432. "stageFlags": 16,
  1433. "location": 3
  1434. }
  1435. ],
  1436. "descriptors": [
  1437. {
  1438. "rate": 0,
  1439. "blocks": [
  1440. {
  1441. "tags": {
  1442. "builtin": "local"
  1443. },
  1444. "name": "CCMorph",
  1445. "members": [
  1446. {
  1447. "name": "cc_displacementWeights",
  1448. "typename": "vec4",
  1449. "type": 16,
  1450. "count": 15,
  1451. "isArray": true
  1452. },
  1453. {
  1454. "name": "cc_displacementTextureInfo",
  1455. "typename": "vec4",
  1456. "type": 16,
  1457. "count": 1
  1458. }
  1459. ],
  1460. "defines": [
  1461. "CC_USE_MORPH"
  1462. ],
  1463. "stageFlags": 1
  1464. },
  1465. {
  1466. "tags": {
  1467. "builtin": "local"
  1468. },
  1469. "name": "CCSkinningTexture",
  1470. "members": [
  1471. {
  1472. "name": "cc_jointTextureInfo",
  1473. "typename": "vec4",
  1474. "type": 16,
  1475. "count": 1,
  1476. "precision": "highp "
  1477. }
  1478. ],
  1479. "defines": [
  1480. "CC_USE_SKINNING",
  1481. "CC_USE_BAKED_ANIMATION"
  1482. ],
  1483. "stageFlags": 1
  1484. },
  1485. {
  1486. "tags": {
  1487. "builtin": "local"
  1488. },
  1489. "name": "CCSkinningAnimation",
  1490. "members": [
  1491. {
  1492. "name": "cc_jointAnimInfo",
  1493. "typename": "vec4",
  1494. "type": 16,
  1495. "count": 1,
  1496. "precision": "highp "
  1497. }
  1498. ],
  1499. "defines": [
  1500. "CC_USE_SKINNING",
  1501. "CC_USE_BAKED_ANIMATION"
  1502. ],
  1503. "stageFlags": 1
  1504. },
  1505. {
  1506. "tags": {
  1507. "builtin": "local"
  1508. },
  1509. "name": "CCSkinning",
  1510. "members": [
  1511. {
  1512. "name": "cc_joints",
  1513. "typename": "vec4",
  1514. "type": 16,
  1515. "count": 0,
  1516. "precision": "highp ",
  1517. "isArray": true
  1518. }
  1519. ],
  1520. "defines": [
  1521. "CC_USE_SKINNING",
  1522. "!CC_USE_BAKED_ANIMATION",
  1523. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  1524. ],
  1525. "stageFlags": 1
  1526. },
  1527. {
  1528. "tags": {
  1529. "builtin": "local"
  1530. },
  1531. "name": "CCLocal",
  1532. "members": [
  1533. {
  1534. "name": "cc_matWorld",
  1535. "typename": "mat4",
  1536. "type": 25,
  1537. "count": 1,
  1538. "precision": "highp "
  1539. },
  1540. {
  1541. "name": "cc_matWorldIT",
  1542. "typename": "mat4",
  1543. "type": 25,
  1544. "count": 1,
  1545. "precision": "highp "
  1546. },
  1547. {
  1548. "name": "cc_lightingMapUVParam",
  1549. "typename": "vec4",
  1550. "type": 16,
  1551. "count": 1,
  1552. "precision": "highp "
  1553. },
  1554. {
  1555. "name": "cc_localShadowBias",
  1556. "typename": "vec4",
  1557. "type": 16,
  1558. "count": 1,
  1559. "precision": "highp "
  1560. },
  1561. {
  1562. "name": "cc_reflectionProbeData1",
  1563. "typename": "vec4",
  1564. "type": 16,
  1565. "count": 1,
  1566. "precision": "highp "
  1567. },
  1568. {
  1569. "name": "cc_reflectionProbeData2",
  1570. "typename": "vec4",
  1571. "type": 16,
  1572. "count": 1,
  1573. "precision": "highp "
  1574. },
  1575. {
  1576. "name": "cc_reflectionProbeBlendData1",
  1577. "typename": "vec4",
  1578. "type": 16,
  1579. "count": 1,
  1580. "precision": "highp "
  1581. },
  1582. {
  1583. "name": "cc_reflectionProbeBlendData2",
  1584. "typename": "vec4",
  1585. "type": 16,
  1586. "count": 1,
  1587. "precision": "highp "
  1588. }
  1589. ],
  1590. "defines": [
  1591. "!USE_INSTANCING"
  1592. ],
  1593. "stageFlags": 17
  1594. },
  1595. {
  1596. "tags": {
  1597. "builtin": "local"
  1598. },
  1599. "name": "CCSH",
  1600. "members": [
  1601. {
  1602. "name": "cc_sh_linear_const_r",
  1603. "typename": "vec4",
  1604. "type": 16,
  1605. "count": 1
  1606. },
  1607. {
  1608. "name": "cc_sh_linear_const_g",
  1609. "typename": "vec4",
  1610. "type": 16,
  1611. "count": 1
  1612. },
  1613. {
  1614. "name": "cc_sh_linear_const_b",
  1615. "typename": "vec4",
  1616. "type": 16,
  1617. "count": 1
  1618. },
  1619. {
  1620. "name": "cc_sh_quadratic_r",
  1621. "typename": "vec4",
  1622. "type": 16,
  1623. "count": 1
  1624. },
  1625. {
  1626. "name": "cc_sh_quadratic_g",
  1627. "typename": "vec4",
  1628. "type": 16,
  1629. "count": 1
  1630. },
  1631. {
  1632. "name": "cc_sh_quadratic_b",
  1633. "typename": "vec4",
  1634. "type": 16,
  1635. "count": 1
  1636. },
  1637. {
  1638. "name": "cc_sh_quadratic_a",
  1639. "typename": "vec4",
  1640. "type": 16,
  1641. "count": 1
  1642. }
  1643. ],
  1644. "defines": [
  1645. "CC_USE_LIGHT_PROBE",
  1646. "!USE_INSTANCING"
  1647. ],
  1648. "stageFlags": 16
  1649. },
  1650. {
  1651. "tags": {
  1652. "builtin": "local"
  1653. },
  1654. "name": "CCForwardLight",
  1655. "members": [
  1656. {
  1657. "name": "cc_lightPos",
  1658. "typename": "vec4",
  1659. "type": 16,
  1660. "count": 0,
  1661. "precision": "highp ",
  1662. "isArray": true
  1663. },
  1664. {
  1665. "name": "cc_lightColor",
  1666. "typename": "vec4",
  1667. "type": 16,
  1668. "count": 0,
  1669. "isArray": true
  1670. },
  1671. {
  1672. "name": "cc_lightSizeRangeAngle",
  1673. "typename": "vec4",
  1674. "type": 16,
  1675. "count": 0,
  1676. "isArray": true
  1677. },
  1678. {
  1679. "name": "cc_lightDir",
  1680. "typename": "vec4",
  1681. "type": 16,
  1682. "count": 0,
  1683. "isArray": true
  1684. },
  1685. {
  1686. "name": "cc_lightBoundingSizeVS",
  1687. "typename": "vec4",
  1688. "type": 16,
  1689. "count": 0,
  1690. "isArray": true
  1691. }
  1692. ],
  1693. "defines": [
  1694. "CC_FORWARD_ADD",
  1695. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  1696. ],
  1697. "stageFlags": 16
  1698. }
  1699. ],
  1700. "samplerTextures": [
  1701. {
  1702. "tags": {
  1703. "builtin": "local"
  1704. },
  1705. "name": "cc_PositionDisplacements",
  1706. "typename": "sampler2D",
  1707. "type": 28,
  1708. "count": 1,
  1709. "defines": [
  1710. "CC_USE_MORPH",
  1711. "CC_MORPH_TARGET_HAS_POSITION"
  1712. ],
  1713. "stageFlags": 1
  1714. },
  1715. {
  1716. "tags": {
  1717. "builtin": "local"
  1718. },
  1719. "name": "cc_NormalDisplacements",
  1720. "typename": "sampler2D",
  1721. "type": 28,
  1722. "count": 1,
  1723. "defines": [
  1724. "CC_USE_MORPH",
  1725. "CC_MORPH_TARGET_HAS_NORMAL"
  1726. ],
  1727. "stageFlags": 1
  1728. },
  1729. {
  1730. "tags": {
  1731. "builtin": "local"
  1732. },
  1733. "name": "cc_TangentDisplacements",
  1734. "typename": "sampler2D",
  1735. "type": 28,
  1736. "count": 1,
  1737. "defines": [
  1738. "CC_USE_MORPH",
  1739. "CC_MORPH_TARGET_HAS_TANGENT"
  1740. ],
  1741. "stageFlags": 1
  1742. },
  1743. {
  1744. "tags": {
  1745. "builtin": "local"
  1746. },
  1747. "name": "cc_jointTexture",
  1748. "typename": "sampler2D",
  1749. "type": 28,
  1750. "count": 1,
  1751. "precision": "highp ",
  1752. "defines": [
  1753. "CC_USE_SKINNING",
  1754. "CC_USE_BAKED_ANIMATION"
  1755. ],
  1756. "stageFlags": 1
  1757. },
  1758. {
  1759. "tags": {
  1760. "builtin": "local"
  1761. },
  1762. "name": "cc_realtimeJoint",
  1763. "typename": "sampler2D",
  1764. "type": 28,
  1765. "count": 1,
  1766. "precision": "highp ",
  1767. "defines": [
  1768. "CC_USE_SKINNING",
  1769. "!CC_USE_BAKED_ANIMATION",
  1770. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  1771. ],
  1772. "stageFlags": 1
  1773. },
  1774. {
  1775. "tags": {
  1776. "builtin": "local"
  1777. },
  1778. "name": "cc_reflectionProbeCubemap",
  1779. "typename": "samplerCube",
  1780. "type": 31,
  1781. "count": 1,
  1782. "defines": [
  1783. "CC_USE_REFLECTION_PROBE"
  1784. ],
  1785. "stageFlags": 16
  1786. },
  1787. {
  1788. "tags": {
  1789. "builtin": "local"
  1790. },
  1791. "name": "cc_reflectionProbePlanarMap",
  1792. "typename": "sampler2D",
  1793. "type": 28,
  1794. "count": 1,
  1795. "defines": [
  1796. "CC_USE_REFLECTION_PROBE"
  1797. ],
  1798. "stageFlags": 16
  1799. },
  1800. {
  1801. "tags": {
  1802. "builtin": "local"
  1803. },
  1804. "name": "cc_reflectionProbeDataMap",
  1805. "typename": "sampler2D",
  1806. "type": 28,
  1807. "count": 1,
  1808. "defines": [
  1809. "CC_USE_REFLECTION_PROBE"
  1810. ],
  1811. "stageFlags": 16
  1812. },
  1813. {
  1814. "tags": {
  1815. "builtin": "local"
  1816. },
  1817. "name": "cc_reflectionProbeBlendCubemap",
  1818. "typename": "samplerCube",
  1819. "type": 31,
  1820. "count": 1,
  1821. "defines": [
  1822. "CC_USE_REFLECTION_PROBE"
  1823. ],
  1824. "stageFlags": 16
  1825. },
  1826. {
  1827. "tags": {
  1828. "builtin": "local"
  1829. },
  1830. "name": "cc_lightingMap",
  1831. "typename": "sampler2D",
  1832. "type": 28,
  1833. "count": 1,
  1834. "defines": [
  1835. "CC_USE_LIGHTMAP",
  1836. "!CC_FORWARD_ADD"
  1837. ],
  1838. "stageFlags": 16
  1839. }
  1840. ],
  1841. "samplers": [],
  1842. "textures": [],
  1843. "buffers": [],
  1844. "images": [],
  1845. "subpassInputs": []
  1846. },
  1847. {
  1848. "rate": 1,
  1849. "blocks": [
  1850. {
  1851. "name": "Constants",
  1852. "members": [
  1853. {
  1854. "name": "tilingOffset",
  1855. "type": 16,
  1856. "count": 1
  1857. },
  1858. {
  1859. "name": "albedo",
  1860. "type": 16,
  1861. "count": 1
  1862. },
  1863. {
  1864. "name": "albedoScaleAndCutoff",
  1865. "type": 16,
  1866. "count": 1
  1867. },
  1868. {
  1869. "name": "pbrParams",
  1870. "type": 16,
  1871. "count": 1
  1872. },
  1873. {
  1874. "name": "emissive",
  1875. "type": 16,
  1876. "count": 1
  1877. },
  1878. {
  1879. "name": "emissiveScaleParam",
  1880. "type": 16,
  1881. "count": 1
  1882. }
  1883. ],
  1884. "defines": [],
  1885. "stageFlags": 17,
  1886. "binding": 0
  1887. }
  1888. ],
  1889. "samplerTextures": [
  1890. {
  1891. "name": "albedoMap",
  1892. "type": 28,
  1893. "count": 1,
  1894. "defines": [
  1895. "USE_ALBEDO_MAP"
  1896. ],
  1897. "stageFlags": 16,
  1898. "binding": 1
  1899. },
  1900. {
  1901. "name": "normalMap",
  1902. "type": 28,
  1903. "count": 1,
  1904. "defines": [
  1905. "USE_NORMAL_MAP"
  1906. ],
  1907. "stageFlags": 16,
  1908. "binding": 2
  1909. },
  1910. {
  1911. "name": "pbrMap",
  1912. "type": 28,
  1913. "count": 1,
  1914. "defines": [
  1915. "USE_PBR_MAP"
  1916. ],
  1917. "stageFlags": 16,
  1918. "binding": 3
  1919. },
  1920. {
  1921. "name": "metallicRoughnessMap",
  1922. "type": 28,
  1923. "count": 1,
  1924. "defines": [
  1925. "USE_METALLIC_ROUGHNESS_MAP"
  1926. ],
  1927. "stageFlags": 16,
  1928. "binding": 4
  1929. },
  1930. {
  1931. "name": "occlusionMap",
  1932. "type": 28,
  1933. "count": 1,
  1934. "defines": [
  1935. "USE_OCCLUSION_MAP"
  1936. ],
  1937. "stageFlags": 16,
  1938. "binding": 5
  1939. },
  1940. {
  1941. "name": "emissiveMap",
  1942. "type": 28,
  1943. "count": 1,
  1944. "defines": [
  1945. "USE_EMISSIVE_MAP"
  1946. ],
  1947. "stageFlags": 16,
  1948. "binding": 6
  1949. }
  1950. ],
  1951. "samplers": [],
  1952. "textures": [],
  1953. "buffers": [
  1954. {
  1955. "name": "b_ccLightsBuffer",
  1956. "memoryAccess": 1,
  1957. "defines": [
  1958. "CC_FORWARD_ADD",
  1959. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  1960. ],
  1961. "stageFlags": 16,
  1962. "binding": 7
  1963. },
  1964. {
  1965. "name": "b_clusterLightIndicesBuffer",
  1966. "memoryAccess": 1,
  1967. "defines": [
  1968. "CC_FORWARD_ADD",
  1969. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  1970. ],
  1971. "stageFlags": 16,
  1972. "binding": 8
  1973. },
  1974. {
  1975. "name": "b_clusterLightGridBuffer",
  1976. "memoryAccess": 1,
  1977. "defines": [
  1978. "CC_FORWARD_ADD",
  1979. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  1980. ],
  1981. "stageFlags": 16,
  1982. "binding": 9
  1983. }
  1984. ],
  1985. "images": [],
  1986. "subpassInputs": []
  1987. },
  1988. {
  1989. "rate": 2,
  1990. "blocks": [],
  1991. "samplerTextures": [],
  1992. "samplers": [],
  1993. "textures": [],
  1994. "buffers": [],
  1995. "images": [],
  1996. "subpassInputs": []
  1997. },
  1998. {
  1999. "rate": 3,
  2000. "blocks": [
  2001. {
  2002. "tags": {
  2003. "builtin": "global"
  2004. },
  2005. "name": "CCGlobal",
  2006. "members": [
  2007. {
  2008. "name": "cc_time",
  2009. "typename": "vec4",
  2010. "type": 16,
  2011. "count": 1,
  2012. "precision": "highp "
  2013. },
  2014. {
  2015. "name": "cc_screenSize",
  2016. "typename": "vec4",
  2017. "type": 16,
  2018. "count": 1,
  2019. "precision": "mediump "
  2020. },
  2021. {
  2022. "name": "cc_nativeSize",
  2023. "typename": "vec4",
  2024. "type": 16,
  2025. "count": 1,
  2026. "precision": "mediump "
  2027. },
  2028. {
  2029. "name": "cc_probeInfo",
  2030. "typename": "vec4",
  2031. "type": 16,
  2032. "count": 1,
  2033. "precision": "mediump "
  2034. },
  2035. {
  2036. "name": "cc_debug_view_mode",
  2037. "typename": "vec4",
  2038. "type": 16,
  2039. "count": 1,
  2040. "precision": "mediump "
  2041. }
  2042. ],
  2043. "defines": [],
  2044. "stageFlags": 17
  2045. },
  2046. {
  2047. "tags": {
  2048. "builtin": "global"
  2049. },
  2050. "name": "CCCamera",
  2051. "members": [
  2052. {
  2053. "name": "cc_matView",
  2054. "typename": "mat4",
  2055. "type": 25,
  2056. "count": 1,
  2057. "precision": "highp "
  2058. },
  2059. {
  2060. "name": "cc_matViewInv",
  2061. "typename": "mat4",
  2062. "type": 25,
  2063. "count": 1,
  2064. "precision": "highp "
  2065. },
  2066. {
  2067. "name": "cc_matProj",
  2068. "typename": "mat4",
  2069. "type": 25,
  2070. "count": 1,
  2071. "precision": "highp "
  2072. },
  2073. {
  2074. "name": "cc_matProjInv",
  2075. "typename": "mat4",
  2076. "type": 25,
  2077. "count": 1,
  2078. "precision": "highp "
  2079. },
  2080. {
  2081. "name": "cc_matViewProj",
  2082. "typename": "mat4",
  2083. "type": 25,
  2084. "count": 1,
  2085. "precision": "highp "
  2086. },
  2087. {
  2088. "name": "cc_matViewProjInv",
  2089. "typename": "mat4",
  2090. "type": 25,
  2091. "count": 1,
  2092. "precision": "highp "
  2093. },
  2094. {
  2095. "name": "cc_cameraPos",
  2096. "typename": "vec4",
  2097. "type": 16,
  2098. "count": 1,
  2099. "precision": "highp "
  2100. },
  2101. {
  2102. "name": "cc_surfaceTransform",
  2103. "typename": "vec4",
  2104. "type": 16,
  2105. "count": 1,
  2106. "precision": "mediump "
  2107. },
  2108. {
  2109. "name": "cc_screenScale",
  2110. "typename": "vec4",
  2111. "type": 16,
  2112. "count": 1,
  2113. "precision": "mediump "
  2114. },
  2115. {
  2116. "name": "cc_exposure",
  2117. "typename": "vec4",
  2118. "type": 16,
  2119. "count": 1,
  2120. "precision": "mediump "
  2121. },
  2122. {
  2123. "name": "cc_mainLitDir",
  2124. "typename": "vec4",
  2125. "type": 16,
  2126. "count": 1,
  2127. "precision": "mediump "
  2128. },
  2129. {
  2130. "name": "cc_mainLitColor",
  2131. "typename": "vec4",
  2132. "type": 16,
  2133. "count": 1,
  2134. "precision": "mediump "
  2135. },
  2136. {
  2137. "name": "cc_ambientSky",
  2138. "typename": "vec4",
  2139. "type": 16,
  2140. "count": 1,
  2141. "precision": "mediump "
  2142. },
  2143. {
  2144. "name": "cc_ambientGround",
  2145. "typename": "vec4",
  2146. "type": 16,
  2147. "count": 1,
  2148. "precision": "mediump "
  2149. },
  2150. {
  2151. "name": "cc_fogColor",
  2152. "typename": "vec4",
  2153. "type": 16,
  2154. "count": 1,
  2155. "precision": "mediump "
  2156. },
  2157. {
  2158. "name": "cc_fogBase",
  2159. "typename": "vec4",
  2160. "type": 16,
  2161. "count": 1,
  2162. "precision": "mediump "
  2163. },
  2164. {
  2165. "name": "cc_fogAdd",
  2166. "typename": "vec4",
  2167. "type": 16,
  2168. "count": 1,
  2169. "precision": "mediump "
  2170. },
  2171. {
  2172. "name": "cc_nearFar",
  2173. "typename": "vec4",
  2174. "type": 16,
  2175. "count": 1,
  2176. "precision": "mediump "
  2177. },
  2178. {
  2179. "name": "cc_viewPort",
  2180. "typename": "vec4",
  2181. "type": 16,
  2182. "count": 1,
  2183. "precision": "mediump "
  2184. }
  2185. ],
  2186. "defines": [],
  2187. "stageFlags": 17
  2188. },
  2189. {
  2190. "tags": {
  2191. "builtin": "global"
  2192. },
  2193. "name": "CCShadow",
  2194. "members": [
  2195. {
  2196. "name": "cc_matLightView",
  2197. "typename": "mat4",
  2198. "type": 25,
  2199. "count": 1,
  2200. "precision": "highp "
  2201. },
  2202. {
  2203. "name": "cc_matLightViewProj",
  2204. "typename": "mat4",
  2205. "type": 25,
  2206. "count": 1,
  2207. "precision": "highp "
  2208. },
  2209. {
  2210. "name": "cc_shadowInvProjDepthInfo",
  2211. "typename": "vec4",
  2212. "type": 16,
  2213. "count": 1,
  2214. "precision": "highp "
  2215. },
  2216. {
  2217. "name": "cc_shadowProjDepthInfo",
  2218. "typename": "vec4",
  2219. "type": 16,
  2220. "count": 1,
  2221. "precision": "highp "
  2222. },
  2223. {
  2224. "name": "cc_shadowProjInfo",
  2225. "typename": "vec4",
  2226. "type": 16,
  2227. "count": 1,
  2228. "precision": "highp "
  2229. },
  2230. {
  2231. "name": "cc_shadowNFLSInfo",
  2232. "typename": "vec4",
  2233. "type": 16,
  2234. "count": 1,
  2235. "precision": "mediump "
  2236. },
  2237. {
  2238. "name": "cc_shadowWHPBInfo",
  2239. "typename": "vec4",
  2240. "type": 16,
  2241. "count": 1,
  2242. "precision": "mediump "
  2243. },
  2244. {
  2245. "name": "cc_shadowLPNNInfo",
  2246. "typename": "vec4",
  2247. "type": 16,
  2248. "count": 1,
  2249. "precision": "mediump "
  2250. },
  2251. {
  2252. "name": "cc_shadowColor",
  2253. "typename": "vec4",
  2254. "type": 16,
  2255. "count": 1,
  2256. "precision": "lowp "
  2257. },
  2258. {
  2259. "name": "cc_planarNDInfo",
  2260. "typename": "vec4",
  2261. "type": 16,
  2262. "count": 1,
  2263. "precision": "mediump "
  2264. }
  2265. ],
  2266. "defines": [],
  2267. "stageFlags": 17
  2268. },
  2269. {
  2270. "tags": {
  2271. "builtin": "global"
  2272. },
  2273. "name": "CCCSM",
  2274. "members": [
  2275. {
  2276. "name": "cc_csmViewDir0",
  2277. "typename": "vec4",
  2278. "type": 16,
  2279. "count": 4,
  2280. "precision": "highp ",
  2281. "isArray": true
  2282. },
  2283. {
  2284. "name": "cc_csmViewDir1",
  2285. "typename": "vec4",
  2286. "type": 16,
  2287. "count": 4,
  2288. "precision": "highp ",
  2289. "isArray": true
  2290. },
  2291. {
  2292. "name": "cc_csmViewDir2",
  2293. "typename": "vec4",
  2294. "type": 16,
  2295. "count": 4,
  2296. "precision": "highp ",
  2297. "isArray": true
  2298. },
  2299. {
  2300. "name": "cc_csmAtlas",
  2301. "typename": "vec4",
  2302. "type": 16,
  2303. "count": 4,
  2304. "precision": "highp ",
  2305. "isArray": true
  2306. },
  2307. {
  2308. "name": "cc_matCSMViewProj",
  2309. "typename": "mat4",
  2310. "type": 25,
  2311. "count": 4,
  2312. "precision": "highp ",
  2313. "isArray": true
  2314. },
  2315. {
  2316. "name": "cc_csmProjDepthInfo",
  2317. "typename": "vec4",
  2318. "type": 16,
  2319. "count": 4,
  2320. "precision": "highp ",
  2321. "isArray": true
  2322. },
  2323. {
  2324. "name": "cc_csmProjInfo",
  2325. "typename": "vec4",
  2326. "type": 16,
  2327. "count": 4,
  2328. "precision": "highp ",
  2329. "isArray": true
  2330. },
  2331. {
  2332. "name": "cc_csmSplitsInfo",
  2333. "typename": "vec4",
  2334. "type": 16,
  2335. "count": 1,
  2336. "precision": "highp "
  2337. }
  2338. ],
  2339. "defines": [
  2340. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  2341. ],
  2342. "stageFlags": 17
  2343. }
  2344. ],
  2345. "samplerTextures": [
  2346. {
  2347. "tags": {
  2348. "builtin": "global"
  2349. },
  2350. "name": "cc_shadowMap",
  2351. "typename": "sampler2D",
  2352. "type": 28,
  2353. "count": 1,
  2354. "precision": "highp ",
  2355. "defines": [
  2356. "CC_RECEIVE_SHADOW"
  2357. ],
  2358. "stageFlags": 17
  2359. },
  2360. {
  2361. "tags": {
  2362. "builtin": "global"
  2363. },
  2364. "name": "cc_spotShadowMap",
  2365. "typename": "sampler2D",
  2366. "type": 28,
  2367. "count": 1,
  2368. "precision": "highp ",
  2369. "defines": [
  2370. "CC_RECEIVE_SHADOW"
  2371. ],
  2372. "stageFlags": 17
  2373. },
  2374. {
  2375. "tags": {
  2376. "builtin": "global"
  2377. },
  2378. "name": "cc_environment",
  2379. "typename": "samplerCube",
  2380. "type": 31,
  2381. "count": 1,
  2382. "defines": [],
  2383. "stageFlags": 16
  2384. },
  2385. {
  2386. "tags": {
  2387. "builtin": "global"
  2388. },
  2389. "name": "cc_diffuseMap",
  2390. "typename": "samplerCube",
  2391. "type": 31,
  2392. "count": 1,
  2393. "defines": [
  2394. "CC_USE_IBL",
  2395. "CC_USE_DIFFUSEMAP"
  2396. ],
  2397. "stageFlags": 16
  2398. }
  2399. ],
  2400. "samplers": [],
  2401. "textures": [],
  2402. "buffers": [],
  2403. "images": [],
  2404. "subpassInputs": []
  2405. }
  2406. ],
  2407. "hash": 566880691,
  2408. "glsl4": {
  2409. "vert": "#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\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\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\nlayout(location = 3) in vec4 a_tangent;\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 = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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 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\nvoid CCVertInput(inout StandardVertInput In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\n}\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#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}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\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}\n#if !CC_USE_ACCURATE_FOG\nlayout(location = 0) out mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\nlayout(location = 1) out highp vec4 v_shadowPos;\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\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_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 #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_RECEIVE_SHADOW\nvec2 CCGetShadowBias()\n{\n #if USE_INSTANCING\n return vec2(a_localShadowBiasAndProbeId.x + cc_shadowWHPBInfo.w, a_localShadowBiasAndProbeId.y + cc_shadowLPNNInfo.z);\n #else\n return vec2(cc_localShadowBias.x + cc_shadowWHPBInfo.w, cc_localShadowBias.y + cc_shadowLPNNInfo.z);\n #endif\n}\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 2) out mediump vec4 v_sh_linear_const_r;\n layout(location = 3) out mediump vec4 v_sh_linear_const_g;\n layout(location = 4) out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\nvoid CC_TRANSFER_SH() {\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}\n#if USE_VERTEX_COLOR\n layout(location = 17) in vec4 a_color;\n layout(location = 5) out lowp vec4 v_color;\n#endif\nlayout(location = 6) out vec3 v_position;\nlayout(location = 7) out vec3 v_normal;\nlayout(location = 8) out vec2 v_uv;\n#if HAS_SECOND_UV\n layout(location = 9) out mediump vec2 v_uv1;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 10) out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 11) out mediump vec4 v_reflectionProbeData;\n#endif\n#if USE_NORMAL_MAP\n layout(location = 12) out mediump vec4 v_tangent;\n#endif\n#if HAS_SECOND_UV || CC_USE_LIGHTMAP\n layout(location = 18) in vec2 a_texCoord1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 13) out vec3 v_luv;\n void CCLightingMapCaclUV()\n {\n #if !USE_INSTANCING\n v_luv.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n v_luv.z = cc_lightingMapUVParam.w;\n #else\n v_luv.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n v_luv.z = a_lightingMapUVParam.w;\n #endif\n }\n#endif\nvoid main () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec4 pos = matWorld * In.position;\n v_position = pos.xyz;\n v_normal = normalize((matWorldIT * vec4(In.normal, 0.0)).xyz);\n #if CC_RECEIVE_SHADOW\n v_shadowBiasAndProbeId.xy = CCGetShadowBias();\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n v_shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n v_shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n #if USE_TWOSIDE\n vec3 viewDirect = normalize(cc_cameraPos.xyz - v_position);\n v_normal *= dot(v_normal, viewDirect) < 0.0 ? -1.0 : 1.0;\n #endif\n #if USE_NORMAL_MAP\n v_tangent.xyz = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n v_tangent.w = In.tangent.w;\n #endif\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv1 = cc_cameraPos.w > 1.0 ? vec2(v_uv1.x, 1.0 - v_uv1.y) : v_uv1;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n CC_TRANSFER_FOG(pos);\n v_shadowPos = cc_matLightViewProj * pos;\n CC_TRANSFER_SH();\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n CCLightingMapCaclUV();\n #endif\n gl_Position = cc_matProj * (cc_matView * matWorld) * In.position;\n}",
  2410. "frag": "\nprecision highp float;\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 = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\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_ACCURATE_FOG\nlayout(location = 0) in mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\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\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}\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\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\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\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 #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n highp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\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\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}\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 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nlayout(set = 0, binding = 5) uniform samplerCube cc_environment;\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\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 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 vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHT_PROBE\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n layout(location = 2) in mediump vec4 v_sh_linear_const_r;\n layout(location = 3) in mediump vec4 v_sh_linear_const_g;\n layout(location = 4) in mediump vec4 v_sh_linear_const_b;\n #else\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 #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\n#endif\nfloat GGXMobile (float roughness, float NoH, vec3 H, vec3 N) {\n vec3 NxH = cross(N, H);\n float OneMinusNoHSqr = dot(NxH, NxH);\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n}\nfloat CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n}\nvec3 BRDFApprox (vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n return max(vec3(0.0), specular * AB.x + AB.y);\n}\n#if USE_REFLECTION_DENOISE\n vec3 GetEnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity, vec2 screenUV) {\n #if CC_USE_IBL\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n vec4 biased = fragTextureLod(cc_reflectionProbeCubemap, R, mip + mipBias);\n \t vec4 filtered = texture(cc_reflectionProbeCubemap, R);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec4 biased = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mip + mipBias);\n vec4 filtered = texture(cc_reflectionProbePlanarMap, screenUV);\n #else\n vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);\n \t vec4 filtered = texture(cc_environment, R);\n #endif\n #if CC_USE_IBL == 2 || CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_NONE\n biased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n#endif\nstruct StandardSurface {\n vec4 albedo;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 emissive;\n vec4 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n float specularIntensity;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n float reflectionProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n float reflectionProbeBlendId;\n float reflectionProbeBlendFactor;\n #endif\n};\n vec3 SampleReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n if (isRGBE)\n return unpackRGBE(envmap);\n else\n return SRGBToLinear(envmap.rgb);\n }\nvec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.08 * s.specularIntensity), s.albedo.rgb, s.metallic);\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = max(dot(N, L), 0.0);\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (NL > 0.0 && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n vec3 finalColor = vec3(0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmap = s.lightmap.rgb;\n #if CC_USE_HDR\n lightmap.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n #if CC_USE_LIGHTMAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n shadow *= s.lightmap.a;\n finalColor += diffuse * lightmap.rgb;\n #else\n finalColor += diffuse * lightmap.rgb * shadow;\n #endif\n s.occlusion *= s.lightmap_test;\n #endif\n #if !CC_DISABLE_DIRECTIONAL_LIGHT\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n vec3 lightingColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse / PI;\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n vec3 dirlightContrib = (diffuseContrib + specularContrib);\n dirlightContrib *= shadow;\n finalColor += lightingColor * dirlightContrib;\n #endif\n float fAmb = max(EPSILON, 0.5 - N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n vec3 env = vec3(0.0), rotationDir;\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n rotationDir = RotationVecFromAxisY(N.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = texture(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #if !CC_USE_REFLECTION_PROBE\n vec3 R = normalize(reflect(-V, N));\n rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n env = GetEnvReflectionWithMipFiltering(rotationDir, s.roughness, cc_ambientGround.w, 0.6, vec2(0.0));\n #else\n vec4 envmap = fragTextureLod(cc_environment, rotationDir, s.roughness * (cc_ambientGround.w - 1.0));\n #if CC_USE_IBL == 2\n env = unpackRGBE(envmap);\n #else\n env = SRGBToLinear(envmap.rgb);\n #endif\n #endif\n #endif\n #endif\n float lightIntensity = cc_ambientSky.w;\n #if CC_USE_REFLECTION_PROBE\n vec4 probe = vec4(0.0);\n vec3 R = normalize(reflect(-V, N));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(s.reflectionProbeId < 0.0){\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, position, centerPos, boxHalfSize);\n env = mix(SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity,\n SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId)), fixedR.w);\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n if(s.reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(s.position, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0);\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, s.reflectionProbeId);\n R = normalize(CalculateReflectDirection(N, V, max(abs(dot(N, V)), 0.0)));\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(N, V, s.position, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount);\n }\n env = unpackRGBE(probe);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if (s.reflectionProbeId < 0.0) {\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n } else {\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, s.position, centerPos, boxHalfSize);\n env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));\n if (s.reflectionProbeBlendId < 0.0) {\n vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);\n #else\n env = mix(skyBoxEnv, env, fixedR.w);\n #endif\n } else {\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, s.reflectionProbeBlendId);\n vec4 fixedRBlend = CalculateBoxProjectedDirection(R, s.position, centerPosBlend, boxHalfSizeBlend);\n vec3 probe1 = SampleReflectionProbe(cc_reflectionProbeBlendCubemap, fixedRBlend.xyz, s.roughness, mipCountBlend, isBlendReflectProbeUsingRGBE(s.reflectionProbeBlendId));\n env = mix(env, probe1, s.reflectionProbeBlendFactor);\n }\n }\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = s.reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n finalColor += env * lightIntensity * specular * s.occlusion;\n#if CC_USE_LIGHT_PROBE\n finalColor += SHEvaluate(N) * diffuse * s.occlusion;\n#endif\n finalColor += ambDiff.rgb * cc_ambientSky.w * diffuse * s.occlusion;\n finalColor += s.emissive;\n return vec4(finalColor, s.albedo.a);\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}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nlayout(location = 1) in highp vec4 v_shadowPos;\n#if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n layout(location = 13) in vec3 v_luv;\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#endif\nlayout(location = 6) in vec3 v_position;\nlayout(location = 8) in vec2 v_uv;\n#if HAS_SECOND_UV\n layout(location = 9) in mediump vec2 v_uv1;\n#endif\nlayout(location = 7) in vec3 v_normal;\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n layout(location = 10) in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n layout(location = 11) in mediump vec4 v_reflectionProbeData;\n#endif\n#if USE_VERTEX_COLOR\n layout(location = 5) in lowp vec4 v_color;\n#endif\n#if USE_ALBEDO_MAP\n layout(set = 1, binding = 1) uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n layout(location = 12) in mediump vec4 v_tangent;\n layout(set = 1, binding = 2) uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n layout(set = 1, binding = 3) uniform sampler2D pbrMap;\n#endif\n#if USE_METALLIC_ROUGHNESS_MAP\n layout(set = 1, binding = 4) uniform sampler2D metallicRoughnessMap;\n#endif\n#if USE_OCCLUSION_MAP\n layout(set = 1, binding = 5) uniform sampler2D occlusionMap;\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\nvoid surf (out StandardSurface s) {\n vec4 baseColor = albedo;\n #if USE_VERTEX_COLOR\n baseColor.rgb *= SRGBToLinear(v_color.rgb);\n baseColor.a *= v_color.a;\n #endif\n #if USE_ALBEDO_MAP\n vec4 texColor = texture(albedoMap, ALBEDO_UV);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n baseColor *= texColor;\n #endif\n s.albedo = baseColor;\n s.albedo.rgb *= albedoScaleAndCutoff.xyz;\n #if USE_ALPHA_TEST\n if (s.albedo.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n s.normal = v_normal;\n #if CC_RECEIVE_SHADOW\n s.shadowBias = v_shadowBiasAndProbeId.xy;\n #endif\n #if CC_USE_REFLECTION_PROBE\n s.reflectionProbeId = v_shadowBiasAndProbeId.z;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n s.reflectionProbeBlendId = v_shadowBiasAndProbeId.w;\n #if USE_INSTANCING\n s.reflectionProbeBlendFactor = v_reflectionProbeData.x;\n #else\n s.reflectionProbeBlendFactor = cc_reflectionProbeBlendData1.w;\n #endif\n #endif\n #if USE_NORMAL_MAP\n vec3 nmmp = texture(normalMap, NORMAL_UV).xyz - vec3(0.5);\n vec3 bitangent = cross(v_normal, v_tangent.xyz) * (v_tangent.w > 0.0 ? 1.0 : -1.0);\n s.normal =\n (nmmp.x * emissiveScaleParam.w) * normalize(v_tangent.xyz) +\n (nmmp.y * emissiveScaleParam.w) * normalize(bitangent) +\n nmmp.z * normalize(s.normal);\n #endif\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n SampleAndDecodeLightMapColor(s.lightmap.rgb, s.lightmap.a, s.lightmap_test, cc_lightingMap, v_luv.xy, v_luv.z, s.normal);\n #endif\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(s.position, s.position_fract_part, v_position);\n #else\n s.position = v_position;\n #endif\n vec4 pbr = pbrParams;\n pbr.x = 1.0;\n #if USE_PBR_MAP\n vec4 res = texture(pbrMap, PBR_UV);\n pbr.x = mix(1.0, res.r, pbrParams.x);\n pbr.y *= res.g;\n pbr.z *= res.b;\n pbr.w *= res.a;\n #endif\n #if USE_METALLIC_ROUGHNESS_MAP\n vec4 metallicRoughness = texture(metallicRoughnessMap, PBR_UV);\n pbr.z *= metallicRoughness.b;\n pbr.y *= metallicRoughness.g;\n #endif\n #if USE_OCCLUSION_MAP\n pbr.x = mix(1.0, texture(occlusionMap, PBR_UV).r, pbrParams.x);\n #endif\n s.occlusion = pbr.x;\n s.roughness = pbr.y;\n s.metallic = pbr.z;\n s.specularIntensity = pbr.w;\n s.emissive = emissive.rgb;\n #if USE_EMISSIVE_MAP\n s.emissive = SRGBToLinear(texture(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n s.emissive *= emissiveScaleParam.xyz;\n}\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 float 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 }\n float 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 }\n float 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 }\n float 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 }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\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 SLU = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.0);\n float SNH = max(dot(N, SH), 0.0);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n float cosInner = max(dot(-cc_lightDir[i].xyz, SL), 0.01);\n float cosOuter = cc_lightSizeRangeAngle[i].z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -cc_lightDir[i].xyz, litAngleScale, litAngleOffset);\n }\n }\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(cc_lightPos[i].w) && cc_lightSizeRangeAngle[i].w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n finalColor += SNL * cc_lightColor[i].rgb * shadow * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n layout(std430, set = 1, binding = 7) readonly buffer b_ccLightsBuffer { vec4 b_ccLights[]; };\n layout(std430, set = 1, binding = 8) readonly buffer b_clusterLightIndicesBuffer { uint b_clusterLightIndices[]; };\n layout(std430, set = 1, binding = 9) readonly buffer b_clusterLightGridBuffer { uvec4 b_clusterLightGrid[]; };\n struct CCLight\n {\n vec4 cc_lightPos;\n vec4 cc_lightColor;\n vec4 cc_lightSizeRangeAngle;\n vec4 cc_lightDir;\n vec4 cc_lightBoundingSizeVS;\n };\n struct Cluster\n {\n vec3 minBounds;\n vec3 maxBounds;\n };\n struct LightGrid\n {\n uint offset;\n uint ccLights;\n };\n CCLight getCCLight(uint i)\n {\n CCLight light;\n light.cc_lightPos = b_ccLights[5u * i + 0u];\n light.cc_lightColor = b_ccLights[5u * i + 1u];\n light.cc_lightSizeRangeAngle = b_ccLights[5u * i + 2u];\n light.cc_lightDir = b_ccLights[5u * i + 3u];\n light.cc_lightBoundingSizeVS = b_ccLights[5u * i + 4u];\n return light;\n }\n LightGrid getLightGrid(uint cluster)\n {\n uvec4 gridvec = b_clusterLightGrid[cluster];\n LightGrid grid;\n grid.offset = gridvec.x;\n grid.ccLights = gridvec.y;\n return grid;\n }\n uint getGridLightIndex(uint start, uint offset)\n {\n return b_clusterLightIndices[start + offset];\n }\n uint getClusterZIndex(vec4 worldPos)\n {\n float scale = float(24u) / log(cc_nearFar.y / cc_nearFar.x);\n float bias = -(float(24u) * log(cc_nearFar.x) / log(cc_nearFar.y / cc_nearFar.x));\n float eyeDepth = -(cc_matView * worldPos).z;\n uint zIndex = uint(max(log(eyeDepth) * scale + bias, 0.0));\n return zIndex;\n }\n uint getClusterIndex(vec4 fragCoord, vec4 worldPos)\n {\n uint zIndex = getClusterZIndex(worldPos);\n float clusterSizeX = ceil(cc_viewPort.z / float(16u));\n float clusterSizeY = ceil(cc_viewPort.w / float(8u));\n uvec3 indices = uvec3(uvec2(fragCoord.xy / vec2(clusterSizeX, clusterSizeY)), zIndex);\n uint cluster = (16u * 8u) * indices.z + 16u * indices.y + indices.x;\n return cluster;\n }\n vec4 CCClusterShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n uint cluster = getClusterIndex(gl_FragCoord, vec4(position, 1.0));\n LightGrid grid = getLightGrid(cluster);\n uint numLights = grid.ccLights;\n for (uint i = 0u; i < 200u; i++) {\n if (i >= numLights) break;\n uint lightIndex = getGridLightIndex(grid.offset, i);\n CCLight light = getCCLight(lightIndex);\n vec3 SLU = light.cc_lightPos.xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.001);\n float SNH = max(dot(N, SH), 0.0);\n float distSqr = dot(SLU, SLU);\n float litRadius = light.cc_lightSizeRangeAngle.x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = PI * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(light.cc_lightSizeRangeAngle.y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (IS_SPOT_LIGHT(light.cc_lightPos.w)) {\n float cosInner = max(dot(-light.cc_lightDir.xyz, SL), 0.01);\n float cosOuter = light.cc_lightSizeRangeAngle.z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -light.cc_lightDir.xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = light.cc_lightColor.rgb;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(light.cc_lightPos.w) && light.cc_lightSizeRangeAngle.w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n lightColor *= shadow;\n finalColor += SNL * lightColor * light.cc_lightColor.w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n vec4 color = CCClusterShadingAdditive(s, v_shadowPos);\n #else\n vec4 color = CCStandardShadingAdditive(s, v_shadowPos);\n #endif\n fragColorX = CCFragOutput(color);\n }\n#elif (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingBase(s, v_shadowPos);\n #if CC_USE_FOG != 4\n #if CC_USE_FLOAT_OUTPUT\n CC_APPLY_FOG(color, s.position.xyz);\n #elif !CC_FORWARD_ADD\n CC_APPLY_FOG(color, s.position.xyz);\n #endif\n #endif\n fragColorX = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 1\n vec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n }\n vec2 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 layout(location = 0) out vec4 albedoOut;\n layout(location = 1) out vec4 emissiveOut;\n layout(location = 2) out vec4 normalOut;\n void main () {\n StandardSurface s; surf(s);\n albedoOut = s.albedo;\n normalOut = vec4(float32x3_to_oct(s.normal), s.roughness, s.metallic);\n emissiveOut = vec4(s.emissive, s.occlusion);\n }\n#endif"
  2411. },
  2412. "glsl3": {
  2413. "vert": "\nprecision highp float;\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\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\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_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\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 int getVertexId() {\n return int(a_vertexId);\n }\n#endif\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 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\nvoid CCVertInput(inout StandardVertInput In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\n}\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#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}\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\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}\n#if !CC_USE_ACCURATE_FOG\nout mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\nout highp vec4 v_shadowPos;\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\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_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_RECEIVE_SHADOW\nvec2 CCGetShadowBias()\n{\n #if USE_INSTANCING\n return vec2(a_localShadowBiasAndProbeId.x + cc_shadowWHPBInfo.w, a_localShadowBiasAndProbeId.y + cc_shadowLPNNInfo.z);\n #else\n return vec2(cc_localShadowBias.x + cc_shadowWHPBInfo.w, cc_localShadowBias.y + cc_shadowLPNNInfo.z);\n #endif\n}\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\nvoid CC_TRANSFER_SH() {\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}\n#if USE_VERTEX_COLOR\n in vec4 a_color;\n out lowp vec4 v_color;\n#endif\nout vec3 v_position;\nout vec3 v_normal;\nout vec2 v_uv;\n#if HAS_SECOND_UV\n out mediump vec2 v_uv1;\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 USE_NORMAL_MAP\n out mediump vec4 v_tangent;\n#endif\n#if HAS_SECOND_UV || CC_USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n out vec3 v_luv;\n void CCLightingMapCaclUV()\n {\n #if !USE_INSTANCING\n v_luv.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n v_luv.z = cc_lightingMapUVParam.w;\n #else\n v_luv.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n v_luv.z = a_lightingMapUVParam.w;\n #endif\n }\n#endif\nvoid main () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec4 pos = matWorld * In.position;\n v_position = pos.xyz;\n v_normal = normalize((matWorldIT * vec4(In.normal, 0.0)).xyz);\n #if CC_RECEIVE_SHADOW\n v_shadowBiasAndProbeId.xy = CCGetShadowBias();\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n v_shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n v_shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n #if USE_TWOSIDE\n vec3 viewDirect = normalize(cc_cameraPos.xyz - v_position);\n v_normal *= dot(v_normal, viewDirect) < 0.0 ? -1.0 : 1.0;\n #endif\n #if USE_NORMAL_MAP\n v_tangent.xyz = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n v_tangent.w = In.tangent.w;\n #endif\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv1 = cc_cameraPos.w > 1.0 ? vec2(v_uv1.x, 1.0 - v_uv1.y) : v_uv1;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n CC_TRANSFER_FOG(pos);\n v_shadowPos = cc_matLightViewProj * pos;\n CC_TRANSFER_SH();\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n CCLightingMapCaclUV();\n #endif\n gl_Position = cc_matProj * (cc_matView * matWorld) * In.position;\n}",
  2414. "frag": "\nprecision highp float;\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 Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\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_ACCURATE_FOG\nin mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\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\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}\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\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\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\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 #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n highp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\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\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}\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 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nuniform samplerCube cc_environment;\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\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 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 vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHT_PROBE\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 #else\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 #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\n#endif\nfloat GGXMobile (float roughness, float NoH, vec3 H, vec3 N) {\n vec3 NxH = cross(N, H);\n float OneMinusNoHSqr = dot(NxH, NxH);\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n}\nfloat CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n}\nvec3 BRDFApprox (vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n return max(vec3(0.0), specular * AB.x + AB.y);\n}\n#if USE_REFLECTION_DENOISE\n vec3 GetEnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity, vec2 screenUV) {\n #if CC_USE_IBL\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n vec4 biased = fragTextureLod(cc_reflectionProbeCubemap, R, mip + mipBias);\n \t vec4 filtered = texture(cc_reflectionProbeCubemap, R);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec4 biased = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mip + mipBias);\n vec4 filtered = texture(cc_reflectionProbePlanarMap, screenUV);\n #else\n vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);\n \t vec4 filtered = texture(cc_environment, R);\n #endif\n #if CC_USE_IBL == 2 || CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_NONE\n biased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n#endif\nstruct StandardSurface {\n vec4 albedo;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 emissive;\n vec4 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n float specularIntensity;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n float reflectionProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n float reflectionProbeBlendId;\n float reflectionProbeBlendFactor;\n #endif\n};\n vec3 SampleReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n if (isRGBE)\n return unpackRGBE(envmap);\n else\n return SRGBToLinear(envmap.rgb);\n }\nvec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.08 * s.specularIntensity), s.albedo.rgb, s.metallic);\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = max(dot(N, L), 0.0);\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (NL > 0.0 && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n vec3 finalColor = vec3(0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmap = s.lightmap.rgb;\n #if CC_USE_HDR\n lightmap.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n #if CC_USE_LIGHTMAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n shadow *= s.lightmap.a;\n finalColor += diffuse * lightmap.rgb;\n #else\n finalColor += diffuse * lightmap.rgb * shadow;\n #endif\n s.occlusion *= s.lightmap_test;\n #endif\n #if !CC_DISABLE_DIRECTIONAL_LIGHT\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n vec3 lightingColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse / PI;\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n vec3 dirlightContrib = (diffuseContrib + specularContrib);\n dirlightContrib *= shadow;\n finalColor += lightingColor * dirlightContrib;\n #endif\n float fAmb = max(EPSILON, 0.5 - N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n vec3 env = vec3(0.0), rotationDir;\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n rotationDir = RotationVecFromAxisY(N.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = texture(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #if !CC_USE_REFLECTION_PROBE\n vec3 R = normalize(reflect(-V, N));\n rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n env = GetEnvReflectionWithMipFiltering(rotationDir, s.roughness, cc_ambientGround.w, 0.6, vec2(0.0));\n #else\n vec4 envmap = fragTextureLod(cc_environment, rotationDir, s.roughness * (cc_ambientGround.w - 1.0));\n #if CC_USE_IBL == 2\n env = unpackRGBE(envmap);\n #else\n env = SRGBToLinear(envmap.rgb);\n #endif\n #endif\n #endif\n #endif\n float lightIntensity = cc_ambientSky.w;\n #if CC_USE_REFLECTION_PROBE\n vec4 probe = vec4(0.0);\n vec3 R = normalize(reflect(-V, N));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(s.reflectionProbeId < 0.0){\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, position, centerPos, boxHalfSize);\n env = mix(SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity,\n SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId)), fixedR.w);\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n if(s.reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(s.position, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0);\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, s.reflectionProbeId);\n R = normalize(CalculateReflectDirection(N, V, max(abs(dot(N, V)), 0.0)));\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(N, V, s.position, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount);\n }\n env = unpackRGBE(probe);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if (s.reflectionProbeId < 0.0) {\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n } else {\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, s.position, centerPos, boxHalfSize);\n env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));\n if (s.reflectionProbeBlendId < 0.0) {\n vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);\n #else\n env = mix(skyBoxEnv, env, fixedR.w);\n #endif\n } else {\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, s.reflectionProbeBlendId);\n vec4 fixedRBlend = CalculateBoxProjectedDirection(R, s.position, centerPosBlend, boxHalfSizeBlend);\n vec3 probe1 = SampleReflectionProbe(cc_reflectionProbeBlendCubemap, fixedRBlend.xyz, s.roughness, mipCountBlend, isBlendReflectProbeUsingRGBE(s.reflectionProbeBlendId));\n env = mix(env, probe1, s.reflectionProbeBlendFactor);\n }\n }\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = s.reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n finalColor += env * lightIntensity * specular * s.occlusion;\n#if CC_USE_LIGHT_PROBE\n finalColor += SHEvaluate(N) * diffuse * s.occlusion;\n#endif\n finalColor += ambDiff.rgb * cc_ambientSky.w * diffuse * s.occlusion;\n finalColor += s.emissive;\n return vec4(finalColor, s.albedo.a);\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}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nin highp vec4 v_shadowPos;\n#if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n in vec3 v_luv;\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#endif\nin vec3 v_position;\nin vec2 v_uv;\n#if HAS_SECOND_UV\n in mediump vec2 v_uv1;\n#endif\nin vec3 v_normal;\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 USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n in mediump vec4 v_tangent;\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_METALLIC_ROUGHNESS_MAP\n uniform sampler2D metallicRoughnessMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvoid surf (out StandardSurface s) {\n vec4 baseColor = albedo;\n #if USE_VERTEX_COLOR\n baseColor.rgb *= SRGBToLinear(v_color.rgb);\n baseColor.a *= v_color.a;\n #endif\n #if USE_ALBEDO_MAP\n vec4 texColor = texture(albedoMap, ALBEDO_UV);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n baseColor *= texColor;\n #endif\n s.albedo = baseColor;\n s.albedo.rgb *= albedoScaleAndCutoff.xyz;\n #if USE_ALPHA_TEST\n if (s.albedo.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n s.normal = v_normal;\n #if CC_RECEIVE_SHADOW\n s.shadowBias = v_shadowBiasAndProbeId.xy;\n #endif\n #if CC_USE_REFLECTION_PROBE\n s.reflectionProbeId = v_shadowBiasAndProbeId.z;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n s.reflectionProbeBlendId = v_shadowBiasAndProbeId.w;\n #if USE_INSTANCING\n s.reflectionProbeBlendFactor = v_reflectionProbeData.x;\n #else\n s.reflectionProbeBlendFactor = cc_reflectionProbeBlendData1.w;\n #endif\n #endif\n #if USE_NORMAL_MAP\n vec3 nmmp = texture(normalMap, NORMAL_UV).xyz - vec3(0.5);\n vec3 bitangent = cross(v_normal, v_tangent.xyz) * (v_tangent.w > 0.0 ? 1.0 : -1.0);\n s.normal =\n (nmmp.x * emissiveScaleParam.w) * normalize(v_tangent.xyz) +\n (nmmp.y * emissiveScaleParam.w) * normalize(bitangent) +\n nmmp.z * normalize(s.normal);\n #endif\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n SampleAndDecodeLightMapColor(s.lightmap.rgb, s.lightmap.a, s.lightmap_test, cc_lightingMap, v_luv.xy, v_luv.z, s.normal);\n #endif\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(s.position, s.position_fract_part, v_position);\n #else\n s.position = v_position;\n #endif\n vec4 pbr = pbrParams;\n pbr.x = 1.0;\n #if USE_PBR_MAP\n vec4 res = texture(pbrMap, PBR_UV);\n pbr.x = mix(1.0, res.r, pbrParams.x);\n pbr.y *= res.g;\n pbr.z *= res.b;\n pbr.w *= res.a;\n #endif\n #if USE_METALLIC_ROUGHNESS_MAP\n vec4 metallicRoughness = texture(metallicRoughnessMap, PBR_UV);\n pbr.z *= metallicRoughness.b;\n pbr.y *= metallicRoughness.g;\n #endif\n #if USE_OCCLUSION_MAP\n pbr.x = mix(1.0, texture(occlusionMap, PBR_UV).r, pbrParams.x);\n #endif\n s.occlusion = pbr.x;\n s.roughness = pbr.y;\n s.metallic = pbr.z;\n s.specularIntensity = pbr.w;\n s.emissive = emissive.rgb;\n #if USE_EMISSIVE_MAP\n s.emissive = SRGBToLinear(texture(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n s.emissive *= emissiveScaleParam.xyz;\n}\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 float 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 }\n float 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 }\n float 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 }\n float 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 }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\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 SLU = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.0);\n float SNH = max(dot(N, SH), 0.0);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n float cosInner = max(dot(-cc_lightDir[i].xyz, SL), 0.01);\n float cosOuter = cc_lightSizeRangeAngle[i].z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -cc_lightDir[i].xyz, litAngleScale, litAngleOffset);\n }\n }\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(cc_lightPos[i].w) && cc_lightSizeRangeAngle[i].w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n finalColor += SNL * cc_lightColor[i].rgb * shadow * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n layout(std430, binding = 0) readonly buffer b_ccLightsBuffer { vec4 b_ccLights[]; };\n layout(std430, binding = 1) readonly buffer b_clusterLightIndicesBuffer { uint b_clusterLightIndices[]; };\n layout(std430, binding = 2) readonly buffer b_clusterLightGridBuffer { uvec4 b_clusterLightGrid[]; };\n struct CCLight\n {\n vec4 cc_lightPos;\n vec4 cc_lightColor;\n vec4 cc_lightSizeRangeAngle;\n vec4 cc_lightDir;\n vec4 cc_lightBoundingSizeVS;\n };\n struct Cluster\n {\n vec3 minBounds;\n vec3 maxBounds;\n };\n struct LightGrid\n {\n uint offset;\n uint ccLights;\n };\n CCLight getCCLight(uint i)\n {\n CCLight light;\n light.cc_lightPos = b_ccLights[5u * i + 0u];\n light.cc_lightColor = b_ccLights[5u * i + 1u];\n light.cc_lightSizeRangeAngle = b_ccLights[5u * i + 2u];\n light.cc_lightDir = b_ccLights[5u * i + 3u];\n light.cc_lightBoundingSizeVS = b_ccLights[5u * i + 4u];\n return light;\n }\n LightGrid getLightGrid(uint cluster)\n {\n uvec4 gridvec = b_clusterLightGrid[cluster];\n LightGrid grid;\n grid.offset = gridvec.x;\n grid.ccLights = gridvec.y;\n return grid;\n }\n uint getGridLightIndex(uint start, uint offset)\n {\n return b_clusterLightIndices[start + offset];\n }\n uint getClusterZIndex(vec4 worldPos)\n {\n float scale = float(24u) / log(cc_nearFar.y / cc_nearFar.x);\n float bias = -(float(24u) * log(cc_nearFar.x) / log(cc_nearFar.y / cc_nearFar.x));\n float eyeDepth = -(cc_matView * worldPos).z;\n uint zIndex = uint(max(log(eyeDepth) * scale + bias, 0.0));\n return zIndex;\n }\n uint getClusterIndex(vec4 fragCoord, vec4 worldPos)\n {\n uint zIndex = getClusterZIndex(worldPos);\n float clusterSizeX = ceil(cc_viewPort.z / float(16u));\n float clusterSizeY = ceil(cc_viewPort.w / float(8u));\n uvec3 indices = uvec3(uvec2(fragCoord.xy / vec2(clusterSizeX, clusterSizeY)), zIndex);\n uint cluster = (16u * 8u) * indices.z + 16u * indices.y + indices.x;\n return cluster;\n }\n vec4 CCClusterShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n uint cluster = getClusterIndex(gl_FragCoord, vec4(position, 1.0));\n LightGrid grid = getLightGrid(cluster);\n uint numLights = grid.ccLights;\n for (uint i = 0u; i < 200u; i++) {\n if (i >= numLights) break;\n uint lightIndex = getGridLightIndex(grid.offset, i);\n CCLight light = getCCLight(lightIndex);\n vec3 SLU = light.cc_lightPos.xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.001);\n float SNH = max(dot(N, SH), 0.0);\n float distSqr = dot(SLU, SLU);\n float litRadius = light.cc_lightSizeRangeAngle.x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = PI * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(light.cc_lightSizeRangeAngle.y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (IS_SPOT_LIGHT(light.cc_lightPos.w)) {\n float cosInner = max(dot(-light.cc_lightDir.xyz, SL), 0.01);\n float cosOuter = light.cc_lightSizeRangeAngle.z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -light.cc_lightDir.xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = light.cc_lightColor.rgb;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(light.cc_lightPos.w) && light.cc_lightSizeRangeAngle.w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n lightColor *= shadow;\n finalColor += SNL * lightColor * light.cc_lightColor.w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n vec4 color = CCClusterShadingAdditive(s, v_shadowPos);\n #else\n vec4 color = CCStandardShadingAdditive(s, v_shadowPos);\n #endif\n fragColorX = CCFragOutput(color);\n }\n#elif (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingBase(s, v_shadowPos);\n #if CC_USE_FOG != 4\n #if CC_USE_FLOAT_OUTPUT\n CC_APPLY_FOG(color, s.position.xyz);\n #elif !CC_FORWARD_ADD\n CC_APPLY_FOG(color, s.position.xyz);\n #endif\n #endif\n fragColorX = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 1\n vec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n }\n vec2 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 layout(location = 0) out vec4 albedoOut;\n layout(location = 1) out vec4 emissiveOut;\n layout(location = 2) out vec4 normalOut;\n void main () {\n StandardSurface s; surf(s);\n albedoOut = s.albedo;\n normalOut = vec4(float32x3_to_oct(s.normal), s.roughness, s.metallic);\n emissiveOut = vec4(s.emissive, s.occlusion);\n }\n#endif"
  2415. },
  2416. "glsl1": {
  2417. "vert": "\nprecision highp float;\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\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\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_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\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 int getVertexId() {\n return int(a_vertexId);\n }\n#endif\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 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\nvoid CCVertInput(inout StandardVertInput In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\n}\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#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 uniform vec4 tilingOffset;\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}\n#if !CC_USE_ACCURATE_FOG\nvarying mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\nvarying highp vec4 v_shadowPos;\nuniform highp mat4 cc_matLightViewProj;\n uniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_shadowLPNNInfo;\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n #endif\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_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_RECEIVE_SHADOW\nvec2 CCGetShadowBias()\n{\n #if USE_INSTANCING\n return vec2(a_localShadowBiasAndProbeId.x + cc_shadowWHPBInfo.w, a_localShadowBiasAndProbeId.y + cc_shadowLPNNInfo.z);\n #else\n return vec2(cc_localShadowBias.x + cc_shadowWHPBInfo.w, cc_localShadowBias.y + cc_shadowLPNNInfo.z);\n #endif\n}\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\nvoid CC_TRANSFER_SH() {\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}\n#if USE_VERTEX_COLOR\n attribute vec4 a_color;\n varying lowp vec4 v_color;\n#endif\nvarying vec3 v_position;\nvarying vec3 v_normal;\nvarying vec2 v_uv;\n#if HAS_SECOND_UV\n varying mediump vec2 v_uv1;\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 USE_NORMAL_MAP\n varying mediump vec4 v_tangent;\n#endif\n#if HAS_SECOND_UV || CC_USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying vec3 v_luv;\n void CCLightingMapCaclUV()\n {\n #if !USE_INSTANCING\n v_luv.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n v_luv.z = cc_lightingMapUVParam.w;\n #else\n v_luv.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n v_luv.z = a_lightingMapUVParam.w;\n #endif\n }\n#endif\nvoid main () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec4 pos = matWorld * In.position;\n v_position = pos.xyz;\n v_normal = normalize((matWorldIT * vec4(In.normal, 0.0)).xyz);\n #if CC_RECEIVE_SHADOW\n v_shadowBiasAndProbeId.xy = CCGetShadowBias();\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n v_shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n v_shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n #if USE_TWOSIDE\n vec3 viewDirect = normalize(cc_cameraPos.xyz - v_position);\n v_normal *= dot(v_normal, viewDirect) < 0.0 ? -1.0 : 1.0;\n #endif\n #if USE_NORMAL_MAP\n v_tangent.xyz = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n v_tangent.w = In.tangent.w;\n #endif\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv1 = cc_cameraPos.w > 1.0 ? vec2(v_uv1.x, 1.0 - v_uv1.y) : v_uv1;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n CC_TRANSFER_FOG(pos);\n v_shadowPos = cc_matLightViewProj * pos;\n CC_TRANSFER_SH();\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n CCLightingMapCaclUV();\n #endif\n gl_Position = cc_matProj * (cc_matView * matWorld) * In.position;\n}",
  2418. "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;\nuniform mediump vec4 cc_probeInfo;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewProj;\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_ambientGround;\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 uniform mediump vec4 cc_viewPort;\n uniform vec4 albedo;\n uniform vec4 albedoScaleAndCutoff;\n uniform vec4 pbrParams;\n uniform vec4 emissive;\n uniform vec4 emissiveScaleParam;\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_ACCURATE_FOG\nvarying mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\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\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}\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\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\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\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 #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n highp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void 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 }\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\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}\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 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return texture2DLodEXT(tex, coord, lod);\n #else\n return texture2D(tex, coord, lod);\n #endif\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return textureCubeLodEXT(tex, coord, lod);\n #else\n return textureCube(tex, coord, lod);\n #endif\n}\nuniform samplerCube cc_environment;\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\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 uniform highp vec4 cc_reflectionProbeData1;\n uniform highp vec4 cc_reflectionProbeData2;\n uniform highp vec4 cc_reflectionProbeBlendData1;\n uniform highp vec4 cc_reflectionProbeBlendData2;\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture2D(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHT_PROBE\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 #else\n uniform vec4 cc_sh_linear_const_r;\n uniform vec4 cc_sh_linear_const_g;\n uniform vec4 cc_sh_linear_const_b;\n uniform vec4 cc_sh_quadratic_r;\n uniform vec4 cc_sh_quadratic_g;\n uniform vec4 cc_sh_quadratic_b;\n uniform vec4 cc_sh_quadratic_a;\n #endif\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\n#endif\nfloat GGXMobile (float roughness, float NoH, vec3 H, vec3 N) {\n vec3 NxH = cross(N, H);\n float OneMinusNoHSqr = dot(NxH, NxH);\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n}\nfloat CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n}\nvec3 BRDFApprox (vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n return max(vec3(0.0), specular * AB.x + AB.y);\n}\n#if USE_REFLECTION_DENOISE\n vec3 GetEnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity, vec2 screenUV) {\n #if CC_USE_IBL\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n vec4 biased = fragTextureLod(cc_reflectionProbeCubemap, R, mip + mipBias);\n \t vec4 filtered = textureCube(cc_reflectionProbeCubemap, R);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec4 biased = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mip + mipBias);\n vec4 filtered = texture2D(cc_reflectionProbePlanarMap, screenUV);\n #else\n vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);\n \t vec4 filtered = textureCube(cc_environment, R);\n #endif\n #if CC_USE_IBL == 2 || CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_NONE\n biased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n#endif\nstruct StandardSurface {\n vec4 albedo;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 emissive;\n vec4 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n float specularIntensity;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n float reflectionProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n float reflectionProbeBlendId;\n float reflectionProbeBlendFactor;\n #endif\n};\n vec3 SampleReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n if (isRGBE)\n return unpackRGBE(envmap);\n else\n return SRGBToLinear(envmap.rgb);\n }\nvec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.08 * s.specularIntensity), s.albedo.rgb, s.metallic);\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = max(dot(N, L), 0.0);\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (NL > 0.0 && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n vec3 finalColor = vec3(0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmap = s.lightmap.rgb;\n #if CC_USE_HDR\n lightmap.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n #if CC_USE_LIGHTMAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n shadow *= s.lightmap.a;\n finalColor += diffuse * lightmap.rgb;\n #else\n finalColor += diffuse * lightmap.rgb * shadow;\n #endif\n s.occlusion *= s.lightmap_test;\n #endif\n #if !CC_DISABLE_DIRECTIONAL_LIGHT\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n vec3 lightingColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse / PI;\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n vec3 dirlightContrib = (diffuseContrib + specularContrib);\n dirlightContrib *= shadow;\n finalColor += lightingColor * dirlightContrib;\n #endif\n float fAmb = max(EPSILON, 0.5 - N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n vec3 env = vec3(0.0), rotationDir;\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n rotationDir = RotationVecFromAxisY(N.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = textureCube(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #if !CC_USE_REFLECTION_PROBE\n vec3 R = normalize(reflect(-V, N));\n rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n env = GetEnvReflectionWithMipFiltering(rotationDir, s.roughness, cc_ambientGround.w, 0.6, vec2(0.0));\n #else\n vec4 envmap = fragTextureLod(cc_environment, rotationDir, s.roughness * (cc_ambientGround.w - 1.0));\n #if CC_USE_IBL == 2\n env = unpackRGBE(envmap);\n #else\n env = SRGBToLinear(envmap.rgb);\n #endif\n #endif\n #endif\n #endif\n float lightIntensity = cc_ambientSky.w;\n #if CC_USE_REFLECTION_PROBE\n vec4 probe = vec4(0.0);\n vec3 R = normalize(reflect(-V, N));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(s.reflectionProbeId < 0.0){\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, position, centerPos, boxHalfSize);\n env = mix(SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity,\n SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId)), fixedR.w);\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n if(s.reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(s.position, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0);\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, s.reflectionProbeId);\n R = normalize(CalculateReflectDirection(N, V, max(abs(dot(N, V)), 0.0)));\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(N, V, s.position, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount);\n }\n env = unpackRGBE(probe);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if (s.reflectionProbeId < 0.0) {\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n } else {\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, s.position, centerPos, boxHalfSize);\n env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));\n if (s.reflectionProbeBlendId < 0.0) {\n vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);\n #else\n env = mix(skyBoxEnv, env, fixedR.w);\n #endif\n } else {\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, s.reflectionProbeBlendId);\n vec4 fixedRBlend = CalculateBoxProjectedDirection(R, s.position, centerPosBlend, boxHalfSizeBlend);\n vec3 probe1 = SampleReflectionProbe(cc_reflectionProbeBlendCubemap, fixedRBlend.xyz, s.roughness, mipCountBlend, isBlendReflectProbeUsingRGBE(s.reflectionProbeBlendId));\n env = mix(env, probe1, s.reflectionProbeBlendFactor);\n }\n }\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = s.reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n finalColor += env * lightIntensity * specular * s.occlusion;\n#if CC_USE_LIGHT_PROBE\n finalColor += SHEvaluate(N) * diffuse * s.occlusion;\n#endif\n finalColor += ambDiff.rgb * cc_ambientSky.w * diffuse * s.occlusion;\n finalColor += s.emissive;\n return vec4(finalColor, s.albedo.a);\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}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nvarying highp vec4 v_shadowPos;\n#if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying vec3 v_luv;\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#endif\nvarying vec3 v_position;\nvarying vec2 v_uv;\n#if HAS_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\nvarying vec3 v_normal;\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 USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n varying mediump vec4 v_tangent;\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_METALLIC_ROUGHNESS_MAP\n uniform sampler2D metallicRoughnessMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvoid surf (out StandardSurface s) {\n vec4 baseColor = albedo;\n #if USE_VERTEX_COLOR\n baseColor.rgb *= SRGBToLinear(v_color.rgb);\n baseColor.a *= v_color.a;\n #endif\n #if USE_ALBEDO_MAP\n vec4 texColor = texture2D(albedoMap, ALBEDO_UV);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n baseColor *= texColor;\n #endif\n s.albedo = baseColor;\n s.albedo.rgb *= albedoScaleAndCutoff.xyz;\n #if USE_ALPHA_TEST\n if (s.albedo.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n s.normal = v_normal;\n #if CC_RECEIVE_SHADOW\n s.shadowBias = v_shadowBiasAndProbeId.xy;\n #endif\n #if CC_USE_REFLECTION_PROBE\n s.reflectionProbeId = v_shadowBiasAndProbeId.z;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n s.reflectionProbeBlendId = v_shadowBiasAndProbeId.w;\n #if USE_INSTANCING\n s.reflectionProbeBlendFactor = v_reflectionProbeData.x;\n #else\n s.reflectionProbeBlendFactor = cc_reflectionProbeBlendData1.w;\n #endif\n #endif\n #if USE_NORMAL_MAP\n vec3 nmmp = texture2D(normalMap, NORMAL_UV).xyz - vec3(0.5);\n vec3 bitangent = cross(v_normal, v_tangent.xyz) * (v_tangent.w > 0.0 ? 1.0 : -1.0);\n s.normal =\n (nmmp.x * emissiveScaleParam.w) * normalize(v_tangent.xyz) +\n (nmmp.y * emissiveScaleParam.w) * normalize(bitangent) +\n nmmp.z * normalize(s.normal);\n #endif\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n SampleAndDecodeLightMapColor(s.lightmap.rgb, s.lightmap.a, s.lightmap_test, cc_lightingMap, v_luv.xy, v_luv.z, s.normal);\n #endif\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(s.position, s.position_fract_part, v_position);\n #else\n s.position = v_position;\n #endif\n vec4 pbr = pbrParams;\n pbr.x = 1.0;\n #if USE_PBR_MAP\n vec4 res = texture2D(pbrMap, PBR_UV);\n pbr.x = mix(1.0, res.r, pbrParams.x);\n pbr.y *= res.g;\n pbr.z *= res.b;\n pbr.w *= res.a;\n #endif\n #if USE_METALLIC_ROUGHNESS_MAP\n vec4 metallicRoughness = texture2D(metallicRoughnessMap, PBR_UV);\n pbr.z *= metallicRoughness.b;\n pbr.y *= metallicRoughness.g;\n #endif\n #if USE_OCCLUSION_MAP\n pbr.x = mix(1.0, texture2D(occlusionMap, PBR_UV).r, pbrParams.x);\n #endif\n s.occlusion = pbr.x;\n s.roughness = pbr.y;\n s.metallic = pbr.z;\n s.specularIntensity = pbr.w;\n s.emissive = emissive.rgb;\n #if USE_EMISSIVE_MAP\n s.emissive = SRGBToLinear(texture2D(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n s.emissive *= emissiveScaleParam.xyz;\n}\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 float 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 }\n float 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 }\n float 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 }\n float 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 }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\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 SLU = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.0);\n float SNH = max(dot(N, SH), 0.0);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n float cosInner = max(dot(-cc_lightDir[i].xyz, SL), 0.01);\n float cosOuter = cc_lightSizeRangeAngle[i].z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -cc_lightDir[i].xyz, litAngleScale, litAngleOffset);\n }\n }\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(cc_lightPos[i].w) && cc_lightSizeRangeAngle[i].w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n finalColor += SNL * cc_lightColor[i].rgb * shadow * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n readonly buffer b_ccLightsBuffer { vec4 b_ccLights[]; };\n readonly buffer b_clusterLightIndicesBuffer { uint b_clusterLightIndices[]; };\n readonly buffer b_clusterLightGridBuffer { uvec4 b_clusterLightGrid[]; };\n struct CCLight\n {\n vec4 cc_lightPos;\n vec4 cc_lightColor;\n vec4 cc_lightSizeRangeAngle;\n vec4 cc_lightDir;\n vec4 cc_lightBoundingSizeVS;\n };\n struct Cluster\n {\n vec3 minBounds;\n vec3 maxBounds;\n };\n struct LightGrid\n {\n uint offset;\n uint ccLights;\n };\n CCLight getCCLight(uint i)\n {\n CCLight light;\n light.cc_lightPos = b_ccLights[5u * i + 0u];\n light.cc_lightColor = b_ccLights[5u * i + 1u];\n light.cc_lightSizeRangeAngle = b_ccLights[5u * i + 2u];\n light.cc_lightDir = b_ccLights[5u * i + 3u];\n light.cc_lightBoundingSizeVS = b_ccLights[5u * i + 4u];\n return light;\n }\n LightGrid getLightGrid(uint cluster)\n {\n uvec4 gridvec = b_clusterLightGrid[cluster];\n LightGrid grid;\n grid.offset = gridvec.x;\n grid.ccLights = gridvec.y;\n return grid;\n }\n uint getGridLightIndex(uint start, uint offset)\n {\n return b_clusterLightIndices[start + offset];\n }\n uint getClusterZIndex(vec4 worldPos)\n {\n float scale = float(24u) / log(cc_nearFar.y / cc_nearFar.x);\n float bias = -(float(24u) * log(cc_nearFar.x) / log(cc_nearFar.y / cc_nearFar.x));\n float eyeDepth = -(cc_matView * worldPos).z;\n uint zIndex = uint(max(log(eyeDepth) * scale + bias, 0.0));\n return zIndex;\n }\n uint getClusterIndex(vec4 fragCoord, vec4 worldPos)\n {\n uint zIndex = getClusterZIndex(worldPos);\n float clusterSizeX = ceil(cc_viewPort.z / float(16u));\n float clusterSizeY = ceil(cc_viewPort.w / float(8u));\n uvec3 indices = uvec3(uvec2(fragCoord.xy / vec2(clusterSizeX, clusterSizeY)), zIndex);\n uint cluster = (16u * 8u) * indices.z + 16u * indices.y + indices.x;\n return cluster;\n }\n vec4 CCClusterShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n uint cluster = getClusterIndex(gl_FragCoord, vec4(position, 1.0));\n LightGrid grid = getLightGrid(cluster);\n uint numLights = grid.ccLights;\n for (uint i = 0u; i < 200u; i++) {\n if (i >= numLights) break;\n uint lightIndex = getGridLightIndex(grid.offset, i);\n CCLight light = getCCLight(lightIndex);\n vec3 SLU = light.cc_lightPos.xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.001);\n float SNH = max(dot(N, SH), 0.0);\n float distSqr = dot(SLU, SLU);\n float litRadius = light.cc_lightSizeRangeAngle.x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = PI * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(light.cc_lightSizeRangeAngle.y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (IS_SPOT_LIGHT(light.cc_lightPos.w)) {\n float cosInner = max(dot(-light.cc_lightDir.xyz, SL), 0.01);\n float cosOuter = light.cc_lightSizeRangeAngle.z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -light.cc_lightDir.xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = light.cc_lightColor.rgb;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(light.cc_lightPos.w) && light.cc_lightSizeRangeAngle.w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n lightColor *= shadow;\n finalColor += SNL * lightColor * light.cc_lightColor.w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n void main () {\n StandardSurface s; surf(s);\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n vec4 color = CCClusterShadingAdditive(s, v_shadowPos);\n #else\n vec4 color = CCStandardShadingAdditive(s, v_shadowPos);\n #endif\n gl_FragData[0] = CCFragOutput(color);\n }\n#elif (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingBase(s, v_shadowPos);\n #if CC_USE_FOG != 4\n #if CC_USE_FLOAT_OUTPUT\n CC_APPLY_FOG(color, s.position.xyz);\n #elif !CC_FORWARD_ADD\n CC_APPLY_FOG(color, s.position.xyz);\n #endif\n #endif\n gl_FragData[0] = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 1\n vec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n }\n vec2 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 void main () {\n StandardSurface s; surf(s);\n gl_FragData[0] = s.albedo;\n gl_FragData[2] = vec4(float32x3_to_oct(s.normal), s.roughness, s.metallic);\n gl_FragData[1] = vec4(s.emissive, s.occlusion);\n }\n#endif"
  2419. },
  2420. "builtins": {
  2421. "globals": {
  2422. "blocks": [
  2423. {
  2424. "name": "CCGlobal",
  2425. "defines": []
  2426. },
  2427. {
  2428. "name": "CCCamera",
  2429. "defines": []
  2430. },
  2431. {
  2432. "name": "CCShadow",
  2433. "defines": []
  2434. },
  2435. {
  2436. "name": "CCCSM",
  2437. "defines": [
  2438. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  2439. ]
  2440. }
  2441. ],
  2442. "samplerTextures": [
  2443. {
  2444. "name": "cc_shadowMap",
  2445. "defines": [
  2446. "CC_RECEIVE_SHADOW"
  2447. ]
  2448. },
  2449. {
  2450. "name": "cc_spotShadowMap",
  2451. "defines": [
  2452. "CC_RECEIVE_SHADOW"
  2453. ]
  2454. },
  2455. {
  2456. "name": "cc_environment",
  2457. "defines": []
  2458. },
  2459. {
  2460. "name": "cc_diffuseMap",
  2461. "defines": [
  2462. "CC_USE_IBL",
  2463. "CC_USE_DIFFUSEMAP"
  2464. ]
  2465. }
  2466. ],
  2467. "buffers": [],
  2468. "images": []
  2469. },
  2470. "locals": {
  2471. "blocks": [
  2472. {
  2473. "name": "CCMorph",
  2474. "defines": [
  2475. "CC_USE_MORPH"
  2476. ]
  2477. },
  2478. {
  2479. "name": "CCSkinningTexture",
  2480. "defines": [
  2481. "CC_USE_SKINNING",
  2482. "CC_USE_BAKED_ANIMATION"
  2483. ]
  2484. },
  2485. {
  2486. "name": "CCSkinningAnimation",
  2487. "defines": [
  2488. "CC_USE_SKINNING",
  2489. "CC_USE_BAKED_ANIMATION"
  2490. ]
  2491. },
  2492. {
  2493. "name": "CCSkinning",
  2494. "defines": [
  2495. "CC_USE_SKINNING",
  2496. "!CC_USE_BAKED_ANIMATION",
  2497. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  2498. ]
  2499. },
  2500. {
  2501. "name": "CCLocal",
  2502. "defines": [
  2503. "!USE_INSTANCING"
  2504. ]
  2505. },
  2506. {
  2507. "name": "CCSH",
  2508. "defines": [
  2509. "CC_USE_LIGHT_PROBE",
  2510. "!USE_INSTANCING"
  2511. ]
  2512. },
  2513. {
  2514. "name": "CCForwardLight",
  2515. "defines": [
  2516. "CC_FORWARD_ADD",
  2517. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  2518. ]
  2519. }
  2520. ],
  2521. "samplerTextures": [
  2522. {
  2523. "name": "cc_PositionDisplacements",
  2524. "defines": [
  2525. "CC_USE_MORPH",
  2526. "CC_MORPH_TARGET_HAS_POSITION"
  2527. ]
  2528. },
  2529. {
  2530. "name": "cc_NormalDisplacements",
  2531. "defines": [
  2532. "CC_USE_MORPH",
  2533. "CC_MORPH_TARGET_HAS_NORMAL"
  2534. ]
  2535. },
  2536. {
  2537. "name": "cc_TangentDisplacements",
  2538. "defines": [
  2539. "CC_USE_MORPH",
  2540. "CC_MORPH_TARGET_HAS_TANGENT"
  2541. ]
  2542. },
  2543. {
  2544. "name": "cc_jointTexture",
  2545. "defines": [
  2546. "CC_USE_SKINNING",
  2547. "CC_USE_BAKED_ANIMATION"
  2548. ]
  2549. },
  2550. {
  2551. "name": "cc_realtimeJoint",
  2552. "defines": [
  2553. "CC_USE_SKINNING",
  2554. "!CC_USE_BAKED_ANIMATION",
  2555. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  2556. ]
  2557. },
  2558. {
  2559. "name": "cc_reflectionProbeCubemap",
  2560. "defines": [
  2561. "CC_USE_REFLECTION_PROBE"
  2562. ]
  2563. },
  2564. {
  2565. "name": "cc_reflectionProbePlanarMap",
  2566. "defines": [
  2567. "CC_USE_REFLECTION_PROBE"
  2568. ]
  2569. },
  2570. {
  2571. "name": "cc_reflectionProbeDataMap",
  2572. "defines": [
  2573. "CC_USE_REFLECTION_PROBE"
  2574. ]
  2575. },
  2576. {
  2577. "name": "cc_reflectionProbeBlendCubemap",
  2578. "defines": [
  2579. "CC_USE_REFLECTION_PROBE"
  2580. ]
  2581. },
  2582. {
  2583. "name": "cc_lightingMap",
  2584. "defines": [
  2585. "CC_USE_LIGHTMAP",
  2586. "!CC_FORWARD_ADD"
  2587. ]
  2588. }
  2589. ],
  2590. "buffers": [],
  2591. "images": []
  2592. },
  2593. "statistics": {
  2594. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 137,
  2595. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 126
  2596. }
  2597. },
  2598. "defines": [
  2599. {
  2600. "name": "USE_INSTANCING",
  2601. "type": "boolean",
  2602. "defines": [],
  2603. "editor": {
  2604. "elevated": true
  2605. }
  2606. },
  2607. {
  2608. "name": "CC_USE_SKINNING",
  2609. "type": "boolean",
  2610. "defines": []
  2611. },
  2612. {
  2613. "name": "CC_USE_BAKED_ANIMATION",
  2614. "type": "boolean",
  2615. "defines": [
  2616. "USE_INSTANCING"
  2617. ]
  2618. },
  2619. {
  2620. "name": "CC_USE_LIGHTMAP",
  2621. "type": "number",
  2622. "defines": [],
  2623. "range": [
  2624. 0,
  2625. 3
  2626. ]
  2627. },
  2628. {
  2629. "name": "CC_USE_REFLECTION_PROBE",
  2630. "type": "number",
  2631. "defines": [],
  2632. "range": [
  2633. 0,
  2634. 3
  2635. ]
  2636. },
  2637. {
  2638. "name": "CC_RECEIVE_SHADOW",
  2639. "type": "boolean",
  2640. "defines": []
  2641. },
  2642. {
  2643. "name": "CC_USE_LIGHT_PROBE",
  2644. "type": "boolean",
  2645. "defines": [],
  2646. "default": 0
  2647. },
  2648. {
  2649. "name": "CC_USE_MORPH",
  2650. "type": "boolean",
  2651. "defines": []
  2652. },
  2653. {
  2654. "name": "CC_MORPH_TARGET_COUNT",
  2655. "type": "number",
  2656. "defines": [
  2657. "CC_USE_MORPH"
  2658. ],
  2659. "range": [
  2660. 2,
  2661. 8
  2662. ]
  2663. },
  2664. {
  2665. "name": "CC_MORPH_TARGET_HAS_POSITION",
  2666. "type": "boolean",
  2667. "defines": [
  2668. "CC_USE_MORPH"
  2669. ]
  2670. },
  2671. {
  2672. "name": "CC_MORPH_TARGET_HAS_NORMAL",
  2673. "type": "boolean",
  2674. "defines": [
  2675. "CC_USE_MORPH"
  2676. ]
  2677. },
  2678. {
  2679. "name": "CC_MORPH_TARGET_HAS_TANGENT",
  2680. "type": "boolean",
  2681. "defines": [
  2682. "CC_USE_MORPH"
  2683. ]
  2684. },
  2685. {
  2686. "name": "CC_MORPH_PRECOMPUTED",
  2687. "type": "boolean",
  2688. "defines": [
  2689. "CC_USE_MORPH"
  2690. ]
  2691. },
  2692. {
  2693. "name": "CC_USE_REAL_TIME_JOINT_TEXTURE",
  2694. "type": "boolean",
  2695. "defines": [
  2696. "CC_USE_SKINNING",
  2697. "!CC_USE_BAKED_ANIMATION"
  2698. ]
  2699. },
  2700. {
  2701. "name": "CC_USE_FOG",
  2702. "type": "number",
  2703. "defines": [],
  2704. "range": [
  2705. 0,
  2706. 4
  2707. ]
  2708. },
  2709. {
  2710. "name": "CC_USE_ACCURATE_FOG",
  2711. "type": "boolean",
  2712. "defines": []
  2713. },
  2714. {
  2715. "name": "CC_SUPPORT_CASCADED_SHADOW_MAP",
  2716. "type": "boolean",
  2717. "defines": []
  2718. },
  2719. {
  2720. "name": "USE_VERTEX_COLOR",
  2721. "type": "boolean",
  2722. "defines": []
  2723. },
  2724. {
  2725. "name": "HAS_SECOND_UV",
  2726. "type": "boolean",
  2727. "defines": []
  2728. },
  2729. {
  2730. "name": "USE_NORMAL_MAP",
  2731. "type": "boolean",
  2732. "defines": []
  2733. },
  2734. {
  2735. "name": "CC_FORWARD_ADD",
  2736. "type": "boolean",
  2737. "defines": []
  2738. },
  2739. {
  2740. "name": "USE_TWOSIDE",
  2741. "type": "boolean",
  2742. "defines": []
  2743. },
  2744. {
  2745. "name": "SAMPLE_FROM_RT",
  2746. "type": "boolean",
  2747. "defines": []
  2748. },
  2749. {
  2750. "name": "CC_USE_DEBUG_VIEW",
  2751. "type": "number",
  2752. "defines": [],
  2753. "range": [
  2754. 0,
  2755. 3
  2756. ]
  2757. },
  2758. {
  2759. "name": "CC_SURFACES_ENABLE_DEBUG_VIEW",
  2760. "type": "boolean",
  2761. "defines": [
  2762. "CC_USE_DEBUG_VIEW",
  2763. "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC"
  2764. ]
  2765. },
  2766. {
  2767. "name": "CC_SHADOWMAP_FORMAT",
  2768. "type": "number",
  2769. "defines": [
  2770. "CC_RECEIVE_SHADOW"
  2771. ],
  2772. "range": [
  2773. 0,
  2774. 3
  2775. ]
  2776. },
  2777. {
  2778. "name": "CC_SHADOWMAP_USE_LINEAR_DEPTH",
  2779. "type": "boolean",
  2780. "defines": [
  2781. "CC_RECEIVE_SHADOW"
  2782. ]
  2783. },
  2784. {
  2785. "name": "CC_DIR_SHADOW_PCF_TYPE",
  2786. "type": "number",
  2787. "defines": [
  2788. "CC_RECEIVE_SHADOW"
  2789. ],
  2790. "range": [
  2791. 0,
  2792. 3
  2793. ]
  2794. },
  2795. {
  2796. "name": "CC_CASCADED_LAYERS_TRANSITION",
  2797. "type": "boolean",
  2798. "defines": [
  2799. "CC_RECEIVE_SHADOW",
  2800. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  2801. ]
  2802. },
  2803. {
  2804. "name": "CC_USE_IBL",
  2805. "type": "number",
  2806. "defines": [],
  2807. "range": [
  2808. 0,
  2809. 2
  2810. ]
  2811. },
  2812. {
  2813. "name": "CC_USE_DIFFUSEMAP",
  2814. "type": "number",
  2815. "defines": [
  2816. "CC_USE_IBL"
  2817. ],
  2818. "range": [
  2819. 0,
  2820. 2
  2821. ]
  2822. },
  2823. {
  2824. "name": "CC_USE_HDR",
  2825. "type": "boolean",
  2826. "defines": [
  2827. "CC_USE_LIGHTMAP",
  2828. "!CC_FORWARD_ADD"
  2829. ]
  2830. },
  2831. {
  2832. "name": "USE_REFLECTION_DENOISE",
  2833. "type": "boolean",
  2834. "defines": []
  2835. },
  2836. {
  2837. "name": "CC_SHADOW_TYPE",
  2838. "type": "number",
  2839. "defines": [
  2840. "CC_RECEIVE_SHADOW"
  2841. ],
  2842. "range": [
  2843. 0,
  2844. 3
  2845. ]
  2846. },
  2847. {
  2848. "name": "CC_DIR_LIGHT_SHADOW_TYPE",
  2849. "type": "number",
  2850. "defines": [
  2851. "CC_RECEIVE_SHADOW",
  2852. "CC_SHADOW_TYPE"
  2853. ],
  2854. "range": [
  2855. 0,
  2856. 3
  2857. ]
  2858. },
  2859. {
  2860. "name": "CC_DISABLE_DIRECTIONAL_LIGHT",
  2861. "type": "boolean",
  2862. "defines": []
  2863. },
  2864. {
  2865. "name": "CC_IBL_CONVOLUTED",
  2866. "type": "boolean",
  2867. "defines": [
  2868. "USE_REFLECTION_DENOISE",
  2869. "CC_USE_IBL",
  2870. "!CC_USE_REFLECTION_PROBE"
  2871. ]
  2872. },
  2873. {
  2874. "name": "CC_USE_RGBE_OUTPUT",
  2875. "type": "boolean",
  2876. "defines": []
  2877. },
  2878. {
  2879. "name": "CC_USE_FLOAT_OUTPUT",
  2880. "type": "boolean",
  2881. "defines": [
  2882. "!CC_USE_RGBE_OUTPUT"
  2883. ]
  2884. },
  2885. {
  2886. "name": "CC_TONE_MAPPING_TYPE",
  2887. "type": "number",
  2888. "defines": [
  2889. "CC_USE_HDR",
  2890. "!CC_USE_RGBE_OUTPUT",
  2891. "!CC_USE_FLOAT_OUTPUT"
  2892. ],
  2893. "range": [
  2894. 0,
  2895. 3
  2896. ]
  2897. },
  2898. {
  2899. "name": "HDR_TONE_MAPPING_ACES",
  2900. "type": "boolean",
  2901. "defines": [
  2902. "CC_USE_HDR",
  2903. "CC_TONE_MAPPING_TYPE",
  2904. "!CC_USE_RGBE_OUTPUT",
  2905. "!CC_USE_FLOAT_OUTPUT"
  2906. ]
  2907. },
  2908. {
  2909. "name": "CC_LIGHT_MAP_VERSION",
  2910. "type": "number",
  2911. "defines": [
  2912. "CC_USE_LIGHTMAP",
  2913. "!CC_FORWARD_ADD"
  2914. ],
  2915. "range": [
  2916. 0,
  2917. 3
  2918. ]
  2919. },
  2920. {
  2921. "name": "USE_ALBEDO_MAP",
  2922. "type": "boolean",
  2923. "defines": []
  2924. },
  2925. {
  2926. "name": "ALBEDO_UV",
  2927. "type": "string",
  2928. "defines": [
  2929. "USE_ALBEDO_MAP"
  2930. ],
  2931. "options": [
  2932. "v_uv",
  2933. "v_uv1"
  2934. ]
  2935. },
  2936. {
  2937. "name": "NORMAL_UV",
  2938. "type": "string",
  2939. "defines": [
  2940. "USE_NORMAL_MAP"
  2941. ],
  2942. "options": [
  2943. "v_uv",
  2944. "v_uv1"
  2945. ]
  2946. },
  2947. {
  2948. "name": "PBR_UV",
  2949. "type": "string",
  2950. "defines": [],
  2951. "options": [
  2952. "v_uv",
  2953. "v_uv1"
  2954. ]
  2955. },
  2956. {
  2957. "name": "USE_PBR_MAP",
  2958. "type": "boolean",
  2959. "defines": []
  2960. },
  2961. {
  2962. "name": "USE_METALLIC_ROUGHNESS_MAP",
  2963. "type": "boolean",
  2964. "defines": []
  2965. },
  2966. {
  2967. "name": "USE_OCCLUSION_MAP",
  2968. "type": "boolean",
  2969. "defines": []
  2970. },
  2971. {
  2972. "name": "USE_EMISSIVE_MAP",
  2973. "type": "boolean",
  2974. "defines": []
  2975. },
  2976. {
  2977. "name": "EMISSIVE_UV",
  2978. "type": "string",
  2979. "defines": [
  2980. "USE_EMISSIVE_MAP"
  2981. ],
  2982. "options": [
  2983. "v_uv",
  2984. "v_uv1"
  2985. ]
  2986. },
  2987. {
  2988. "name": "USE_ALPHA_TEST",
  2989. "type": "boolean",
  2990. "defines": []
  2991. },
  2992. {
  2993. "name": "ALPHA_TEST_CHANNEL",
  2994. "type": "string",
  2995. "defines": [
  2996. "USE_ALPHA_TEST"
  2997. ],
  2998. "options": [
  2999. "a",
  3000. "r"
  3001. ]
  3002. },
  3003. {
  3004. "name": "CC_PIPELINE_TYPE",
  3005. "type": "number",
  3006. "defines": [
  3007. "CC_FORWARD_ADD"
  3008. ],
  3009. "range": [
  3010. 0,
  3011. 1
  3012. ]
  3013. },
  3014. {
  3015. "name": "CC_FORCE_FORWARD_SHADING",
  3016. "type": "boolean",
  3017. "defines": [
  3018. "CC_PIPELINE_TYPE",
  3019. "!CC_FORWARD_ADD"
  3020. ]
  3021. },
  3022. {
  3023. "name": "CC_ENABLE_CLUSTERED_LIGHT_CULLING",
  3024. "type": "number",
  3025. "defines": [
  3026. "CC_FORWARD_ADD"
  3027. ],
  3028. "range": [
  3029. 0,
  3030. 3
  3031. ]
  3032. }
  3033. ],
  3034. "name": "legacy/standard|standard-vs|standard-fs"
  3035. },
  3036. {
  3037. "blocks": [
  3038. {
  3039. "name": "Constants",
  3040. "members": [
  3041. {
  3042. "name": "tilingOffset",
  3043. "type": 16,
  3044. "count": 1
  3045. },
  3046. {
  3047. "name": "albedo",
  3048. "type": 16,
  3049. "count": 1
  3050. },
  3051. {
  3052. "name": "albedoScaleAndCutoff",
  3053. "type": 16,
  3054. "count": 1
  3055. },
  3056. {
  3057. "name": "pbrParams",
  3058. "type": 16,
  3059. "count": 1
  3060. },
  3061. {
  3062. "name": "emissive",
  3063. "type": 16,
  3064. "count": 1
  3065. },
  3066. {
  3067. "name": "emissiveScaleParam",
  3068. "type": 16,
  3069. "count": 1
  3070. }
  3071. ],
  3072. "defines": [],
  3073. "stageFlags": 17,
  3074. "binding": 0
  3075. }
  3076. ],
  3077. "samplerTextures": [
  3078. {
  3079. "name": "albedoMap",
  3080. "type": 28,
  3081. "count": 1,
  3082. "defines": [
  3083. "USE_ALBEDO_MAP"
  3084. ],
  3085. "stageFlags": 16,
  3086. "binding": 1
  3087. }
  3088. ],
  3089. "samplers": [],
  3090. "textures": [],
  3091. "buffers": [],
  3092. "images": [],
  3093. "subpassInputs": [],
  3094. "attributes": [
  3095. {
  3096. "name": "a_position",
  3097. "defines": [],
  3098. "format": 32,
  3099. "location": 0
  3100. },
  3101. {
  3102. "name": "a_normal",
  3103. "defines": [],
  3104. "format": 32,
  3105. "location": 1
  3106. },
  3107. {
  3108. "name": "a_texCoord",
  3109. "defines": [],
  3110. "format": 21,
  3111. "location": 2
  3112. },
  3113. {
  3114. "name": "a_tangent",
  3115. "defines": [],
  3116. "format": 44,
  3117. "location": 3
  3118. },
  3119. {
  3120. "name": "a_joints",
  3121. "defines": [
  3122. "CC_USE_SKINNING"
  3123. ],
  3124. "location": 4
  3125. },
  3126. {
  3127. "name": "a_weights",
  3128. "defines": [
  3129. "CC_USE_SKINNING"
  3130. ],
  3131. "format": 44,
  3132. "location": 5
  3133. },
  3134. {
  3135. "name": "a_jointAnimInfo",
  3136. "defines": [
  3137. "USE_INSTANCING",
  3138. "CC_USE_BAKED_ANIMATION"
  3139. ],
  3140. "format": 44,
  3141. "isInstanced": true,
  3142. "location": 6
  3143. },
  3144. {
  3145. "name": "a_matWorld0",
  3146. "defines": [
  3147. "USE_INSTANCING"
  3148. ],
  3149. "format": 44,
  3150. "isInstanced": true,
  3151. "location": 7
  3152. },
  3153. {
  3154. "name": "a_matWorld1",
  3155. "defines": [
  3156. "USE_INSTANCING"
  3157. ],
  3158. "format": 44,
  3159. "isInstanced": true,
  3160. "location": 8
  3161. },
  3162. {
  3163. "name": "a_matWorld2",
  3164. "defines": [
  3165. "USE_INSTANCING"
  3166. ],
  3167. "format": 44,
  3168. "isInstanced": true,
  3169. "location": 9
  3170. },
  3171. {
  3172. "name": "a_lightingMapUVParam",
  3173. "defines": [
  3174. "USE_INSTANCING",
  3175. "CC_USE_LIGHTMAP"
  3176. ],
  3177. "format": 44,
  3178. "isInstanced": true,
  3179. "location": 10
  3180. },
  3181. {
  3182. "name": "a_localShadowBiasAndProbeId",
  3183. "defines": [
  3184. "USE_INSTANCING"
  3185. ],
  3186. "format": 44,
  3187. "isInstanced": true,
  3188. "location": 11
  3189. },
  3190. {
  3191. "name": "a_reflectionProbeData",
  3192. "defines": [
  3193. "USE_INSTANCING",
  3194. "CC_USE_REFLECTION_PROBE"
  3195. ],
  3196. "format": 44,
  3197. "isInstanced": true,
  3198. "location": 12
  3199. },
  3200. {
  3201. "name": "a_sh_linear_const_r",
  3202. "defines": [
  3203. "USE_INSTANCING",
  3204. "CC_USE_LIGHT_PROBE"
  3205. ],
  3206. "format": 44,
  3207. "isInstanced": true,
  3208. "location": 13
  3209. },
  3210. {
  3211. "name": "a_sh_linear_const_g",
  3212. "defines": [
  3213. "USE_INSTANCING",
  3214. "CC_USE_LIGHT_PROBE"
  3215. ],
  3216. "format": 44,
  3217. "isInstanced": true,
  3218. "location": 14
  3219. },
  3220. {
  3221. "name": "a_sh_linear_const_b",
  3222. "defines": [
  3223. "USE_INSTANCING",
  3224. "CC_USE_LIGHT_PROBE"
  3225. ],
  3226. "format": 44,
  3227. "isInstanced": true,
  3228. "location": 15
  3229. },
  3230. {
  3231. "name": "a_vertexId",
  3232. "defines": [
  3233. "CC_USE_MORPH"
  3234. ],
  3235. "format": 11,
  3236. "location": 16
  3237. },
  3238. {
  3239. "name": "a_texCoord1",
  3240. "defines": [],
  3241. "format": 21,
  3242. "location": 17
  3243. }
  3244. ],
  3245. "varyings": [
  3246. {
  3247. "name": "v_uv",
  3248. "type": 14,
  3249. "count": 1,
  3250. "defines": [],
  3251. "stageFlags": 17,
  3252. "location": 0
  3253. },
  3254. {
  3255. "name": "v_uv1",
  3256. "type": 14,
  3257. "count": 1,
  3258. "defines": [
  3259. "HAS_SECOND_UV"
  3260. ],
  3261. "stageFlags": 17,
  3262. "location": 1
  3263. },
  3264. {
  3265. "name": "v_worldPos",
  3266. "type": 16,
  3267. "count": 1,
  3268. "defines": [],
  3269. "stageFlags": 17,
  3270. "location": 2
  3271. },
  3272. {
  3273. "name": "v_clip_depth",
  3274. "type": 14,
  3275. "count": 1,
  3276. "defines": [],
  3277. "stageFlags": 17,
  3278. "location": 3
  3279. }
  3280. ],
  3281. "fragColors": [
  3282. {
  3283. "name": "cc_FragColor",
  3284. "typename": "vec4",
  3285. "type": 16,
  3286. "count": 1,
  3287. "defines": [],
  3288. "stageFlags": 16,
  3289. "location": 0
  3290. }
  3291. ],
  3292. "descriptors": [
  3293. {
  3294. "rate": 0,
  3295. "blocks": [
  3296. {
  3297. "tags": {
  3298. "builtin": "local"
  3299. },
  3300. "name": "CCMorph",
  3301. "members": [
  3302. {
  3303. "name": "cc_displacementWeights",
  3304. "typename": "vec4",
  3305. "type": 16,
  3306. "count": 15,
  3307. "isArray": true
  3308. },
  3309. {
  3310. "name": "cc_displacementTextureInfo",
  3311. "typename": "vec4",
  3312. "type": 16,
  3313. "count": 1
  3314. }
  3315. ],
  3316. "defines": [
  3317. "CC_USE_MORPH"
  3318. ],
  3319. "stageFlags": 1
  3320. },
  3321. {
  3322. "tags": {
  3323. "builtin": "local"
  3324. },
  3325. "name": "CCSkinningTexture",
  3326. "members": [
  3327. {
  3328. "name": "cc_jointTextureInfo",
  3329. "typename": "vec4",
  3330. "type": 16,
  3331. "count": 1,
  3332. "precision": "highp "
  3333. }
  3334. ],
  3335. "defines": [
  3336. "CC_USE_SKINNING",
  3337. "CC_USE_BAKED_ANIMATION"
  3338. ],
  3339. "stageFlags": 1
  3340. },
  3341. {
  3342. "tags": {
  3343. "builtin": "local"
  3344. },
  3345. "name": "CCSkinningAnimation",
  3346. "members": [
  3347. {
  3348. "name": "cc_jointAnimInfo",
  3349. "typename": "vec4",
  3350. "type": 16,
  3351. "count": 1,
  3352. "precision": "highp "
  3353. }
  3354. ],
  3355. "defines": [
  3356. "CC_USE_SKINNING",
  3357. "CC_USE_BAKED_ANIMATION"
  3358. ],
  3359. "stageFlags": 1
  3360. },
  3361. {
  3362. "tags": {
  3363. "builtin": "local"
  3364. },
  3365. "name": "CCSkinning",
  3366. "members": [
  3367. {
  3368. "name": "cc_joints",
  3369. "typename": "vec4",
  3370. "type": 16,
  3371. "count": 0,
  3372. "precision": "highp ",
  3373. "isArray": true
  3374. }
  3375. ],
  3376. "defines": [
  3377. "CC_USE_SKINNING",
  3378. "!CC_USE_BAKED_ANIMATION",
  3379. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  3380. ],
  3381. "stageFlags": 1
  3382. },
  3383. {
  3384. "tags": {
  3385. "builtin": "local"
  3386. },
  3387. "name": "CCLocal",
  3388. "members": [
  3389. {
  3390. "name": "cc_matWorld",
  3391. "typename": "mat4",
  3392. "type": 25,
  3393. "count": 1,
  3394. "precision": "highp "
  3395. },
  3396. {
  3397. "name": "cc_matWorldIT",
  3398. "typename": "mat4",
  3399. "type": 25,
  3400. "count": 1,
  3401. "precision": "highp "
  3402. },
  3403. {
  3404. "name": "cc_lightingMapUVParam",
  3405. "typename": "vec4",
  3406. "type": 16,
  3407. "count": 1,
  3408. "precision": "highp "
  3409. },
  3410. {
  3411. "name": "cc_localShadowBias",
  3412. "typename": "vec4",
  3413. "type": 16,
  3414. "count": 1,
  3415. "precision": "highp "
  3416. },
  3417. {
  3418. "name": "cc_reflectionProbeData1",
  3419. "typename": "vec4",
  3420. "type": 16,
  3421. "count": 1,
  3422. "precision": "highp "
  3423. },
  3424. {
  3425. "name": "cc_reflectionProbeData2",
  3426. "typename": "vec4",
  3427. "type": 16,
  3428. "count": 1,
  3429. "precision": "highp "
  3430. },
  3431. {
  3432. "name": "cc_reflectionProbeBlendData1",
  3433. "typename": "vec4",
  3434. "type": 16,
  3435. "count": 1,
  3436. "precision": "highp "
  3437. },
  3438. {
  3439. "name": "cc_reflectionProbeBlendData2",
  3440. "typename": "vec4",
  3441. "type": 16,
  3442. "count": 1,
  3443. "precision": "highp "
  3444. }
  3445. ],
  3446. "defines": [
  3447. "!USE_INSTANCING"
  3448. ],
  3449. "stageFlags": 1
  3450. }
  3451. ],
  3452. "samplerTextures": [
  3453. {
  3454. "tags": {
  3455. "builtin": "local"
  3456. },
  3457. "name": "cc_PositionDisplacements",
  3458. "typename": "sampler2D",
  3459. "type": 28,
  3460. "count": 1,
  3461. "defines": [
  3462. "CC_USE_MORPH",
  3463. "CC_MORPH_TARGET_HAS_POSITION"
  3464. ],
  3465. "stageFlags": 1
  3466. },
  3467. {
  3468. "tags": {
  3469. "builtin": "local"
  3470. },
  3471. "name": "cc_NormalDisplacements",
  3472. "typename": "sampler2D",
  3473. "type": 28,
  3474. "count": 1,
  3475. "defines": [
  3476. "CC_USE_MORPH",
  3477. "CC_MORPH_TARGET_HAS_NORMAL"
  3478. ],
  3479. "stageFlags": 1
  3480. },
  3481. {
  3482. "tags": {
  3483. "builtin": "local"
  3484. },
  3485. "name": "cc_TangentDisplacements",
  3486. "typename": "sampler2D",
  3487. "type": 28,
  3488. "count": 1,
  3489. "defines": [
  3490. "CC_USE_MORPH",
  3491. "CC_MORPH_TARGET_HAS_TANGENT"
  3492. ],
  3493. "stageFlags": 1
  3494. },
  3495. {
  3496. "tags": {
  3497. "builtin": "local"
  3498. },
  3499. "name": "cc_jointTexture",
  3500. "typename": "sampler2D",
  3501. "type": 28,
  3502. "count": 1,
  3503. "precision": "highp ",
  3504. "defines": [
  3505. "CC_USE_SKINNING",
  3506. "CC_USE_BAKED_ANIMATION"
  3507. ],
  3508. "stageFlags": 1
  3509. },
  3510. {
  3511. "tags": {
  3512. "builtin": "local"
  3513. },
  3514. "name": "cc_realtimeJoint",
  3515. "typename": "sampler2D",
  3516. "type": 28,
  3517. "count": 1,
  3518. "precision": "highp ",
  3519. "defines": [
  3520. "CC_USE_SKINNING",
  3521. "!CC_USE_BAKED_ANIMATION",
  3522. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  3523. ],
  3524. "stageFlags": 1
  3525. }
  3526. ],
  3527. "samplers": [],
  3528. "textures": [],
  3529. "buffers": [],
  3530. "images": [],
  3531. "subpassInputs": []
  3532. },
  3533. {
  3534. "rate": 1,
  3535. "blocks": [
  3536. {
  3537. "name": "Constants",
  3538. "members": [
  3539. {
  3540. "name": "tilingOffset",
  3541. "type": 16,
  3542. "count": 1
  3543. },
  3544. {
  3545. "name": "albedo",
  3546. "type": 16,
  3547. "count": 1
  3548. },
  3549. {
  3550. "name": "albedoScaleAndCutoff",
  3551. "type": 16,
  3552. "count": 1
  3553. },
  3554. {
  3555. "name": "pbrParams",
  3556. "type": 16,
  3557. "count": 1
  3558. },
  3559. {
  3560. "name": "emissive",
  3561. "type": 16,
  3562. "count": 1
  3563. },
  3564. {
  3565. "name": "emissiveScaleParam",
  3566. "type": 16,
  3567. "count": 1
  3568. }
  3569. ],
  3570. "defines": [],
  3571. "stageFlags": 17,
  3572. "binding": 0
  3573. }
  3574. ],
  3575. "samplerTextures": [
  3576. {
  3577. "name": "albedoMap",
  3578. "type": 28,
  3579. "count": 1,
  3580. "defines": [
  3581. "USE_ALBEDO_MAP"
  3582. ],
  3583. "stageFlags": 16,
  3584. "binding": 1
  3585. }
  3586. ],
  3587. "samplers": [],
  3588. "textures": [],
  3589. "buffers": [],
  3590. "images": [],
  3591. "subpassInputs": []
  3592. },
  3593. {
  3594. "rate": 2,
  3595. "blocks": [],
  3596. "samplerTextures": [],
  3597. "samplers": [],
  3598. "textures": [],
  3599. "buffers": [],
  3600. "images": [],
  3601. "subpassInputs": []
  3602. },
  3603. {
  3604. "rate": 3,
  3605. "blocks": [
  3606. {
  3607. "tags": {
  3608. "builtin": "global"
  3609. },
  3610. "name": "CCShadow",
  3611. "members": [
  3612. {
  3613. "name": "cc_matLightView",
  3614. "typename": "mat4",
  3615. "type": 25,
  3616. "count": 1,
  3617. "precision": "highp "
  3618. },
  3619. {
  3620. "name": "cc_matLightViewProj",
  3621. "typename": "mat4",
  3622. "type": 25,
  3623. "count": 1,
  3624. "precision": "highp "
  3625. },
  3626. {
  3627. "name": "cc_shadowInvProjDepthInfo",
  3628. "typename": "vec4",
  3629. "type": 16,
  3630. "count": 1,
  3631. "precision": "highp "
  3632. },
  3633. {
  3634. "name": "cc_shadowProjDepthInfo",
  3635. "typename": "vec4",
  3636. "type": 16,
  3637. "count": 1,
  3638. "precision": "highp "
  3639. },
  3640. {
  3641. "name": "cc_shadowProjInfo",
  3642. "typename": "vec4",
  3643. "type": 16,
  3644. "count": 1,
  3645. "precision": "highp "
  3646. },
  3647. {
  3648. "name": "cc_shadowNFLSInfo",
  3649. "typename": "vec4",
  3650. "type": 16,
  3651. "count": 1,
  3652. "precision": "mediump "
  3653. },
  3654. {
  3655. "name": "cc_shadowWHPBInfo",
  3656. "typename": "vec4",
  3657. "type": 16,
  3658. "count": 1,
  3659. "precision": "mediump "
  3660. },
  3661. {
  3662. "name": "cc_shadowLPNNInfo",
  3663. "typename": "vec4",
  3664. "type": 16,
  3665. "count": 1,
  3666. "precision": "mediump "
  3667. },
  3668. {
  3669. "name": "cc_shadowColor",
  3670. "typename": "vec4",
  3671. "type": 16,
  3672. "count": 1,
  3673. "precision": "lowp "
  3674. },
  3675. {
  3676. "name": "cc_planarNDInfo",
  3677. "typename": "vec4",
  3678. "type": 16,
  3679. "count": 1,
  3680. "precision": "mediump "
  3681. }
  3682. ],
  3683. "defines": [],
  3684. "stageFlags": 17
  3685. },
  3686. {
  3687. "tags": {
  3688. "builtin": "global"
  3689. },
  3690. "name": "CCCSM",
  3691. "members": [
  3692. {
  3693. "name": "cc_csmViewDir0",
  3694. "typename": "vec4",
  3695. "type": 16,
  3696. "count": 4,
  3697. "precision": "highp ",
  3698. "isArray": true
  3699. },
  3700. {
  3701. "name": "cc_csmViewDir1",
  3702. "typename": "vec4",
  3703. "type": 16,
  3704. "count": 4,
  3705. "precision": "highp ",
  3706. "isArray": true
  3707. },
  3708. {
  3709. "name": "cc_csmViewDir2",
  3710. "typename": "vec4",
  3711. "type": 16,
  3712. "count": 4,
  3713. "precision": "highp ",
  3714. "isArray": true
  3715. },
  3716. {
  3717. "name": "cc_csmAtlas",
  3718. "typename": "vec4",
  3719. "type": 16,
  3720. "count": 4,
  3721. "precision": "highp ",
  3722. "isArray": true
  3723. },
  3724. {
  3725. "name": "cc_matCSMViewProj",
  3726. "typename": "mat4",
  3727. "type": 25,
  3728. "count": 4,
  3729. "precision": "highp ",
  3730. "isArray": true
  3731. },
  3732. {
  3733. "name": "cc_csmProjDepthInfo",
  3734. "typename": "vec4",
  3735. "type": 16,
  3736. "count": 4,
  3737. "precision": "highp ",
  3738. "isArray": true
  3739. },
  3740. {
  3741. "name": "cc_csmProjInfo",
  3742. "typename": "vec4",
  3743. "type": 16,
  3744. "count": 4,
  3745. "precision": "highp ",
  3746. "isArray": true
  3747. },
  3748. {
  3749. "name": "cc_csmSplitsInfo",
  3750. "typename": "vec4",
  3751. "type": 16,
  3752. "count": 1,
  3753. "precision": "highp "
  3754. }
  3755. ],
  3756. "defines": [
  3757. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  3758. ],
  3759. "stageFlags": 16
  3760. },
  3761. {
  3762. "tags": {
  3763. "builtin": "global"
  3764. },
  3765. "name": "CCGlobal",
  3766. "members": [
  3767. {
  3768. "name": "cc_time",
  3769. "typename": "vec4",
  3770. "type": 16,
  3771. "count": 1,
  3772. "precision": "highp "
  3773. },
  3774. {
  3775. "name": "cc_screenSize",
  3776. "typename": "vec4",
  3777. "type": 16,
  3778. "count": 1,
  3779. "precision": "mediump "
  3780. },
  3781. {
  3782. "name": "cc_nativeSize",
  3783. "typename": "vec4",
  3784. "type": 16,
  3785. "count": 1,
  3786. "precision": "mediump "
  3787. },
  3788. {
  3789. "name": "cc_probeInfo",
  3790. "typename": "vec4",
  3791. "type": 16,
  3792. "count": 1,
  3793. "precision": "mediump "
  3794. },
  3795. {
  3796. "name": "cc_debug_view_mode",
  3797. "typename": "vec4",
  3798. "type": 16,
  3799. "count": 1,
  3800. "precision": "mediump "
  3801. }
  3802. ],
  3803. "defines": [
  3804. "CC_RECEIVE_SHADOW"
  3805. ],
  3806. "stageFlags": 16
  3807. },
  3808. {
  3809. "tags": {
  3810. "builtin": "global"
  3811. },
  3812. "name": "CCCamera",
  3813. "members": [
  3814. {
  3815. "name": "cc_matView",
  3816. "typename": "mat4",
  3817. "type": 25,
  3818. "count": 1,
  3819. "precision": "highp "
  3820. },
  3821. {
  3822. "name": "cc_matViewInv",
  3823. "typename": "mat4",
  3824. "type": 25,
  3825. "count": 1,
  3826. "precision": "highp "
  3827. },
  3828. {
  3829. "name": "cc_matProj",
  3830. "typename": "mat4",
  3831. "type": 25,
  3832. "count": 1,
  3833. "precision": "highp "
  3834. },
  3835. {
  3836. "name": "cc_matProjInv",
  3837. "typename": "mat4",
  3838. "type": 25,
  3839. "count": 1,
  3840. "precision": "highp "
  3841. },
  3842. {
  3843. "name": "cc_matViewProj",
  3844. "typename": "mat4",
  3845. "type": 25,
  3846. "count": 1,
  3847. "precision": "highp "
  3848. },
  3849. {
  3850. "name": "cc_matViewProjInv",
  3851. "typename": "mat4",
  3852. "type": 25,
  3853. "count": 1,
  3854. "precision": "highp "
  3855. },
  3856. {
  3857. "name": "cc_cameraPos",
  3858. "typename": "vec4",
  3859. "type": 16,
  3860. "count": 1,
  3861. "precision": "highp "
  3862. },
  3863. {
  3864. "name": "cc_surfaceTransform",
  3865. "typename": "vec4",
  3866. "type": 16,
  3867. "count": 1,
  3868. "precision": "mediump "
  3869. },
  3870. {
  3871. "name": "cc_screenScale",
  3872. "typename": "vec4",
  3873. "type": 16,
  3874. "count": 1,
  3875. "precision": "mediump "
  3876. },
  3877. {
  3878. "name": "cc_exposure",
  3879. "typename": "vec4",
  3880. "type": 16,
  3881. "count": 1,
  3882. "precision": "mediump "
  3883. },
  3884. {
  3885. "name": "cc_mainLitDir",
  3886. "typename": "vec4",
  3887. "type": 16,
  3888. "count": 1,
  3889. "precision": "mediump "
  3890. },
  3891. {
  3892. "name": "cc_mainLitColor",
  3893. "typename": "vec4",
  3894. "type": 16,
  3895. "count": 1,
  3896. "precision": "mediump "
  3897. },
  3898. {
  3899. "name": "cc_ambientSky",
  3900. "typename": "vec4",
  3901. "type": 16,
  3902. "count": 1,
  3903. "precision": "mediump "
  3904. },
  3905. {
  3906. "name": "cc_ambientGround",
  3907. "typename": "vec4",
  3908. "type": 16,
  3909. "count": 1,
  3910. "precision": "mediump "
  3911. },
  3912. {
  3913. "name": "cc_fogColor",
  3914. "typename": "vec4",
  3915. "type": 16,
  3916. "count": 1,
  3917. "precision": "mediump "
  3918. },
  3919. {
  3920. "name": "cc_fogBase",
  3921. "typename": "vec4",
  3922. "type": 16,
  3923. "count": 1,
  3924. "precision": "mediump "
  3925. },
  3926. {
  3927. "name": "cc_fogAdd",
  3928. "typename": "vec4",
  3929. "type": 16,
  3930. "count": 1,
  3931. "precision": "mediump "
  3932. },
  3933. {
  3934. "name": "cc_nearFar",
  3935. "typename": "vec4",
  3936. "type": 16,
  3937. "count": 1,
  3938. "precision": "mediump "
  3939. },
  3940. {
  3941. "name": "cc_viewPort",
  3942. "typename": "vec4",
  3943. "type": 16,
  3944. "count": 1,
  3945. "precision": "mediump "
  3946. }
  3947. ],
  3948. "defines": [
  3949. "CC_RECEIVE_SHADOW"
  3950. ],
  3951. "stageFlags": 16
  3952. }
  3953. ],
  3954. "samplerTextures": [
  3955. {
  3956. "tags": {
  3957. "builtin": "global"
  3958. },
  3959. "name": "cc_shadowMap",
  3960. "typename": "sampler2D",
  3961. "type": 28,
  3962. "count": 1,
  3963. "precision": "highp ",
  3964. "defines": [
  3965. "CC_RECEIVE_SHADOW"
  3966. ],
  3967. "stageFlags": 16
  3968. },
  3969. {
  3970. "tags": {
  3971. "builtin": "global"
  3972. },
  3973. "name": "cc_spotShadowMap",
  3974. "typename": "sampler2D",
  3975. "type": 28,
  3976. "count": 1,
  3977. "precision": "highp ",
  3978. "defines": [
  3979. "CC_RECEIVE_SHADOW"
  3980. ],
  3981. "stageFlags": 16
  3982. }
  3983. ],
  3984. "samplers": [],
  3985. "textures": [],
  3986. "buffers": [],
  3987. "images": [],
  3988. "subpassInputs": []
  3989. }
  3990. ],
  3991. "hash": 651493757,
  3992. "glsl4": {
  3993. "vert": "#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\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\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\nlayout(location = 3) in vec4 a_tangent;\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 = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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 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\nvoid CCVertInput(inout StandardVertInput In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\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}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\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};\n#if HAS_SECOND_UV || CC_USE_LIGHTMAP\n layout(location = 17) in vec2 a_texCoord1;\n#endif\nlayout(location = 0) out vec2 v_uv;\n#if HAS_SECOND_UV\n layout(location = 1) out vec2 v_uv1;\n#endif\nlayout(location = 2) out vec4 v_worldPos;\nlayout(location = 3) out highp vec2 v_clip_depth;\nvec4 vert () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n v_worldPos = matWorld * In.position;\n vec4 clipPos = cc_matLightViewProj * v_worldPos;\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #endif\n v_clip_depth = clipPos.zw;\n return clipPos;\n}\nvoid main() { gl_Position = vert(); }",
  3994. "frag": "\nprecision highp float;\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\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)\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\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\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}\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 = 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 };\n layout(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 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\nlayout(location = 0) in vec2 v_uv;\n#if HAS_SECOND_UV\n layout(location = 1) in vec2 v_uv1;\n#endif\nlayout(location = 2) in vec4 v_worldPos;\nlayout(location = 3) in highp vec2 v_clip_depth;\n#if USE_ALBEDO_MAP\n layout(set = 1, binding = 1) uniform sampler2D albedoMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvec4 frag () {\n vec4 baseColor = albedo;\n #if USE_ALPHA_TEST\n #if USE_ALBEDO_MAP\n baseColor *= texture(albedoMap, ALBEDO_UV);\n #endif\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\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(v_worldPos.xyz);\n }\n #endif\n #if CC_SHADOWMAP_FORMAT == 1\n return packDepthToRGBA(clipDepth);\n #else\n return vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  3995. },
  3996. "glsl3": {
  3997. "vert": "\nprecision highp float;\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\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\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_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\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 int getVertexId() {\n return int(a_vertexId);\n }\n#endif\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 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\nvoid CCVertInput(inout StandardVertInput In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\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}\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\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};\n#if HAS_SECOND_UV || CC_USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\nout vec2 v_uv;\n#if HAS_SECOND_UV\n out vec2 v_uv1;\n#endif\nout vec4 v_worldPos;\nout highp vec2 v_clip_depth;\nvec4 vert () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n v_worldPos = matWorld * In.position;\n vec4 clipPos = cc_matLightViewProj * v_worldPos;\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #endif\n v_clip_depth = clipPos.zw;\n return clipPos;\n}\nvoid main() { gl_Position = vert(); }",
  3998. "frag": "\nprecision highp float;\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n};\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)\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\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\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}\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(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 };\n layout(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 uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\nin vec2 v_uv;\n#if HAS_SECOND_UV\n in vec2 v_uv1;\n#endif\nin vec4 v_worldPos;\nin highp vec2 v_clip_depth;\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvec4 frag () {\n vec4 baseColor = albedo;\n #if USE_ALPHA_TEST\n #if USE_ALBEDO_MAP\n baseColor *= texture(albedoMap, ALBEDO_UV);\n #endif\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\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(v_worldPos.xyz);\n }\n #endif\n #if CC_SHADOWMAP_FORMAT == 1\n return packDepthToRGBA(clipDepth);\n #else\n return vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  3999. },
  4000. "glsl1": {
  4001. "vert": "\nprecision highp float;\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\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\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_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\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 int getVertexId() {\n return int(a_vertexId);\n }\n#endif\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 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\nvoid CCVertInput(inout StandardVertInput In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n #if CC_USE_MORPH\n applyMorph(In.position, In.normal, In.tangent);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In.position, In.normal, In.tangent);\n #endif\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 uniform vec4 tilingOffset;\nuniform highp mat4 cc_matLightViewProj;\n#if HAS_SECOND_UV || CC_USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\nvarying vec2 v_uv;\n#if HAS_SECOND_UV\n varying vec2 v_uv1;\n#endif\nvarying vec4 v_worldPos;\nvarying highp vec2 v_clip_depth;\nvec4 vert () {\n StandardVertInput In;\n CCVertInput(In);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n v_worldPos = matWorld * In.position;\n vec4 clipPos = cc_matLightViewProj * v_worldPos;\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if HAS_SECOND_UV\n v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;\n #endif\n v_clip_depth = clipPos.zw;\n return clipPos;\n}\nvoid main() { gl_Position = vert(); }",
  4002. "frag": "\nprecision highp float;\n uniform vec4 albedo;\n uniform vec4 albedoScaleAndCutoff;\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)\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\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\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}\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\nvarying vec2 v_uv;\n#if HAS_SECOND_UV\n varying vec2 v_uv1;\n#endif\nvarying vec4 v_worldPos;\nvarying highp vec2 v_clip_depth;\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_ALPHA_TEST\n#endif\nvec4 frag () {\n vec4 baseColor = albedo;\n #if USE_ALPHA_TEST\n #if USE_ALBEDO_MAP\n baseColor *= texture2D(albedoMap, ALBEDO_UV);\n #endif\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\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(v_worldPos.xyz);\n }\n #endif\n #if CC_SHADOWMAP_FORMAT == 1\n return packDepthToRGBA(clipDepth);\n #else\n return vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}\nvoid main() { gl_FragColor = frag(); }"
  4003. },
  4004. "builtins": {
  4005. "globals": {
  4006. "blocks": [
  4007. {
  4008. "name": "CCShadow",
  4009. "defines": []
  4010. },
  4011. {
  4012. "name": "CCCSM",
  4013. "defines": [
  4014. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  4015. ]
  4016. },
  4017. {
  4018. "name": "CCGlobal",
  4019. "defines": [
  4020. "CC_RECEIVE_SHADOW"
  4021. ]
  4022. },
  4023. {
  4024. "name": "CCCamera",
  4025. "defines": [
  4026. "CC_RECEIVE_SHADOW"
  4027. ]
  4028. }
  4029. ],
  4030. "samplerTextures": [
  4031. {
  4032. "name": "cc_shadowMap",
  4033. "defines": [
  4034. "CC_RECEIVE_SHADOW"
  4035. ]
  4036. },
  4037. {
  4038. "name": "cc_spotShadowMap",
  4039. "defines": [
  4040. "CC_RECEIVE_SHADOW"
  4041. ]
  4042. }
  4043. ],
  4044. "buffers": [],
  4045. "images": []
  4046. },
  4047. "locals": {
  4048. "blocks": [
  4049. {
  4050. "name": "CCMorph",
  4051. "defines": [
  4052. "CC_USE_MORPH"
  4053. ]
  4054. },
  4055. {
  4056. "name": "CCSkinningTexture",
  4057. "defines": [
  4058. "CC_USE_SKINNING",
  4059. "CC_USE_BAKED_ANIMATION"
  4060. ]
  4061. },
  4062. {
  4063. "name": "CCSkinningAnimation",
  4064. "defines": [
  4065. "CC_USE_SKINNING",
  4066. "CC_USE_BAKED_ANIMATION"
  4067. ]
  4068. },
  4069. {
  4070. "name": "CCSkinning",
  4071. "defines": [
  4072. "CC_USE_SKINNING",
  4073. "!CC_USE_BAKED_ANIMATION",
  4074. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  4075. ]
  4076. },
  4077. {
  4078. "name": "CCLocal",
  4079. "defines": [
  4080. "!USE_INSTANCING"
  4081. ]
  4082. }
  4083. ],
  4084. "samplerTextures": [
  4085. {
  4086. "name": "cc_PositionDisplacements",
  4087. "defines": [
  4088. "CC_USE_MORPH",
  4089. "CC_MORPH_TARGET_HAS_POSITION"
  4090. ]
  4091. },
  4092. {
  4093. "name": "cc_NormalDisplacements",
  4094. "defines": [
  4095. "CC_USE_MORPH",
  4096. "CC_MORPH_TARGET_HAS_NORMAL"
  4097. ]
  4098. },
  4099. {
  4100. "name": "cc_TangentDisplacements",
  4101. "defines": [
  4102. "CC_USE_MORPH",
  4103. "CC_MORPH_TARGET_HAS_TANGENT"
  4104. ]
  4105. },
  4106. {
  4107. "name": "cc_jointTexture",
  4108. "defines": [
  4109. "CC_USE_SKINNING",
  4110. "CC_USE_BAKED_ANIMATION"
  4111. ]
  4112. },
  4113. {
  4114. "name": "cc_realtimeJoint",
  4115. "defines": [
  4116. "CC_USE_SKINNING",
  4117. "!CC_USE_BAKED_ANIMATION",
  4118. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  4119. ]
  4120. }
  4121. ],
  4122. "buffers": [],
  4123. "images": []
  4124. },
  4125. "statistics": {
  4126. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 54,
  4127. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 105
  4128. }
  4129. },
  4130. "defines": [
  4131. {
  4132. "name": "USE_INSTANCING",
  4133. "type": "boolean",
  4134. "defines": [],
  4135. "editor": {
  4136. "elevated": true
  4137. }
  4138. },
  4139. {
  4140. "name": "CC_USE_SKINNING",
  4141. "type": "boolean",
  4142. "defines": []
  4143. },
  4144. {
  4145. "name": "CC_USE_BAKED_ANIMATION",
  4146. "type": "boolean",
  4147. "defines": [
  4148. "USE_INSTANCING"
  4149. ]
  4150. },
  4151. {
  4152. "name": "CC_USE_LIGHTMAP",
  4153. "type": "boolean",
  4154. "defines": [
  4155. "USE_INSTANCING"
  4156. ]
  4157. },
  4158. {
  4159. "name": "CC_USE_REFLECTION_PROBE",
  4160. "type": "boolean",
  4161. "defines": [
  4162. "USE_INSTANCING"
  4163. ]
  4164. },
  4165. {
  4166. "name": "CC_RECEIVE_SHADOW",
  4167. "type": "boolean",
  4168. "defines": []
  4169. },
  4170. {
  4171. "name": "CC_USE_LIGHT_PROBE",
  4172. "type": "boolean",
  4173. "defines": [
  4174. "USE_INSTANCING"
  4175. ]
  4176. },
  4177. {
  4178. "name": "CC_USE_MORPH",
  4179. "type": "boolean",
  4180. "defines": []
  4181. },
  4182. {
  4183. "name": "CC_MORPH_TARGET_COUNT",
  4184. "type": "number",
  4185. "defines": [
  4186. "CC_USE_MORPH"
  4187. ],
  4188. "range": [
  4189. 2,
  4190. 8
  4191. ]
  4192. },
  4193. {
  4194. "name": "CC_MORPH_TARGET_HAS_POSITION",
  4195. "type": "boolean",
  4196. "defines": [
  4197. "CC_USE_MORPH"
  4198. ]
  4199. },
  4200. {
  4201. "name": "CC_MORPH_TARGET_HAS_NORMAL",
  4202. "type": "boolean",
  4203. "defines": [
  4204. "CC_USE_MORPH"
  4205. ]
  4206. },
  4207. {
  4208. "name": "CC_MORPH_TARGET_HAS_TANGENT",
  4209. "type": "boolean",
  4210. "defines": [
  4211. "CC_USE_MORPH"
  4212. ]
  4213. },
  4214. {
  4215. "name": "CC_MORPH_PRECOMPUTED",
  4216. "type": "boolean",
  4217. "defines": [
  4218. "CC_USE_MORPH"
  4219. ]
  4220. },
  4221. {
  4222. "name": "CC_USE_REAL_TIME_JOINT_TEXTURE",
  4223. "type": "boolean",
  4224. "defines": [
  4225. "CC_USE_SKINNING",
  4226. "!CC_USE_BAKED_ANIMATION"
  4227. ]
  4228. },
  4229. {
  4230. "name": "HAS_SECOND_UV",
  4231. "type": "boolean",
  4232. "defines": []
  4233. },
  4234. {
  4235. "name": "CC_SUPPORT_CASCADED_SHADOW_MAP",
  4236. "type": "boolean",
  4237. "defines": []
  4238. },
  4239. {
  4240. "name": "USE_ALBEDO_MAP",
  4241. "type": "boolean",
  4242. "defines": []
  4243. },
  4244. {
  4245. "name": "ALBEDO_UV",
  4246. "type": "string",
  4247. "defines": [
  4248. "USE_ALBEDO_MAP"
  4249. ],
  4250. "options": [
  4251. "v_uv",
  4252. "v_uv1"
  4253. ]
  4254. },
  4255. {
  4256. "name": "USE_ALPHA_TEST",
  4257. "type": "boolean",
  4258. "defines": []
  4259. },
  4260. {
  4261. "name": "ALPHA_TEST_CHANNEL",
  4262. "type": "string",
  4263. "defines": [
  4264. "USE_ALPHA_TEST"
  4265. ],
  4266. "options": [
  4267. "a",
  4268. "r"
  4269. ]
  4270. },
  4271. {
  4272. "name": "CC_SHADOWMAP_USE_LINEAR_DEPTH",
  4273. "type": "boolean",
  4274. "defines": []
  4275. },
  4276. {
  4277. "name": "CC_SHADOWMAP_FORMAT",
  4278. "type": "number",
  4279. "defines": [],
  4280. "range": [
  4281. 0,
  4282. 3
  4283. ]
  4284. }
  4285. ],
  4286. "name": "legacy/standard|shadow-caster-vs:vert|shadow-caster-fs:frag"
  4287. },
  4288. {
  4289. "blocks": [],
  4290. "samplerTextures": [],
  4291. "samplers": [],
  4292. "textures": [],
  4293. "buffers": [],
  4294. "images": [],
  4295. "subpassInputs": [],
  4296. "attributes": [
  4297. {
  4298. "name": "a_position",
  4299. "defines": [],
  4300. "format": 32,
  4301. "location": 0
  4302. },
  4303. {
  4304. "name": "a_normal",
  4305. "defines": [],
  4306. "format": 32,
  4307. "location": 1
  4308. },
  4309. {
  4310. "name": "a_texCoord",
  4311. "defines": [],
  4312. "format": 21,
  4313. "location": 2
  4314. },
  4315. {
  4316. "name": "a_tangent",
  4317. "defines": [],
  4318. "format": 44,
  4319. "location": 3
  4320. },
  4321. {
  4322. "name": "a_joints",
  4323. "defines": [
  4324. "CC_USE_SKINNING"
  4325. ],
  4326. "location": 4
  4327. },
  4328. {
  4329. "name": "a_weights",
  4330. "defines": [
  4331. "CC_USE_SKINNING"
  4332. ],
  4333. "format": 44,
  4334. "location": 5
  4335. },
  4336. {
  4337. "name": "a_jointAnimInfo",
  4338. "defines": [
  4339. "USE_INSTANCING",
  4340. "CC_USE_BAKED_ANIMATION"
  4341. ],
  4342. "format": 44,
  4343. "isInstanced": true,
  4344. "location": 6
  4345. },
  4346. {
  4347. "name": "a_matWorld0",
  4348. "defines": [
  4349. "USE_INSTANCING"
  4350. ],
  4351. "format": 44,
  4352. "isInstanced": true,
  4353. "location": 7
  4354. },
  4355. {
  4356. "name": "a_matWorld1",
  4357. "defines": [
  4358. "USE_INSTANCING"
  4359. ],
  4360. "format": 44,
  4361. "isInstanced": true,
  4362. "location": 8
  4363. },
  4364. {
  4365. "name": "a_matWorld2",
  4366. "defines": [
  4367. "USE_INSTANCING"
  4368. ],
  4369. "format": 44,
  4370. "isInstanced": true,
  4371. "location": 9
  4372. },
  4373. {
  4374. "name": "a_lightingMapUVParam",
  4375. "defines": [
  4376. "USE_INSTANCING",
  4377. "CC_USE_LIGHTMAP"
  4378. ],
  4379. "format": 44,
  4380. "isInstanced": true,
  4381. "location": 10
  4382. },
  4383. {
  4384. "name": "a_localShadowBiasAndProbeId",
  4385. "defines": [
  4386. "USE_INSTANCING"
  4387. ],
  4388. "format": 44,
  4389. "isInstanced": true,
  4390. "location": 11
  4391. },
  4392. {
  4393. "name": "a_reflectionProbeData",
  4394. "defines": [
  4395. "USE_INSTANCING",
  4396. "CC_USE_REFLECTION_PROBE"
  4397. ],
  4398. "format": 44,
  4399. "isInstanced": true,
  4400. "location": 12
  4401. },
  4402. {
  4403. "name": "a_sh_linear_const_r",
  4404. "defines": [
  4405. "USE_INSTANCING",
  4406. "CC_USE_LIGHT_PROBE"
  4407. ],
  4408. "format": 44,
  4409. "isInstanced": true,
  4410. "location": 13
  4411. },
  4412. {
  4413. "name": "a_sh_linear_const_g",
  4414. "defines": [
  4415. "USE_INSTANCING",
  4416. "CC_USE_LIGHT_PROBE"
  4417. ],
  4418. "format": 44,
  4419. "isInstanced": true,
  4420. "location": 14
  4421. },
  4422. {
  4423. "name": "a_sh_linear_const_b",
  4424. "defines": [
  4425. "USE_INSTANCING",
  4426. "CC_USE_LIGHT_PROBE"
  4427. ],
  4428. "format": 44,
  4429. "isInstanced": true,
  4430. "location": 15
  4431. },
  4432. {
  4433. "name": "a_vertexId",
  4434. "defines": [
  4435. "CC_USE_MORPH"
  4436. ],
  4437. "format": 11,
  4438. "location": 16
  4439. }
  4440. ],
  4441. "varyings": [
  4442. {
  4443. "name": "v_dist",
  4444. "type": 13,
  4445. "count": 1,
  4446. "defines": [],
  4447. "stageFlags": 17,
  4448. "location": 0
  4449. }
  4450. ],
  4451. "fragColors": [
  4452. {
  4453. "name": "cc_FragColor",
  4454. "typename": "vec4",
  4455. "type": 16,
  4456. "count": 1,
  4457. "defines": [],
  4458. "stageFlags": 16,
  4459. "location": 0
  4460. }
  4461. ],
  4462. "descriptors": [
  4463. {
  4464. "rate": 0,
  4465. "blocks": [
  4466. {
  4467. "tags": {
  4468. "builtin": "local"
  4469. },
  4470. "name": "CCMorph",
  4471. "members": [
  4472. {
  4473. "name": "cc_displacementWeights",
  4474. "typename": "vec4",
  4475. "type": 16,
  4476. "count": 15,
  4477. "isArray": true
  4478. },
  4479. {
  4480. "name": "cc_displacementTextureInfo",
  4481. "typename": "vec4",
  4482. "type": 16,
  4483. "count": 1
  4484. }
  4485. ],
  4486. "defines": [
  4487. "CC_USE_MORPH"
  4488. ],
  4489. "stageFlags": 1
  4490. },
  4491. {
  4492. "tags": {
  4493. "builtin": "local"
  4494. },
  4495. "name": "CCSkinningTexture",
  4496. "members": [
  4497. {
  4498. "name": "cc_jointTextureInfo",
  4499. "typename": "vec4",
  4500. "type": 16,
  4501. "count": 1,
  4502. "precision": "highp "
  4503. }
  4504. ],
  4505. "defines": [
  4506. "CC_USE_SKINNING",
  4507. "CC_USE_BAKED_ANIMATION"
  4508. ],
  4509. "stageFlags": 1
  4510. },
  4511. {
  4512. "tags": {
  4513. "builtin": "local"
  4514. },
  4515. "name": "CCSkinningAnimation",
  4516. "members": [
  4517. {
  4518. "name": "cc_jointAnimInfo",
  4519. "typename": "vec4",
  4520. "type": 16,
  4521. "count": 1,
  4522. "precision": "highp "
  4523. }
  4524. ],
  4525. "defines": [
  4526. "CC_USE_SKINNING",
  4527. "CC_USE_BAKED_ANIMATION"
  4528. ],
  4529. "stageFlags": 1
  4530. },
  4531. {
  4532. "tags": {
  4533. "builtin": "local"
  4534. },
  4535. "name": "CCSkinning",
  4536. "members": [
  4537. {
  4538. "name": "cc_joints",
  4539. "typename": "vec4",
  4540. "type": 16,
  4541. "count": 0,
  4542. "precision": "highp ",
  4543. "isArray": true
  4544. }
  4545. ],
  4546. "defines": [
  4547. "CC_USE_SKINNING",
  4548. "!CC_USE_BAKED_ANIMATION",
  4549. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  4550. ],
  4551. "stageFlags": 1
  4552. },
  4553. {
  4554. "tags": {
  4555. "builtin": "local"
  4556. },
  4557. "name": "CCLocal",
  4558. "members": [
  4559. {
  4560. "name": "cc_matWorld",
  4561. "typename": "mat4",
  4562. "type": 25,
  4563. "count": 1,
  4564. "precision": "highp "
  4565. },
  4566. {
  4567. "name": "cc_matWorldIT",
  4568. "typename": "mat4",
  4569. "type": 25,
  4570. "count": 1,
  4571. "precision": "highp "
  4572. },
  4573. {
  4574. "name": "cc_lightingMapUVParam",
  4575. "typename": "vec4",
  4576. "type": 16,
  4577. "count": 1,
  4578. "precision": "highp "
  4579. },
  4580. {
  4581. "name": "cc_localShadowBias",
  4582. "typename": "vec4",
  4583. "type": 16,
  4584. "count": 1,
  4585. "precision": "highp "
  4586. },
  4587. {
  4588. "name": "cc_reflectionProbeData1",
  4589. "typename": "vec4",
  4590. "type": 16,
  4591. "count": 1,
  4592. "precision": "highp "
  4593. },
  4594. {
  4595. "name": "cc_reflectionProbeData2",
  4596. "typename": "vec4",
  4597. "type": 16,
  4598. "count": 1,
  4599. "precision": "highp "
  4600. },
  4601. {
  4602. "name": "cc_reflectionProbeBlendData1",
  4603. "typename": "vec4",
  4604. "type": 16,
  4605. "count": 1,
  4606. "precision": "highp "
  4607. },
  4608. {
  4609. "name": "cc_reflectionProbeBlendData2",
  4610. "typename": "vec4",
  4611. "type": 16,
  4612. "count": 1,
  4613. "precision": "highp "
  4614. }
  4615. ],
  4616. "defines": [
  4617. "!USE_INSTANCING"
  4618. ],
  4619. "stageFlags": 1
  4620. }
  4621. ],
  4622. "samplerTextures": [
  4623. {
  4624. "tags": {
  4625. "builtin": "local"
  4626. },
  4627. "name": "cc_PositionDisplacements",
  4628. "typename": "sampler2D",
  4629. "type": 28,
  4630. "count": 1,
  4631. "defines": [
  4632. "CC_USE_MORPH",
  4633. "CC_MORPH_TARGET_HAS_POSITION"
  4634. ],
  4635. "stageFlags": 1
  4636. },
  4637. {
  4638. "tags": {
  4639. "builtin": "local"
  4640. },
  4641. "name": "cc_NormalDisplacements",
  4642. "typename": "sampler2D",
  4643. "type": 28,
  4644. "count": 1,
  4645. "defines": [
  4646. "CC_USE_MORPH",
  4647. "CC_MORPH_TARGET_HAS_NORMAL"
  4648. ],
  4649. "stageFlags": 1
  4650. },
  4651. {
  4652. "tags": {
  4653. "builtin": "local"
  4654. },
  4655. "name": "cc_TangentDisplacements",
  4656. "typename": "sampler2D",
  4657. "type": 28,
  4658. "count": 1,
  4659. "defines": [
  4660. "CC_USE_MORPH",
  4661. "CC_MORPH_TARGET_HAS_TANGENT"
  4662. ],
  4663. "stageFlags": 1
  4664. },
  4665. {
  4666. "tags": {
  4667. "builtin": "local"
  4668. },
  4669. "name": "cc_jointTexture",
  4670. "typename": "sampler2D",
  4671. "type": 28,
  4672. "count": 1,
  4673. "precision": "highp ",
  4674. "defines": [
  4675. "CC_USE_SKINNING",
  4676. "CC_USE_BAKED_ANIMATION"
  4677. ],
  4678. "stageFlags": 1
  4679. },
  4680. {
  4681. "tags": {
  4682. "builtin": "local"
  4683. },
  4684. "name": "cc_realtimeJoint",
  4685. "typename": "sampler2D",
  4686. "type": 28,
  4687. "count": 1,
  4688. "precision": "highp ",
  4689. "defines": [
  4690. "CC_USE_SKINNING",
  4691. "!CC_USE_BAKED_ANIMATION",
  4692. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  4693. ],
  4694. "stageFlags": 1
  4695. }
  4696. ],
  4697. "samplers": [],
  4698. "textures": [],
  4699. "buffers": [],
  4700. "images": [],
  4701. "subpassInputs": []
  4702. },
  4703. {
  4704. "rate": 1,
  4705. "blocks": [],
  4706. "samplerTextures": [],
  4707. "samplers": [],
  4708. "textures": [],
  4709. "buffers": [],
  4710. "images": [],
  4711. "subpassInputs": []
  4712. },
  4713. {
  4714. "rate": 2,
  4715. "blocks": [],
  4716. "samplerTextures": [],
  4717. "samplers": [],
  4718. "textures": [],
  4719. "buffers": [],
  4720. "images": [],
  4721. "subpassInputs": []
  4722. },
  4723. {
  4724. "rate": 3,
  4725. "blocks": [
  4726. {
  4727. "tags": {
  4728. "builtin": "global"
  4729. },
  4730. "name": "CCGlobal",
  4731. "members": [
  4732. {
  4733. "name": "cc_time",
  4734. "typename": "vec4",
  4735. "type": 16,
  4736. "count": 1,
  4737. "precision": "highp "
  4738. },
  4739. {
  4740. "name": "cc_screenSize",
  4741. "typename": "vec4",
  4742. "type": 16,
  4743. "count": 1,
  4744. "precision": "mediump "
  4745. },
  4746. {
  4747. "name": "cc_nativeSize",
  4748. "typename": "vec4",
  4749. "type": 16,
  4750. "count": 1,
  4751. "precision": "mediump "
  4752. },
  4753. {
  4754. "name": "cc_probeInfo",
  4755. "typename": "vec4",
  4756. "type": 16,
  4757. "count": 1,
  4758. "precision": "mediump "
  4759. },
  4760. {
  4761. "name": "cc_debug_view_mode",
  4762. "typename": "vec4",
  4763. "type": 16,
  4764. "count": 1,
  4765. "precision": "mediump "
  4766. }
  4767. ],
  4768. "defines": [],
  4769. "stageFlags": 17
  4770. },
  4771. {
  4772. "tags": {
  4773. "builtin": "global"
  4774. },
  4775. "name": "CCCamera",
  4776. "members": [
  4777. {
  4778. "name": "cc_matView",
  4779. "typename": "mat4",
  4780. "type": 25,
  4781. "count": 1,
  4782. "precision": "highp "
  4783. },
  4784. {
  4785. "name": "cc_matViewInv",
  4786. "typename": "mat4",
  4787. "type": 25,
  4788. "count": 1,
  4789. "precision": "highp "
  4790. },
  4791. {
  4792. "name": "cc_matProj",
  4793. "typename": "mat4",
  4794. "type": 25,
  4795. "count": 1,
  4796. "precision": "highp "
  4797. },
  4798. {
  4799. "name": "cc_matProjInv",
  4800. "typename": "mat4",
  4801. "type": 25,
  4802. "count": 1,
  4803. "precision": "highp "
  4804. },
  4805. {
  4806. "name": "cc_matViewProj",
  4807. "typename": "mat4",
  4808. "type": 25,
  4809. "count": 1,
  4810. "precision": "highp "
  4811. },
  4812. {
  4813. "name": "cc_matViewProjInv",
  4814. "typename": "mat4",
  4815. "type": 25,
  4816. "count": 1,
  4817. "precision": "highp "
  4818. },
  4819. {
  4820. "name": "cc_cameraPos",
  4821. "typename": "vec4",
  4822. "type": 16,
  4823. "count": 1,
  4824. "precision": "highp "
  4825. },
  4826. {
  4827. "name": "cc_surfaceTransform",
  4828. "typename": "vec4",
  4829. "type": 16,
  4830. "count": 1,
  4831. "precision": "mediump "
  4832. },
  4833. {
  4834. "name": "cc_screenScale",
  4835. "typename": "vec4",
  4836. "type": 16,
  4837. "count": 1,
  4838. "precision": "mediump "
  4839. },
  4840. {
  4841. "name": "cc_exposure",
  4842. "typename": "vec4",
  4843. "type": 16,
  4844. "count": 1,
  4845. "precision": "mediump "
  4846. },
  4847. {
  4848. "name": "cc_mainLitDir",
  4849. "typename": "vec4",
  4850. "type": 16,
  4851. "count": 1,
  4852. "precision": "mediump "
  4853. },
  4854. {
  4855. "name": "cc_mainLitColor",
  4856. "typename": "vec4",
  4857. "type": 16,
  4858. "count": 1,
  4859. "precision": "mediump "
  4860. },
  4861. {
  4862. "name": "cc_ambientSky",
  4863. "typename": "vec4",
  4864. "type": 16,
  4865. "count": 1,
  4866. "precision": "mediump "
  4867. },
  4868. {
  4869. "name": "cc_ambientGround",
  4870. "typename": "vec4",
  4871. "type": 16,
  4872. "count": 1,
  4873. "precision": "mediump "
  4874. },
  4875. {
  4876. "name": "cc_fogColor",
  4877. "typename": "vec4",
  4878. "type": 16,
  4879. "count": 1,
  4880. "precision": "mediump "
  4881. },
  4882. {
  4883. "name": "cc_fogBase",
  4884. "typename": "vec4",
  4885. "type": 16,
  4886. "count": 1,
  4887. "precision": "mediump "
  4888. },
  4889. {
  4890. "name": "cc_fogAdd",
  4891. "typename": "vec4",
  4892. "type": 16,
  4893. "count": 1,
  4894. "precision": "mediump "
  4895. },
  4896. {
  4897. "name": "cc_nearFar",
  4898. "typename": "vec4",
  4899. "type": 16,
  4900. "count": 1,
  4901. "precision": "mediump "
  4902. },
  4903. {
  4904. "name": "cc_viewPort",
  4905. "typename": "vec4",
  4906. "type": 16,
  4907. "count": 1,
  4908. "precision": "mediump "
  4909. }
  4910. ],
  4911. "defines": [],
  4912. "stageFlags": 17
  4913. },
  4914. {
  4915. "tags": {
  4916. "builtin": "global"
  4917. },
  4918. "name": "CCShadow",
  4919. "members": [
  4920. {
  4921. "name": "cc_matLightView",
  4922. "typename": "mat4",
  4923. "type": 25,
  4924. "count": 1,
  4925. "precision": "highp "
  4926. },
  4927. {
  4928. "name": "cc_matLightViewProj",
  4929. "typename": "mat4",
  4930. "type": 25,
  4931. "count": 1,
  4932. "precision": "highp "
  4933. },
  4934. {
  4935. "name": "cc_shadowInvProjDepthInfo",
  4936. "typename": "vec4",
  4937. "type": 16,
  4938. "count": 1,
  4939. "precision": "highp "
  4940. },
  4941. {
  4942. "name": "cc_shadowProjDepthInfo",
  4943. "typename": "vec4",
  4944. "type": 16,
  4945. "count": 1,
  4946. "precision": "highp "
  4947. },
  4948. {
  4949. "name": "cc_shadowProjInfo",
  4950. "typename": "vec4",
  4951. "type": 16,
  4952. "count": 1,
  4953. "precision": "highp "
  4954. },
  4955. {
  4956. "name": "cc_shadowNFLSInfo",
  4957. "typename": "vec4",
  4958. "type": 16,
  4959. "count": 1,
  4960. "precision": "mediump "
  4961. },
  4962. {
  4963. "name": "cc_shadowWHPBInfo",
  4964. "typename": "vec4",
  4965. "type": 16,
  4966. "count": 1,
  4967. "precision": "mediump "
  4968. },
  4969. {
  4970. "name": "cc_shadowLPNNInfo",
  4971. "typename": "vec4",
  4972. "type": 16,
  4973. "count": 1,
  4974. "precision": "mediump "
  4975. },
  4976. {
  4977. "name": "cc_shadowColor",
  4978. "typename": "vec4",
  4979. "type": 16,
  4980. "count": 1,
  4981. "precision": "lowp "
  4982. },
  4983. {
  4984. "name": "cc_planarNDInfo",
  4985. "typename": "vec4",
  4986. "type": 16,
  4987. "count": 1,
  4988. "precision": "mediump "
  4989. }
  4990. ],
  4991. "defines": [],
  4992. "stageFlags": 17
  4993. }
  4994. ],
  4995. "samplerTextures": [],
  4996. "samplers": [],
  4997. "textures": [],
  4998. "buffers": [],
  4999. "images": [],
  5000. "subpassInputs": []
  5001. }
  5002. ],
  5003. "hash": 3680218420,
  5004. "glsl4": {
  5005. "vert": "#extension GL_EXT_shader_explicit_arithmetic_types_int32: require\nprecision highp float;\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\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\nlayout(location = 3) in vec4 a_tangent;\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 = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n int getVertexId() {\n return gl_VertexIndex;\n }\n#endif\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 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\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\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#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}\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};\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 = 0) out float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }",
  5006. "frag": "\nprecision highp float;\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};\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};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  5007. },
  5008. "glsl3": {
  5009. "vert": "\nprecision highp float;\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\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\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_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\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 int getVertexId() {\n return int(a_vertexId);\n }\n#endif\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 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\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\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#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}\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};\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 float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }",
  5010. "frag": "\nprecision highp float;\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};\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};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  5011. },
  5012. "glsl1": {
  5013. "vert": "\nprecision highp float;\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\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\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_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\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 int getVertexId() {\n return int(a_vertexId);\n }\n#endif\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 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\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\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;\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}\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_planarNDInfo;\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 float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }",
  5014. "frag": "\nprecision highp float;\nuniform lowp vec4 cc_shadowColor;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nvoid main() { gl_FragColor = frag(); }"
  5015. },
  5016. "builtins": {
  5017. "globals": {
  5018. "blocks": [
  5019. {
  5020. "name": "CCGlobal",
  5021. "defines": []
  5022. },
  5023. {
  5024. "name": "CCCamera",
  5025. "defines": []
  5026. },
  5027. {
  5028. "name": "CCShadow",
  5029. "defines": []
  5030. }
  5031. ],
  5032. "samplerTextures": [],
  5033. "buffers": [],
  5034. "images": []
  5035. },
  5036. "locals": {
  5037. "blocks": [
  5038. {
  5039. "name": "CCMorph",
  5040. "defines": [
  5041. "CC_USE_MORPH"
  5042. ]
  5043. },
  5044. {
  5045. "name": "CCSkinningTexture",
  5046. "defines": [
  5047. "CC_USE_SKINNING",
  5048. "CC_USE_BAKED_ANIMATION"
  5049. ]
  5050. },
  5051. {
  5052. "name": "CCSkinningAnimation",
  5053. "defines": [
  5054. "CC_USE_SKINNING",
  5055. "CC_USE_BAKED_ANIMATION"
  5056. ]
  5057. },
  5058. {
  5059. "name": "CCSkinning",
  5060. "defines": [
  5061. "CC_USE_SKINNING",
  5062. "!CC_USE_BAKED_ANIMATION",
  5063. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  5064. ]
  5065. },
  5066. {
  5067. "name": "CCLocal",
  5068. "defines": [
  5069. "!USE_INSTANCING"
  5070. ]
  5071. }
  5072. ],
  5073. "samplerTextures": [
  5074. {
  5075. "name": "cc_PositionDisplacements",
  5076. "defines": [
  5077. "CC_USE_MORPH",
  5078. "CC_MORPH_TARGET_HAS_POSITION"
  5079. ]
  5080. },
  5081. {
  5082. "name": "cc_NormalDisplacements",
  5083. "defines": [
  5084. "CC_USE_MORPH",
  5085. "CC_MORPH_TARGET_HAS_NORMAL"
  5086. ]
  5087. },
  5088. {
  5089. "name": "cc_TangentDisplacements",
  5090. "defines": [
  5091. "CC_USE_MORPH",
  5092. "CC_MORPH_TARGET_HAS_TANGENT"
  5093. ]
  5094. },
  5095. {
  5096. "name": "cc_jointTexture",
  5097. "defines": [
  5098. "CC_USE_SKINNING",
  5099. "CC_USE_BAKED_ANIMATION"
  5100. ]
  5101. },
  5102. {
  5103. "name": "cc_realtimeJoint",
  5104. "defines": [
  5105. "CC_USE_SKINNING",
  5106. "!CC_USE_BAKED_ANIMATION",
  5107. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  5108. ]
  5109. }
  5110. ],
  5111. "buffers": [],
  5112. "images": []
  5113. },
  5114. "statistics": {
  5115. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 90,
  5116. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 58
  5117. }
  5118. },
  5119. "defines": [
  5120. {
  5121. "name": "USE_INSTANCING",
  5122. "type": "boolean",
  5123. "defines": [],
  5124. "editor": {
  5125. "elevated": true
  5126. }
  5127. },
  5128. {
  5129. "name": "CC_USE_SKINNING",
  5130. "type": "boolean",
  5131. "defines": []
  5132. },
  5133. {
  5134. "name": "CC_USE_BAKED_ANIMATION",
  5135. "type": "boolean",
  5136. "defines": [
  5137. "USE_INSTANCING"
  5138. ]
  5139. },
  5140. {
  5141. "name": "CC_USE_LIGHTMAP",
  5142. "type": "boolean",
  5143. "defines": [
  5144. "USE_INSTANCING"
  5145. ]
  5146. },
  5147. {
  5148. "name": "CC_USE_REFLECTION_PROBE",
  5149. "type": "boolean",
  5150. "defines": [
  5151. "USE_INSTANCING"
  5152. ]
  5153. },
  5154. {
  5155. "name": "CC_RECEIVE_SHADOW",
  5156. "type": "boolean",
  5157. "defines": [
  5158. "USE_INSTANCING"
  5159. ]
  5160. },
  5161. {
  5162. "name": "CC_USE_LIGHT_PROBE",
  5163. "type": "boolean",
  5164. "defines": [
  5165. "USE_INSTANCING"
  5166. ]
  5167. },
  5168. {
  5169. "name": "CC_USE_MORPH",
  5170. "type": "boolean",
  5171. "defines": []
  5172. },
  5173. {
  5174. "name": "CC_MORPH_TARGET_COUNT",
  5175. "type": "number",
  5176. "defines": [
  5177. "CC_USE_MORPH"
  5178. ],
  5179. "range": [
  5180. 2,
  5181. 8
  5182. ]
  5183. },
  5184. {
  5185. "name": "CC_MORPH_TARGET_HAS_POSITION",
  5186. "type": "boolean",
  5187. "defines": [
  5188. "CC_USE_MORPH"
  5189. ]
  5190. },
  5191. {
  5192. "name": "CC_MORPH_TARGET_HAS_NORMAL",
  5193. "type": "boolean",
  5194. "defines": [
  5195. "CC_USE_MORPH"
  5196. ]
  5197. },
  5198. {
  5199. "name": "CC_MORPH_TARGET_HAS_TANGENT",
  5200. "type": "boolean",
  5201. "defines": [
  5202. "CC_USE_MORPH"
  5203. ]
  5204. },
  5205. {
  5206. "name": "CC_MORPH_PRECOMPUTED",
  5207. "type": "boolean",
  5208. "defines": [
  5209. "CC_USE_MORPH"
  5210. ]
  5211. },
  5212. {
  5213. "name": "CC_USE_REAL_TIME_JOINT_TEXTURE",
  5214. "type": "boolean",
  5215. "defines": [
  5216. "CC_USE_SKINNING",
  5217. "!CC_USE_BAKED_ANIMATION"
  5218. ]
  5219. }
  5220. ],
  5221. "name": "legacy/standard|planar-shadow-vs:vert|planar-shadow-fs:frag"
  5222. }
  5223. ],
  5224. "combinations": [],
  5225. "hideInEditor": false
  5226. }