release.json 180 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040
  1. [
  2. 1,
  3. 0,
  4. 0,
  5. [
  6. [
  7. "cc.EffectAsset",
  8. [
  9. "_name",
  10. "shaders",
  11. "techniques"
  12. ],
  13. 0
  14. ]
  15. ],
  16. [
  17. [
  18. 0,
  19. 0,
  20. 1,
  21. 2,
  22. 4
  23. ]
  24. ],
  25. [
  26. [
  27. 0,
  28. "legacy/terrain",
  29. [
  30. {
  31. "hash": 2756574121,
  32. "name": "legacy/terrain|terrain-vs|terrain-fs",
  33. "blocks": [
  34. {
  35. "name": "TexCoords",
  36. "stageFlags": 1,
  37. "binding": 0,
  38. "members": [
  39. {
  40. "name": "UVScale",
  41. "type": 16,
  42. "count": 1
  43. },
  44. {
  45. "name": "lightMapUVParam",
  46. "type": 16,
  47. "count": 1
  48. }
  49. ],
  50. "defines": []
  51. },
  52. {
  53. "name": "PbrParams",
  54. "stageFlags": 16,
  55. "binding": 1,
  56. "members": [
  57. {
  58. "name": "metallic",
  59. "type": 16,
  60. "count": 1
  61. },
  62. {
  63. "name": "roughness",
  64. "type": 16,
  65. "count": 1
  66. }
  67. ],
  68. "defines": []
  69. }
  70. ],
  71. "samplerTextures": [
  72. {
  73. "name": "weightMap",
  74. "type": 28,
  75. "count": 1,
  76. "stageFlags": 16,
  77. "binding": 2,
  78. "defines": []
  79. },
  80. {
  81. "name": "detailMap0",
  82. "type": 28,
  83. "count": 1,
  84. "stageFlags": 16,
  85. "binding": 3,
  86. "defines": []
  87. },
  88. {
  89. "name": "detailMap1",
  90. "type": 28,
  91. "count": 1,
  92. "stageFlags": 16,
  93. "binding": 4,
  94. "defines": []
  95. },
  96. {
  97. "name": "detailMap2",
  98. "type": 28,
  99. "count": 1,
  100. "stageFlags": 16,
  101. "binding": 5,
  102. "defines": []
  103. },
  104. {
  105. "name": "detailMap3",
  106. "type": 28,
  107. "count": 1,
  108. "stageFlags": 16,
  109. "binding": 6,
  110. "defines": []
  111. },
  112. {
  113. "name": "normalMap0",
  114. "type": 28,
  115. "count": 1,
  116. "stageFlags": 16,
  117. "binding": 7,
  118. "defines": []
  119. },
  120. {
  121. "name": "normalMap1",
  122. "type": 28,
  123. "count": 1,
  124. "stageFlags": 16,
  125. "binding": 8,
  126. "defines": []
  127. },
  128. {
  129. "name": "normalMap2",
  130. "type": 28,
  131. "count": 1,
  132. "stageFlags": 16,
  133. "binding": 9,
  134. "defines": []
  135. },
  136. {
  137. "name": "normalMap3",
  138. "type": 28,
  139. "count": 1,
  140. "stageFlags": 16,
  141. "binding": 10,
  142. "defines": []
  143. }
  144. ],
  145. "samplers": [],
  146. "textures": [],
  147. "buffers": [
  148. {
  149. "name": "b_ccLightsBuffer",
  150. "memoryAccess": 1,
  151. "stageFlags": 16,
  152. "binding": 11,
  153. "defines": [
  154. "CC_FORWARD_ADD",
  155. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  156. ]
  157. },
  158. {
  159. "name": "b_clusterLightIndicesBuffer",
  160. "memoryAccess": 1,
  161. "stageFlags": 16,
  162. "binding": 12,
  163. "defines": [
  164. "CC_FORWARD_ADD",
  165. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  166. ]
  167. },
  168. {
  169. "name": "b_clusterLightGridBuffer",
  170. "memoryAccess": 1,
  171. "stageFlags": 16,
  172. "binding": 13,
  173. "defines": [
  174. "CC_FORWARD_ADD",
  175. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  176. ]
  177. }
  178. ],
  179. "images": [],
  180. "subpassInputs": [],
  181. "attributes": [
  182. {
  183. "name": "a_position",
  184. "format": 32,
  185. "location": 0,
  186. "defines": []
  187. },
  188. {
  189. "name": "a_normal",
  190. "format": 32,
  191. "location": 1,
  192. "defines": []
  193. },
  194. {
  195. "name": "a_texCoord",
  196. "format": 21,
  197. "location": 2,
  198. "defines": []
  199. }
  200. ],
  201. "fragColors": [
  202. {
  203. "name": "fragColorX",
  204. "typename": "vec4",
  205. "type": 16,
  206. "count": 1,
  207. "stageFlags": 16,
  208. "location": 0,
  209. "defines": [
  210. "CC_FORWARD_ADD"
  211. ]
  212. },
  213. {
  214. "name": "albedoOut",
  215. "typename": "vec4",
  216. "type": 16,
  217. "count": 1,
  218. "stageFlags": 16,
  219. "location": 1,
  220. "defines": [
  221. "CC_FORWARD_ADD",
  222. "CC_PIPELINE_TYPE"
  223. ]
  224. },
  225. {
  226. "name": "emissiveOut",
  227. "typename": "vec4",
  228. "type": 16,
  229. "count": 1,
  230. "stageFlags": 16,
  231. "location": 2,
  232. "defines": [
  233. "CC_FORWARD_ADD",
  234. "CC_PIPELINE_TYPE"
  235. ]
  236. },
  237. {
  238. "name": "normalOut",
  239. "typename": "vec4",
  240. "type": 16,
  241. "count": 1,
  242. "stageFlags": 16,
  243. "location": 3,
  244. "defines": [
  245. "CC_FORWARD_ADD",
  246. "CC_PIPELINE_TYPE"
  247. ]
  248. }
  249. ],
  250. "descriptors": [
  251. {
  252. "rate": 0,
  253. "blocks": [
  254. {
  255. "name": "CCLocal",
  256. "stageFlags": 17,
  257. "tags": {
  258. "builtin": "local"
  259. },
  260. "members": [
  261. {
  262. "name": "cc_matWorld",
  263. "typename": "mat4",
  264. "type": 25,
  265. "count": 1,
  266. "precision": "highp "
  267. },
  268. {
  269. "name": "cc_matWorldIT",
  270. "typename": "mat4",
  271. "type": 25,
  272. "count": 1,
  273. "precision": "highp "
  274. },
  275. {
  276. "name": "cc_lightingMapUVParam",
  277. "typename": "vec4",
  278. "type": 16,
  279. "count": 1,
  280. "precision": "highp "
  281. },
  282. {
  283. "name": "cc_localShadowBias",
  284. "typename": "vec4",
  285. "type": 16,
  286. "count": 1,
  287. "precision": "highp "
  288. },
  289. {
  290. "name": "cc_reflectionProbeData1",
  291. "typename": "vec4",
  292. "type": 16,
  293. "count": 1,
  294. "precision": "highp "
  295. },
  296. {
  297. "name": "cc_reflectionProbeData2",
  298. "typename": "vec4",
  299. "type": 16,
  300. "count": 1,
  301. "precision": "highp "
  302. },
  303. {
  304. "name": "cc_reflectionProbeBlendData1",
  305. "typename": "vec4",
  306. "type": 16,
  307. "count": 1,
  308. "precision": "highp "
  309. },
  310. {
  311. "name": "cc_reflectionProbeBlendData2",
  312. "typename": "vec4",
  313. "type": 16,
  314. "count": 1,
  315. "precision": "highp "
  316. }
  317. ],
  318. "defines": []
  319. },
  320. {
  321. "name": "CCSH",
  322. "stageFlags": 16,
  323. "tags": {
  324. "builtin": "local"
  325. },
  326. "members": [
  327. {
  328. "name": "cc_sh_linear_const_r",
  329. "typename": "vec4",
  330. "type": 16,
  331. "count": 1
  332. },
  333. {
  334. "name": "cc_sh_linear_const_g",
  335. "typename": "vec4",
  336. "type": 16,
  337. "count": 1
  338. },
  339. {
  340. "name": "cc_sh_linear_const_b",
  341. "typename": "vec4",
  342. "type": 16,
  343. "count": 1
  344. },
  345. {
  346. "name": "cc_sh_quadratic_r",
  347. "typename": "vec4",
  348. "type": 16,
  349. "count": 1
  350. },
  351. {
  352. "name": "cc_sh_quadratic_g",
  353. "typename": "vec4",
  354. "type": 16,
  355. "count": 1
  356. },
  357. {
  358. "name": "cc_sh_quadratic_b",
  359. "typename": "vec4",
  360. "type": 16,
  361. "count": 1
  362. },
  363. {
  364. "name": "cc_sh_quadratic_a",
  365. "typename": "vec4",
  366. "type": 16,
  367. "count": 1
  368. }
  369. ],
  370. "defines": [
  371. "CC_USE_LIGHT_PROBE",
  372. "!USE_INSTANCING"
  373. ]
  374. },
  375. {
  376. "name": "CCForwardLight",
  377. "stageFlags": 16,
  378. "tags": {
  379. "builtin": "local"
  380. },
  381. "members": [
  382. {
  383. "name": "cc_lightPos",
  384. "typename": "vec4",
  385. "type": 16,
  386. "count": 0,
  387. "precision": "highp ",
  388. "isArray": true
  389. },
  390. {
  391. "name": "cc_lightColor",
  392. "typename": "vec4",
  393. "type": 16,
  394. "count": 0,
  395. "isArray": true
  396. },
  397. {
  398. "name": "cc_lightSizeRangeAngle",
  399. "typename": "vec4",
  400. "type": 16,
  401. "count": 0,
  402. "isArray": true
  403. },
  404. {
  405. "name": "cc_lightDir",
  406. "typename": "vec4",
  407. "type": 16,
  408. "count": 0,
  409. "isArray": true
  410. },
  411. {
  412. "name": "cc_lightBoundingSizeVS",
  413. "typename": "vec4",
  414. "type": 16,
  415. "count": 0,
  416. "isArray": true
  417. }
  418. ],
  419. "defines": [
  420. "CC_FORWARD_ADD",
  421. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  422. ]
  423. }
  424. ],
  425. "samplerTextures": [
  426. {
  427. "name": "cc_reflectionProbeCubemap",
  428. "typename": "samplerCube",
  429. "type": 31,
  430. "count": 1,
  431. "stageFlags": 16,
  432. "tags": {
  433. "builtin": "local"
  434. },
  435. "defines": [
  436. "CC_USE_REFLECTION_PROBE"
  437. ]
  438. },
  439. {
  440. "name": "cc_reflectionProbePlanarMap",
  441. "typename": "sampler2D",
  442. "type": 28,
  443. "count": 1,
  444. "stageFlags": 16,
  445. "tags": {
  446. "builtin": "local"
  447. },
  448. "defines": [
  449. "CC_USE_REFLECTION_PROBE"
  450. ]
  451. },
  452. {
  453. "name": "cc_reflectionProbeDataMap",
  454. "typename": "sampler2D",
  455. "type": 28,
  456. "count": 1,
  457. "stageFlags": 16,
  458. "tags": {
  459. "builtin": "local"
  460. },
  461. "defines": [
  462. "CC_USE_REFLECTION_PROBE"
  463. ]
  464. },
  465. {
  466. "name": "cc_reflectionProbeBlendCubemap",
  467. "typename": "samplerCube",
  468. "type": 31,
  469. "count": 1,
  470. "stageFlags": 16,
  471. "tags": {
  472. "builtin": "local"
  473. },
  474. "defines": [
  475. "CC_USE_REFLECTION_PROBE"
  476. ]
  477. },
  478. {
  479. "name": "cc_lightingMap",
  480. "typename": "sampler2D",
  481. "type": 28,
  482. "count": 1,
  483. "stageFlags": 16,
  484. "tags": {
  485. "builtin": "local"
  486. },
  487. "defines": [
  488. "CC_USE_LIGHTMAP",
  489. "!CC_FORWARD_ADD"
  490. ]
  491. }
  492. ],
  493. "samplers": [],
  494. "textures": [],
  495. "buffers": [],
  496. "images": [],
  497. "subpassInputs": []
  498. },
  499. {
  500. "rate": 1,
  501. "blocks": [
  502. {
  503. "name": "TexCoords",
  504. "stageFlags": 1,
  505. "binding": 0,
  506. "members": [
  507. {
  508. "name": "UVScale",
  509. "type": 16,
  510. "count": 1
  511. },
  512. {
  513. "name": "lightMapUVParam",
  514. "type": 16,
  515. "count": 1
  516. }
  517. ],
  518. "defines": []
  519. },
  520. {
  521. "name": "PbrParams",
  522. "stageFlags": 16,
  523. "binding": 1,
  524. "members": [
  525. {
  526. "name": "metallic",
  527. "type": 16,
  528. "count": 1
  529. },
  530. {
  531. "name": "roughness",
  532. "type": 16,
  533. "count": 1
  534. }
  535. ],
  536. "defines": []
  537. }
  538. ],
  539. "samplerTextures": [
  540. {
  541. "name": "weightMap",
  542. "type": 28,
  543. "count": 1,
  544. "stageFlags": 16,
  545. "binding": 2,
  546. "defines": []
  547. },
  548. {
  549. "name": "detailMap0",
  550. "type": 28,
  551. "count": 1,
  552. "stageFlags": 16,
  553. "binding": 3,
  554. "defines": []
  555. },
  556. {
  557. "name": "detailMap1",
  558. "type": 28,
  559. "count": 1,
  560. "stageFlags": 16,
  561. "binding": 4,
  562. "defines": []
  563. },
  564. {
  565. "name": "detailMap2",
  566. "type": 28,
  567. "count": 1,
  568. "stageFlags": 16,
  569. "binding": 5,
  570. "defines": []
  571. },
  572. {
  573. "name": "detailMap3",
  574. "type": 28,
  575. "count": 1,
  576. "stageFlags": 16,
  577. "binding": 6,
  578. "defines": []
  579. },
  580. {
  581. "name": "normalMap0",
  582. "type": 28,
  583. "count": 1,
  584. "stageFlags": 16,
  585. "binding": 7,
  586. "defines": []
  587. },
  588. {
  589. "name": "normalMap1",
  590. "type": 28,
  591. "count": 1,
  592. "stageFlags": 16,
  593. "binding": 8,
  594. "defines": []
  595. },
  596. {
  597. "name": "normalMap2",
  598. "type": 28,
  599. "count": 1,
  600. "stageFlags": 16,
  601. "binding": 9,
  602. "defines": []
  603. },
  604. {
  605. "name": "normalMap3",
  606. "type": 28,
  607. "count": 1,
  608. "stageFlags": 16,
  609. "binding": 10,
  610. "defines": []
  611. }
  612. ],
  613. "samplers": [],
  614. "textures": [],
  615. "buffers": [
  616. {
  617. "name": "b_ccLightsBuffer",
  618. "memoryAccess": 1,
  619. "stageFlags": 16,
  620. "binding": 11,
  621. "defines": [
  622. "CC_FORWARD_ADD",
  623. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  624. ]
  625. },
  626. {
  627. "name": "b_clusterLightIndicesBuffer",
  628. "memoryAccess": 1,
  629. "stageFlags": 16,
  630. "binding": 12,
  631. "defines": [
  632. "CC_FORWARD_ADD",
  633. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  634. ]
  635. },
  636. {
  637. "name": "b_clusterLightGridBuffer",
  638. "memoryAccess": 1,
  639. "stageFlags": 16,
  640. "binding": 13,
  641. "defines": [
  642. "CC_FORWARD_ADD",
  643. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  644. ]
  645. }
  646. ],
  647. "images": [],
  648. "subpassInputs": []
  649. },
  650. {
  651. "rate": 2,
  652. "blocks": [],
  653. "samplerTextures": [],
  654. "samplers": [],
  655. "textures": [],
  656. "buffers": [],
  657. "images": [],
  658. "subpassInputs": []
  659. },
  660. {
  661. "rate": 3,
  662. "blocks": [
  663. {
  664. "name": "CCGlobal",
  665. "stageFlags": 17,
  666. "tags": {
  667. "builtin": "global"
  668. },
  669. "members": [
  670. {
  671. "name": "cc_time",
  672. "typename": "vec4",
  673. "type": 16,
  674. "count": 1,
  675. "precision": "highp "
  676. },
  677. {
  678. "name": "cc_screenSize",
  679. "typename": "vec4",
  680. "type": 16,
  681. "count": 1,
  682. "precision": "mediump "
  683. },
  684. {
  685. "name": "cc_nativeSize",
  686. "typename": "vec4",
  687. "type": 16,
  688. "count": 1,
  689. "precision": "mediump "
  690. },
  691. {
  692. "name": "cc_probeInfo",
  693. "typename": "vec4",
  694. "type": 16,
  695. "count": 1,
  696. "precision": "mediump "
  697. },
  698. {
  699. "name": "cc_debug_view_mode",
  700. "typename": "vec4",
  701. "type": 16,
  702. "count": 1,
  703. "precision": "mediump "
  704. }
  705. ],
  706. "defines": []
  707. },
  708. {
  709. "name": "CCCamera",
  710. "stageFlags": 17,
  711. "tags": {
  712. "builtin": "global"
  713. },
  714. "members": [
  715. {
  716. "name": "cc_matView",
  717. "typename": "mat4",
  718. "type": 25,
  719. "count": 1,
  720. "precision": "highp "
  721. },
  722. {
  723. "name": "cc_matViewInv",
  724. "typename": "mat4",
  725. "type": 25,
  726. "count": 1,
  727. "precision": "highp "
  728. },
  729. {
  730. "name": "cc_matProj",
  731. "typename": "mat4",
  732. "type": 25,
  733. "count": 1,
  734. "precision": "highp "
  735. },
  736. {
  737. "name": "cc_matProjInv",
  738. "typename": "mat4",
  739. "type": 25,
  740. "count": 1,
  741. "precision": "highp "
  742. },
  743. {
  744. "name": "cc_matViewProj",
  745. "typename": "mat4",
  746. "type": 25,
  747. "count": 1,
  748. "precision": "highp "
  749. },
  750. {
  751. "name": "cc_matViewProjInv",
  752. "typename": "mat4",
  753. "type": 25,
  754. "count": 1,
  755. "precision": "highp "
  756. },
  757. {
  758. "name": "cc_cameraPos",
  759. "typename": "vec4",
  760. "type": 16,
  761. "count": 1,
  762. "precision": "highp "
  763. },
  764. {
  765. "name": "cc_surfaceTransform",
  766. "typename": "vec4",
  767. "type": 16,
  768. "count": 1,
  769. "precision": "mediump "
  770. },
  771. {
  772. "name": "cc_screenScale",
  773. "typename": "vec4",
  774. "type": 16,
  775. "count": 1,
  776. "precision": "mediump "
  777. },
  778. {
  779. "name": "cc_exposure",
  780. "typename": "vec4",
  781. "type": 16,
  782. "count": 1,
  783. "precision": "mediump "
  784. },
  785. {
  786. "name": "cc_mainLitDir",
  787. "typename": "vec4",
  788. "type": 16,
  789. "count": 1,
  790. "precision": "mediump "
  791. },
  792. {
  793. "name": "cc_mainLitColor",
  794. "typename": "vec4",
  795. "type": 16,
  796. "count": 1,
  797. "precision": "mediump "
  798. },
  799. {
  800. "name": "cc_ambientSky",
  801. "typename": "vec4",
  802. "type": 16,
  803. "count": 1,
  804. "precision": "mediump "
  805. },
  806. {
  807. "name": "cc_ambientGround",
  808. "typename": "vec4",
  809. "type": 16,
  810. "count": 1,
  811. "precision": "mediump "
  812. },
  813. {
  814. "name": "cc_fogColor",
  815. "typename": "vec4",
  816. "type": 16,
  817. "count": 1,
  818. "precision": "mediump "
  819. },
  820. {
  821. "name": "cc_fogBase",
  822. "typename": "vec4",
  823. "type": 16,
  824. "count": 1,
  825. "precision": "mediump "
  826. },
  827. {
  828. "name": "cc_fogAdd",
  829. "typename": "vec4",
  830. "type": 16,
  831. "count": 1,
  832. "precision": "mediump "
  833. },
  834. {
  835. "name": "cc_nearFar",
  836. "typename": "vec4",
  837. "type": 16,
  838. "count": 1,
  839. "precision": "mediump "
  840. },
  841. {
  842. "name": "cc_viewPort",
  843. "typename": "vec4",
  844. "type": 16,
  845. "count": 1,
  846. "precision": "mediump "
  847. }
  848. ],
  849. "defines": []
  850. },
  851. {
  852. "name": "CCShadow",
  853. "stageFlags": 17,
  854. "tags": {
  855. "builtin": "global"
  856. },
  857. "members": [
  858. {
  859. "name": "cc_matLightView",
  860. "typename": "mat4",
  861. "type": 25,
  862. "count": 1,
  863. "precision": "highp "
  864. },
  865. {
  866. "name": "cc_matLightViewProj",
  867. "typename": "mat4",
  868. "type": 25,
  869. "count": 1,
  870. "precision": "highp "
  871. },
  872. {
  873. "name": "cc_shadowInvProjDepthInfo",
  874. "typename": "vec4",
  875. "type": 16,
  876. "count": 1,
  877. "precision": "highp "
  878. },
  879. {
  880. "name": "cc_shadowProjDepthInfo",
  881. "typename": "vec4",
  882. "type": 16,
  883. "count": 1,
  884. "precision": "highp "
  885. },
  886. {
  887. "name": "cc_shadowProjInfo",
  888. "typename": "vec4",
  889. "type": 16,
  890. "count": 1,
  891. "precision": "highp "
  892. },
  893. {
  894. "name": "cc_shadowNFLSInfo",
  895. "typename": "vec4",
  896. "type": 16,
  897. "count": 1,
  898. "precision": "mediump "
  899. },
  900. {
  901. "name": "cc_shadowWHPBInfo",
  902. "typename": "vec4",
  903. "type": 16,
  904. "count": 1,
  905. "precision": "mediump "
  906. },
  907. {
  908. "name": "cc_shadowLPNNInfo",
  909. "typename": "vec4",
  910. "type": 16,
  911. "count": 1,
  912. "precision": "mediump "
  913. },
  914. {
  915. "name": "cc_shadowColor",
  916. "typename": "vec4",
  917. "type": 16,
  918. "count": 1,
  919. "precision": "lowp "
  920. },
  921. {
  922. "name": "cc_planarNDInfo",
  923. "typename": "vec4",
  924. "type": 16,
  925. "count": 1,
  926. "precision": "mediump "
  927. }
  928. ],
  929. "defines": []
  930. },
  931. {
  932. "name": "CCCSM",
  933. "stageFlags": 17,
  934. "tags": {
  935. "builtin": "global"
  936. },
  937. "members": [
  938. {
  939. "name": "cc_csmViewDir0",
  940. "typename": "vec4",
  941. "type": 16,
  942. "count": 4,
  943. "precision": "highp ",
  944. "isArray": true
  945. },
  946. {
  947. "name": "cc_csmViewDir1",
  948. "typename": "vec4",
  949. "type": 16,
  950. "count": 4,
  951. "precision": "highp ",
  952. "isArray": true
  953. },
  954. {
  955. "name": "cc_csmViewDir2",
  956. "typename": "vec4",
  957. "type": 16,
  958. "count": 4,
  959. "precision": "highp ",
  960. "isArray": true
  961. },
  962. {
  963. "name": "cc_csmAtlas",
  964. "typename": "vec4",
  965. "type": 16,
  966. "count": 4,
  967. "precision": "highp ",
  968. "isArray": true
  969. },
  970. {
  971. "name": "cc_matCSMViewProj",
  972. "typename": "mat4",
  973. "type": 25,
  974. "count": 4,
  975. "precision": "highp ",
  976. "isArray": true
  977. },
  978. {
  979. "name": "cc_csmProjDepthInfo",
  980. "typename": "vec4",
  981. "type": 16,
  982. "count": 4,
  983. "precision": "highp ",
  984. "isArray": true
  985. },
  986. {
  987. "name": "cc_csmProjInfo",
  988. "typename": "vec4",
  989. "type": 16,
  990. "count": 4,
  991. "precision": "highp ",
  992. "isArray": true
  993. },
  994. {
  995. "name": "cc_csmSplitsInfo",
  996. "typename": "vec4",
  997. "type": 16,
  998. "count": 1,
  999. "precision": "highp "
  1000. }
  1001. ],
  1002. "defines": [
  1003. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  1004. ]
  1005. }
  1006. ],
  1007. "samplerTextures": [
  1008. {
  1009. "name": "cc_shadowMap",
  1010. "typename": "sampler2D",
  1011. "type": 28,
  1012. "count": 1,
  1013. "precision": "highp ",
  1014. "stageFlags": 17,
  1015. "tags": {
  1016. "builtin": "global"
  1017. },
  1018. "defines": [
  1019. "CC_RECEIVE_SHADOW"
  1020. ]
  1021. },
  1022. {
  1023. "name": "cc_spotShadowMap",
  1024. "typename": "sampler2D",
  1025. "type": 28,
  1026. "count": 1,
  1027. "precision": "highp ",
  1028. "stageFlags": 17,
  1029. "tags": {
  1030. "builtin": "global"
  1031. },
  1032. "defines": [
  1033. "CC_RECEIVE_SHADOW"
  1034. ]
  1035. },
  1036. {
  1037. "name": "cc_environment",
  1038. "typename": "samplerCube",
  1039. "type": 31,
  1040. "count": 1,
  1041. "stageFlags": 16,
  1042. "tags": {
  1043. "builtin": "global"
  1044. },
  1045. "defines": []
  1046. },
  1047. {
  1048. "name": "cc_diffuseMap",
  1049. "typename": "samplerCube",
  1050. "type": 31,
  1051. "count": 1,
  1052. "stageFlags": 16,
  1053. "tags": {
  1054. "builtin": "global"
  1055. },
  1056. "defines": [
  1057. "CC_USE_IBL",
  1058. "CC_USE_DIFFUSEMAP"
  1059. ]
  1060. }
  1061. ],
  1062. "samplers": [],
  1063. "textures": [],
  1064. "buffers": [],
  1065. "images": [],
  1066. "subpassInputs": []
  1067. }
  1068. ],
  1069. "glsl1": {
  1070. "vert": "\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision mediump float;\nuniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\nuniform highp mat4 cc_matWorld;\n uniform highp vec4 cc_lightingMapUVParam;\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#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\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\n#endif\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\n#if CC_RECEIVE_SHADOW\n varying vec2 v_shadowBias;\n#endif\nvarying highp vec3 v_position;\nvarying mediump vec3 v_normal;\nvarying mediump vec2 uvw;\nvarying mediump vec2 uv0;\nvarying mediump vec2 uv1;\nvarying mediump vec2 uv2;\nvarying mediump vec2 uv3;\nvarying mediump vec3 luv;\nvarying mediump vec3 diffuse;\n uniform vec4 UVScale;\nvoid main () {\n vec3 worldPos;\n worldPos.x = cc_matWorld[3][0] + a_position.x;\n worldPos.y = cc_matWorld[3][1] + a_position.y;\n worldPos.z = cc_matWorld[3][2] + a_position.z;\n vec4 pos = vec4(worldPos, 1.0);\n pos = cc_matViewProj * pos;\n uvw = a_texCoord;\n uv0 = a_position.xz * UVScale.x;\n uv1 = a_position.xz * UVScale.y;\n uv2 = a_position.xz * UVScale.z;\n uv3 = a_position.xz * UVScale.w;\n #if CC_USE_LIGHTMAP\n luv.xy = cc_lightingMapUVParam.xy + a_texCoord * cc_lightingMapUVParam.z;\n luv.z = cc_lightingMapUVParam.w;\n #endif\n v_position = worldPos;\n v_normal = a_normal;\n CC_TRANSFER_FOG(vec4(worldPos, 1.0));\n #if CC_RECEIVE_SHADOW\n v_shadowBias = vec2(0.0, 0.0);\n #endif\n v_shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n gl_Position = pos;\n}",
  1071. "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#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 vec4 shadowTexure(highp sampler2D shadowMap, vec2 coord) {\n #if defined(CC_USE_WGPU)\n return texture2DLod(shadowMap, coord, 0.0);\n #else\n return texture2D(shadowMap, coord);\n #endif\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(shadowTexure(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, shadowTexure(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(shadowTexure(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(shadowTexure(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(shadowTexure(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(shadowTexure(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, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(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(shadowTexure(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(shadowTexure(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(shadowTexure(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(shadowTexure(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(shadowTexure(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(shadowTexure(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(shadowTexure(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(shadowTexure(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(shadowTexure(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, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, shadowTexure(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(shadowTexure(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, shadowTexure(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}\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}\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 highp vec3 v_position;\nvarying mediump vec3 v_normal;\n#if CC_RECEIVE_SHADOW\n varying vec2 v_shadowBias;\n#endif\nvarying mediump vec2 uvw;\nvarying mediump vec2 uv0;\nvarying mediump vec2 uv1;\nvarying mediump vec2 uv2;\nvarying mediump vec2 uv3;\nvarying mediump vec3 diffuse;\nvarying mediump vec3 luv;\n uniform vec4 metallic;\n uniform vec4 roughness;\nuniform sampler2D weightMap;\nuniform sampler2D detailMap0;\nuniform sampler2D detailMap1;\nuniform sampler2D detailMap2;\nuniform sampler2D detailMap3;\nuniform sampler2D normalMap0;\nuniform sampler2D normalMap1;\nuniform sampler2D normalMap2;\nuniform sampler2D normalMap3;\nvoid surf (out StandardSurface s) {\n #if LAYERS > 1\n vec4 w = texture2D(weightMap, uvw);\n #endif\n vec4 baseColor = vec4(0, 0, 0, 0);\n #if LAYERS == 1\n baseColor = texture2D(detailMap0, uv0);\n #elif LAYERS == 2\n baseColor += texture2D(detailMap0, uv0) * w.r;\n baseColor += texture2D(detailMap1, uv1) * w.g;\n #elif LAYERS == 3\n baseColor += texture2D(detailMap0, uv0) * w.r;\n baseColor += texture2D(detailMap1, uv1) * w.g;\n baseColor += texture2D(detailMap2, uv2) * w.b;\n #elif LAYERS == 4\n baseColor += texture2D(detailMap0, uv0) * w.r;\n baseColor += texture2D(detailMap1, uv1) * w.g;\n baseColor += texture2D(detailMap2, uv2) * w.b;\n baseColor += texture2D(detailMap3, uv3) * w.a;\n #else\n baseColor = texture2D(detailMap0, uv0);\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 #if USE_NORMALMAP\n vec4 baseNormal = vec4(0, 0, 0, 0);\n #if LAYERS == 1\n baseNormal = texture2D(normalMap0, uv0);\n #elif LAYERS == 2\n baseNormal += texture2D(normalMap0, uv0) * w.r;\n baseNormal += texture2D(normalMap1, uv1) * w.g;\n #elif LAYERS == 3\n baseNormal += texture2D(normalMap0, uv0) * w.r;\n baseNormal += texture2D(normalMap1, uv1) * w.g;\n baseNormal += texture2D(normalMap2, uv2) * w.b;\n #elif LAYERS == 4\n baseNormal += texture2D(normalMap0, uv0) * w.r;\n baseNormal += texture2D(normalMap1, uv1) * w.g;\n baseNormal += texture2D(normalMap2, uv2) * w.b;\n baseNormal += texture2D(normalMap3, uv3) * w.a;\n #else\n baseNormal = texture2D(normalMap0, uv0);\n #endif\n vec3 tangent = vec3(1.0, 0.0, 0.0);\n vec3 binormal = vec3(0.0, 0.0, 1.0);\n binormal = cross(tangent, v_normal);\n tangent = cross(v_normal, binormal);\n vec3 nmmp = baseNormal.xyz - vec3(0.5);\n s.normal =\n nmmp.x * normalize(tangent) +\n nmmp.y * normalize(binormal) +\n nmmp.z * normalize(v_normal);\n #else\n s.normal = v_normal;\n #endif\n #if CC_RECEIVE_SHADOW\n s.shadowBias = v_shadowBias;\n #endif\n s.albedo = vec4(SRGBToLinear(baseColor.rgb), 1.0);\n s.occlusion = 1.0;\n #if USE_PBR\n s.roughness = 0.0;\n #if LAYERS == 1\n s.roughness = roughness.x;\n #elif LAYERS == 2\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n #elif LAYERS == 3\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n s.roughness += roughness.z * w.b;\n #elif LAYERS == 4\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n s.roughness += roughness.z * w.b;\n s.roughness += roughness.w * w.a;\n #else\n s.roughness = 1.0;\n #endif\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #if LAYERS == 1\n s.specularIntensity = 0.5;\n s.metallic = metallic.x;\n #elif LAYERS == 2\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n #elif LAYERS == 3\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n s.metallic += metallic.z * w.b;\n #elif LAYERS == 4\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n s.metallic += metallic.z * w.b;\n s.metallic += metallic.w * w.a;\n #else\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #endif\n #else\n s.roughness = 1.0;\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #endif\n s.emissive = vec3(0.0, 0.0, 0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n SampleAndDecodeLightMapColor(s.lightmap.rgb, s.lightmap.a, s.lightmap_test, cc_lightingMap, luv.xy, luv.z, s.normal);\n #endif\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 strength = clamp(cc_lightBoundingSizeVS[i].w, 0.0, 1.0);\n float litAngleScale = 1.0 / max(0.001, mix(cosInner, 1.0, strength) - 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"
  1072. },
  1073. "builtins": {
  1074. "globals": {
  1075. "blocks": [
  1076. {
  1077. "name": "CCGlobal",
  1078. "defines": []
  1079. },
  1080. {
  1081. "name": "CCCamera",
  1082. "defines": []
  1083. },
  1084. {
  1085. "name": "CCShadow",
  1086. "defines": []
  1087. },
  1088. {
  1089. "name": "CCCSM",
  1090. "defines": [
  1091. "CC_SUPPORT_CASCADED_SHADOW_MAP"
  1092. ]
  1093. }
  1094. ],
  1095. "samplerTextures": [
  1096. {
  1097. "name": "cc_shadowMap",
  1098. "defines": [
  1099. "CC_RECEIVE_SHADOW"
  1100. ]
  1101. },
  1102. {
  1103. "name": "cc_spotShadowMap",
  1104. "defines": [
  1105. "CC_RECEIVE_SHADOW"
  1106. ]
  1107. },
  1108. {
  1109. "name": "cc_environment",
  1110. "defines": []
  1111. },
  1112. {
  1113. "name": "cc_diffuseMap",
  1114. "defines": [
  1115. "CC_USE_IBL",
  1116. "CC_USE_DIFFUSEMAP"
  1117. ]
  1118. }
  1119. ],
  1120. "buffers": [],
  1121. "images": []
  1122. },
  1123. "locals": {
  1124. "blocks": [
  1125. {
  1126. "name": "CCLocal",
  1127. "defines": []
  1128. },
  1129. {
  1130. "name": "CCSH",
  1131. "defines": [
  1132. "CC_USE_LIGHT_PROBE",
  1133. "!USE_INSTANCING"
  1134. ]
  1135. },
  1136. {
  1137. "name": "CCForwardLight",
  1138. "defines": [
  1139. "CC_FORWARD_ADD",
  1140. "CC_ENABLE_CLUSTERED_LIGHT_CULLING"
  1141. ]
  1142. }
  1143. ],
  1144. "samplerTextures": [
  1145. {
  1146. "name": "cc_reflectionProbeCubemap",
  1147. "defines": [
  1148. "CC_USE_REFLECTION_PROBE"
  1149. ]
  1150. },
  1151. {
  1152. "name": "cc_reflectionProbePlanarMap",
  1153. "defines": [
  1154. "CC_USE_REFLECTION_PROBE"
  1155. ]
  1156. },
  1157. {
  1158. "name": "cc_reflectionProbeDataMap",
  1159. "defines": [
  1160. "CC_USE_REFLECTION_PROBE"
  1161. ]
  1162. },
  1163. {
  1164. "name": "cc_reflectionProbeBlendCubemap",
  1165. "defines": [
  1166. "CC_USE_REFLECTION_PROBE"
  1167. ]
  1168. },
  1169. {
  1170. "name": "cc_lightingMap",
  1171. "defines": [
  1172. "CC_USE_LIGHTMAP",
  1173. "!CC_FORWARD_ADD"
  1174. ]
  1175. }
  1176. ],
  1177. "buffers": [],
  1178. "images": []
  1179. },
  1180. "statistics": {
  1181. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 115,
  1182. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 122
  1183. }
  1184. },
  1185. "defines": [
  1186. {
  1187. "name": "CC_USE_FOG",
  1188. "type": "number",
  1189. "range": [
  1190. 0,
  1191. 4
  1192. ]
  1193. },
  1194. {
  1195. "name": "CC_USE_ACCURATE_FOG",
  1196. "type": "boolean"
  1197. },
  1198. {
  1199. "name": "CC_SUPPORT_CASCADED_SHADOW_MAP",
  1200. "type": "boolean"
  1201. },
  1202. {
  1203. "name": "CC_RECEIVE_SHADOW",
  1204. "type": "boolean"
  1205. },
  1206. {
  1207. "name": "CC_USE_LIGHTMAP",
  1208. "type": "number",
  1209. "range": [
  1210. 0,
  1211. 3
  1212. ]
  1213. },
  1214. {
  1215. "name": "CC_USE_DEBUG_VIEW",
  1216. "type": "number",
  1217. "range": [
  1218. 0,
  1219. 3
  1220. ]
  1221. },
  1222. {
  1223. "name": "CC_SURFACES_ENABLE_DEBUG_VIEW",
  1224. "type": "boolean"
  1225. },
  1226. {
  1227. "name": "CC_SHADOWMAP_FORMAT",
  1228. "type": "number",
  1229. "range": [
  1230. 0,
  1231. 3
  1232. ]
  1233. },
  1234. {
  1235. "name": "CC_SHADOWMAP_USE_LINEAR_DEPTH",
  1236. "type": "boolean"
  1237. },
  1238. {
  1239. "name": "CC_DIR_SHADOW_PCF_TYPE",
  1240. "type": "number",
  1241. "range": [
  1242. 0,
  1243. 3
  1244. ]
  1245. },
  1246. {
  1247. "name": "CC_CASCADED_LAYERS_TRANSITION",
  1248. "type": "boolean"
  1249. },
  1250. {
  1251. "name": "CC_USE_IBL",
  1252. "type": "number",
  1253. "range": [
  1254. 0,
  1255. 2
  1256. ]
  1257. },
  1258. {
  1259. "name": "CC_USE_DIFFUSEMAP",
  1260. "type": "number",
  1261. "range": [
  1262. 0,
  1263. 2
  1264. ]
  1265. },
  1266. {
  1267. "name": "CC_USE_REFLECTION_PROBE",
  1268. "type": "number",
  1269. "range": [
  1270. 0,
  1271. 3
  1272. ]
  1273. },
  1274. {
  1275. "name": "USE_INSTANCING",
  1276. "type": "boolean"
  1277. },
  1278. {
  1279. "name": "CC_USE_LIGHT_PROBE",
  1280. "type": "boolean",
  1281. "default": 0
  1282. },
  1283. {
  1284. "name": "CC_USE_HDR",
  1285. "type": "boolean"
  1286. },
  1287. {
  1288. "name": "USE_REFLECTION_DENOISE",
  1289. "type": "boolean"
  1290. },
  1291. {
  1292. "name": "CC_SHADOW_TYPE",
  1293. "type": "number",
  1294. "range": [
  1295. 0,
  1296. 3
  1297. ]
  1298. },
  1299. {
  1300. "name": "CC_DIR_LIGHT_SHADOW_TYPE",
  1301. "type": "number",
  1302. "range": [
  1303. 0,
  1304. 3
  1305. ]
  1306. },
  1307. {
  1308. "name": "CC_FORWARD_ADD",
  1309. "type": "boolean"
  1310. },
  1311. {
  1312. "name": "CC_DISABLE_DIRECTIONAL_LIGHT",
  1313. "type": "boolean"
  1314. },
  1315. {
  1316. "name": "CC_IBL_CONVOLUTED",
  1317. "type": "boolean"
  1318. },
  1319. {
  1320. "name": "CC_USE_RGBE_OUTPUT",
  1321. "type": "boolean"
  1322. },
  1323. {
  1324. "name": "CC_USE_FLOAT_OUTPUT",
  1325. "type": "boolean"
  1326. },
  1327. {
  1328. "name": "CC_TONE_MAPPING_TYPE",
  1329. "type": "number",
  1330. "range": [
  1331. 0,
  1332. 3
  1333. ]
  1334. },
  1335. {
  1336. "name": "HDR_TONE_MAPPING_ACES",
  1337. "type": "boolean"
  1338. },
  1339. {
  1340. "name": "CC_LIGHT_MAP_VERSION",
  1341. "type": "number",
  1342. "range": [
  1343. 0,
  1344. 3
  1345. ]
  1346. },
  1347. {
  1348. "name": "LAYERS",
  1349. "type": "number",
  1350. "range": [
  1351. 0,
  1352. 4
  1353. ]
  1354. },
  1355. {
  1356. "name": "USE_NORMALMAP",
  1357. "type": "boolean"
  1358. },
  1359. {
  1360. "name": "USE_PBR",
  1361. "type": "boolean"
  1362. },
  1363. {
  1364. "name": "CC_PIPELINE_TYPE",
  1365. "type": "number",
  1366. "range": [
  1367. 0,
  1368. 1
  1369. ]
  1370. },
  1371. {
  1372. "name": "CC_FORCE_FORWARD_SHADING",
  1373. "type": "boolean"
  1374. },
  1375. {
  1376. "name": "CC_ENABLE_CLUSTERED_LIGHT_CULLING",
  1377. "type": "number",
  1378. "range": [
  1379. 0,
  1380. 3
  1381. ]
  1382. }
  1383. ]
  1384. },
  1385. {
  1386. "hash": 816809058,
  1387. "name": "legacy/terrain|shadow-caster-vs:vert|shadow-caster-fs:frag",
  1388. "blocks": [],
  1389. "samplerTextures": [],
  1390. "samplers": [],
  1391. "textures": [],
  1392. "buffers": [],
  1393. "images": [],
  1394. "subpassInputs": [],
  1395. "attributes": [
  1396. {
  1397. "name": "a_position",
  1398. "format": 32,
  1399. "location": 0,
  1400. "defines": []
  1401. },
  1402. {
  1403. "name": "a_normal",
  1404. "format": 32,
  1405. "location": 1,
  1406. "defines": []
  1407. },
  1408. {
  1409. "name": "a_texCoord",
  1410. "format": 21,
  1411. "location": 2,
  1412. "defines": []
  1413. }
  1414. ],
  1415. "fragColors": [
  1416. {
  1417. "name": "cc_FragColor",
  1418. "typename": "vec4",
  1419. "type": 16,
  1420. "count": 1,
  1421. "stageFlags": 16,
  1422. "location": 0,
  1423. "defines": []
  1424. }
  1425. ],
  1426. "descriptors": [
  1427. {
  1428. "rate": 0,
  1429. "blocks": [
  1430. {
  1431. "name": "CCLocal",
  1432. "stageFlags": 1,
  1433. "tags": {
  1434. "builtin": "local"
  1435. },
  1436. "members": [
  1437. {
  1438. "name": "cc_matWorld",
  1439. "typename": "mat4",
  1440. "type": 25,
  1441. "count": 1,
  1442. "precision": "highp "
  1443. },
  1444. {
  1445. "name": "cc_matWorldIT",
  1446. "typename": "mat4",
  1447. "type": 25,
  1448. "count": 1,
  1449. "precision": "highp "
  1450. },
  1451. {
  1452. "name": "cc_lightingMapUVParam",
  1453. "typename": "vec4",
  1454. "type": 16,
  1455. "count": 1,
  1456. "precision": "highp "
  1457. },
  1458. {
  1459. "name": "cc_localShadowBias",
  1460. "typename": "vec4",
  1461. "type": 16,
  1462. "count": 1,
  1463. "precision": "highp "
  1464. },
  1465. {
  1466. "name": "cc_reflectionProbeData1",
  1467. "typename": "vec4",
  1468. "type": 16,
  1469. "count": 1,
  1470. "precision": "highp "
  1471. },
  1472. {
  1473. "name": "cc_reflectionProbeData2",
  1474. "typename": "vec4",
  1475. "type": 16,
  1476. "count": 1,
  1477. "precision": "highp "
  1478. },
  1479. {
  1480. "name": "cc_reflectionProbeBlendData1",
  1481. "typename": "vec4",
  1482. "type": 16,
  1483. "count": 1,
  1484. "precision": "highp "
  1485. },
  1486. {
  1487. "name": "cc_reflectionProbeBlendData2",
  1488. "typename": "vec4",
  1489. "type": 16,
  1490. "count": 1,
  1491. "precision": "highp "
  1492. }
  1493. ],
  1494. "defines": []
  1495. }
  1496. ],
  1497. "samplerTextures": [],
  1498. "samplers": [],
  1499. "textures": [],
  1500. "buffers": [],
  1501. "images": [],
  1502. "subpassInputs": []
  1503. },
  1504. {
  1505. "rate": 1,
  1506. "blocks": [],
  1507. "samplerTextures": [],
  1508. "samplers": [],
  1509. "textures": [],
  1510. "buffers": [],
  1511. "images": [],
  1512. "subpassInputs": []
  1513. },
  1514. {
  1515. "rate": 2,
  1516. "blocks": [],
  1517. "samplerTextures": [],
  1518. "samplers": [],
  1519. "textures": [],
  1520. "buffers": [],
  1521. "images": [],
  1522. "subpassInputs": []
  1523. },
  1524. {
  1525. "rate": 3,
  1526. "blocks": [
  1527. {
  1528. "name": "CCGlobal",
  1529. "stageFlags": 1,
  1530. "tags": {
  1531. "builtin": "global"
  1532. },
  1533. "members": [
  1534. {
  1535. "name": "cc_time",
  1536. "typename": "vec4",
  1537. "type": 16,
  1538. "count": 1,
  1539. "precision": "highp "
  1540. },
  1541. {
  1542. "name": "cc_screenSize",
  1543. "typename": "vec4",
  1544. "type": 16,
  1545. "count": 1,
  1546. "precision": "mediump "
  1547. },
  1548. {
  1549. "name": "cc_nativeSize",
  1550. "typename": "vec4",
  1551. "type": 16,
  1552. "count": 1,
  1553. "precision": "mediump "
  1554. },
  1555. {
  1556. "name": "cc_probeInfo",
  1557. "typename": "vec4",
  1558. "type": 16,
  1559. "count": 1,
  1560. "precision": "mediump "
  1561. },
  1562. {
  1563. "name": "cc_debug_view_mode",
  1564. "typename": "vec4",
  1565. "type": 16,
  1566. "count": 1,
  1567. "precision": "mediump "
  1568. }
  1569. ],
  1570. "defines": []
  1571. },
  1572. {
  1573. "name": "CCCamera",
  1574. "stageFlags": 1,
  1575. "tags": {
  1576. "builtin": "global"
  1577. },
  1578. "members": [
  1579. {
  1580. "name": "cc_matView",
  1581. "typename": "mat4",
  1582. "type": 25,
  1583. "count": 1,
  1584. "precision": "highp "
  1585. },
  1586. {
  1587. "name": "cc_matViewInv",
  1588. "typename": "mat4",
  1589. "type": 25,
  1590. "count": 1,
  1591. "precision": "highp "
  1592. },
  1593. {
  1594. "name": "cc_matProj",
  1595. "typename": "mat4",
  1596. "type": 25,
  1597. "count": 1,
  1598. "precision": "highp "
  1599. },
  1600. {
  1601. "name": "cc_matProjInv",
  1602. "typename": "mat4",
  1603. "type": 25,
  1604. "count": 1,
  1605. "precision": "highp "
  1606. },
  1607. {
  1608. "name": "cc_matViewProj",
  1609. "typename": "mat4",
  1610. "type": 25,
  1611. "count": 1,
  1612. "precision": "highp "
  1613. },
  1614. {
  1615. "name": "cc_matViewProjInv",
  1616. "typename": "mat4",
  1617. "type": 25,
  1618. "count": 1,
  1619. "precision": "highp "
  1620. },
  1621. {
  1622. "name": "cc_cameraPos",
  1623. "typename": "vec4",
  1624. "type": 16,
  1625. "count": 1,
  1626. "precision": "highp "
  1627. },
  1628. {
  1629. "name": "cc_surfaceTransform",
  1630. "typename": "vec4",
  1631. "type": 16,
  1632. "count": 1,
  1633. "precision": "mediump "
  1634. },
  1635. {
  1636. "name": "cc_screenScale",
  1637. "typename": "vec4",
  1638. "type": 16,
  1639. "count": 1,
  1640. "precision": "mediump "
  1641. },
  1642. {
  1643. "name": "cc_exposure",
  1644. "typename": "vec4",
  1645. "type": 16,
  1646. "count": 1,
  1647. "precision": "mediump "
  1648. },
  1649. {
  1650. "name": "cc_mainLitDir",
  1651. "typename": "vec4",
  1652. "type": 16,
  1653. "count": 1,
  1654. "precision": "mediump "
  1655. },
  1656. {
  1657. "name": "cc_mainLitColor",
  1658. "typename": "vec4",
  1659. "type": 16,
  1660. "count": 1,
  1661. "precision": "mediump "
  1662. },
  1663. {
  1664. "name": "cc_ambientSky",
  1665. "typename": "vec4",
  1666. "type": 16,
  1667. "count": 1,
  1668. "precision": "mediump "
  1669. },
  1670. {
  1671. "name": "cc_ambientGround",
  1672. "typename": "vec4",
  1673. "type": 16,
  1674. "count": 1,
  1675. "precision": "mediump "
  1676. },
  1677. {
  1678. "name": "cc_fogColor",
  1679. "typename": "vec4",
  1680. "type": 16,
  1681. "count": 1,
  1682. "precision": "mediump "
  1683. },
  1684. {
  1685. "name": "cc_fogBase",
  1686. "typename": "vec4",
  1687. "type": 16,
  1688. "count": 1,
  1689. "precision": "mediump "
  1690. },
  1691. {
  1692. "name": "cc_fogAdd",
  1693. "typename": "vec4",
  1694. "type": 16,
  1695. "count": 1,
  1696. "precision": "mediump "
  1697. },
  1698. {
  1699. "name": "cc_nearFar",
  1700. "typename": "vec4",
  1701. "type": 16,
  1702. "count": 1,
  1703. "precision": "mediump "
  1704. },
  1705. {
  1706. "name": "cc_viewPort",
  1707. "typename": "vec4",
  1708. "type": 16,
  1709. "count": 1,
  1710. "precision": "mediump "
  1711. }
  1712. ],
  1713. "defines": []
  1714. },
  1715. {
  1716. "name": "CCShadow",
  1717. "stageFlags": 1,
  1718. "tags": {
  1719. "builtin": "global"
  1720. },
  1721. "members": [
  1722. {
  1723. "name": "cc_matLightView",
  1724. "typename": "mat4",
  1725. "type": 25,
  1726. "count": 1,
  1727. "precision": "highp "
  1728. },
  1729. {
  1730. "name": "cc_matLightViewProj",
  1731. "typename": "mat4",
  1732. "type": 25,
  1733. "count": 1,
  1734. "precision": "highp "
  1735. },
  1736. {
  1737. "name": "cc_shadowInvProjDepthInfo",
  1738. "typename": "vec4",
  1739. "type": 16,
  1740. "count": 1,
  1741. "precision": "highp "
  1742. },
  1743. {
  1744. "name": "cc_shadowProjDepthInfo",
  1745. "typename": "vec4",
  1746. "type": 16,
  1747. "count": 1,
  1748. "precision": "highp "
  1749. },
  1750. {
  1751. "name": "cc_shadowProjInfo",
  1752. "typename": "vec4",
  1753. "type": 16,
  1754. "count": 1,
  1755. "precision": "highp "
  1756. },
  1757. {
  1758. "name": "cc_shadowNFLSInfo",
  1759. "typename": "vec4",
  1760. "type": 16,
  1761. "count": 1,
  1762. "precision": "mediump "
  1763. },
  1764. {
  1765. "name": "cc_shadowWHPBInfo",
  1766. "typename": "vec4",
  1767. "type": 16,
  1768. "count": 1,
  1769. "precision": "mediump "
  1770. },
  1771. {
  1772. "name": "cc_shadowLPNNInfo",
  1773. "typename": "vec4",
  1774. "type": 16,
  1775. "count": 1,
  1776. "precision": "mediump "
  1777. },
  1778. {
  1779. "name": "cc_shadowColor",
  1780. "typename": "vec4",
  1781. "type": 16,
  1782. "count": 1,
  1783. "precision": "lowp "
  1784. },
  1785. {
  1786. "name": "cc_planarNDInfo",
  1787. "typename": "vec4",
  1788. "type": 16,
  1789. "count": 1,
  1790. "precision": "mediump "
  1791. }
  1792. ],
  1793. "defines": []
  1794. }
  1795. ],
  1796. "samplerTextures": [],
  1797. "samplers": [],
  1798. "textures": [],
  1799. "buffers": [],
  1800. "images": [],
  1801. "subpassInputs": []
  1802. }
  1803. ],
  1804. "glsl1": {
  1805. "vert": "\nprecision highp float;\nuniform highp mat4 cc_matWorld;\nuniform highp mat4 cc_matLightViewProj;\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nvarying highp vec2 v_clip_depth;\nvec4 vert () {\n vec4 worldPos;\n worldPos.x = cc_matWorld[3][0] + a_position.x;\n worldPos.y = cc_matWorld[3][1] + a_position.y;\n worldPos.z = cc_matWorld[3][2] + a_position.z;\n worldPos.w = 1.0;\n vec4 clipPos = cc_matLightViewProj * worldPos;\n v_clip_depth = clipPos.zw;\n return clipPos;\n}\nvoid main() { gl_Position = vert(); }",
  1806. "frag": "\nprecision highp float;\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)\nvarying highp vec2 v_clip_depth;\nvec4 frag () {\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\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(); }"
  1807. },
  1808. "builtins": {
  1809. "globals": {
  1810. "blocks": [
  1811. {
  1812. "name": "CCGlobal",
  1813. "defines": []
  1814. },
  1815. {
  1816. "name": "CCCamera",
  1817. "defines": []
  1818. },
  1819. {
  1820. "name": "CCShadow",
  1821. "defines": []
  1822. }
  1823. ],
  1824. "samplerTextures": [],
  1825. "buffers": [],
  1826. "images": []
  1827. },
  1828. "locals": {
  1829. "blocks": [
  1830. {
  1831. "name": "CCLocal",
  1832. "defines": []
  1833. }
  1834. ],
  1835. "samplerTextures": [],
  1836. "buffers": [],
  1837. "images": []
  1838. },
  1839. "statistics": {
  1840. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 72,
  1841. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 0
  1842. }
  1843. },
  1844. "defines": [
  1845. {
  1846. "name": "CC_SHADOWMAP_FORMAT",
  1847. "type": "number",
  1848. "range": [
  1849. 0,
  1850. 3
  1851. ]
  1852. }
  1853. ]
  1854. }
  1855. ],
  1856. [
  1857. {
  1858. "name": "opaque",
  1859. "passes": [
  1860. {
  1861. "program": "legacy/terrain|terrain-vs|terrain-fs",
  1862. "properties": {
  1863. "UVScale": {
  1864. "type": 16,
  1865. "value": [
  1866. 1,
  1867. 1,
  1868. 1,
  1869. 1
  1870. ]
  1871. },
  1872. "metallic": {
  1873. "type": 16,
  1874. "value": [
  1875. 0,
  1876. 0,
  1877. 0,
  1878. 0
  1879. ]
  1880. },
  1881. "roughness": {
  1882. "type": 16,
  1883. "value": [
  1884. 1,
  1885. 1,
  1886. 1,
  1887. 1
  1888. ]
  1889. },
  1890. "weightMap": {
  1891. "value": "black",
  1892. "type": 28
  1893. },
  1894. "detailMap0": {
  1895. "value": "grey",
  1896. "type": 28
  1897. },
  1898. "detailMap1": {
  1899. "value": "grey",
  1900. "type": 28
  1901. },
  1902. "detailMap2": {
  1903. "value": "grey",
  1904. "type": 28
  1905. },
  1906. "detailMap3": {
  1907. "value": "grey",
  1908. "type": 28
  1909. },
  1910. "normalMap0": {
  1911. "value": "normal",
  1912. "type": 28
  1913. },
  1914. "normalMap1": {
  1915. "value": "normal",
  1916. "type": 28
  1917. },
  1918. "normalMap2": {
  1919. "value": "normal",
  1920. "type": 28
  1921. },
  1922. "normalMap3": {
  1923. "value": "normal",
  1924. "type": 28
  1925. }
  1926. }
  1927. },
  1928. {
  1929. "phase": "forward-add",
  1930. "propertyIndex": 0,
  1931. "program": "legacy/terrain|terrain-vs|terrain-fs",
  1932. "embeddedMacros": {
  1933. "CC_FORWARD_ADD": true
  1934. },
  1935. "blendState": {
  1936. "targets": [
  1937. {
  1938. "blend": true,
  1939. "blendSrc": 1,
  1940. "blendDst": 1,
  1941. "blendSrcAlpha": 0,
  1942. "blendDstAlpha": 1
  1943. }
  1944. ]
  1945. },
  1946. "depthStencilState": {
  1947. "depthFunc": 2,
  1948. "depthTest": true,
  1949. "depthWrite": false
  1950. },
  1951. "properties": {
  1952. "UVScale": {
  1953. "type": 16,
  1954. "value": [
  1955. 1,
  1956. 1,
  1957. 1,
  1958. 1
  1959. ]
  1960. },
  1961. "metallic": {
  1962. "type": 16,
  1963. "value": [
  1964. 0,
  1965. 0,
  1966. 0,
  1967. 0
  1968. ]
  1969. },
  1970. "roughness": {
  1971. "type": 16,
  1972. "value": [
  1973. 1,
  1974. 1,
  1975. 1,
  1976. 1
  1977. ]
  1978. },
  1979. "weightMap": {
  1980. "value": "black",
  1981. "type": 28
  1982. },
  1983. "detailMap0": {
  1984. "value": "grey",
  1985. "type": 28
  1986. },
  1987. "detailMap1": {
  1988. "value": "grey",
  1989. "type": 28
  1990. },
  1991. "detailMap2": {
  1992. "value": "grey",
  1993. "type": 28
  1994. },
  1995. "detailMap3": {
  1996. "value": "grey",
  1997. "type": 28
  1998. },
  1999. "normalMap0": {
  2000. "value": "normal",
  2001. "type": 28
  2002. },
  2003. "normalMap1": {
  2004. "value": "normal",
  2005. "type": 28
  2006. },
  2007. "normalMap2": {
  2008. "value": "normal",
  2009. "type": 28
  2010. },
  2011. "normalMap3": {
  2012. "value": "normal",
  2013. "type": 28
  2014. }
  2015. }
  2016. },
  2017. {
  2018. "phase": "shadow-add",
  2019. "propertyIndex": 0,
  2020. "program": "legacy/terrain|shadow-caster-vs:vert|shadow-caster-fs:frag",
  2021. "rasterizerState": {
  2022. "cullMode": 2
  2023. }
  2024. },
  2025. {
  2026. "phase": "deferred-forward",
  2027. "propertyIndex": 0,
  2028. "program": "legacy/terrain|terrain-vs|terrain-fs"
  2029. }
  2030. ]
  2031. }
  2032. ]
  2033. ]
  2034. ],
  2035. 0,
  2036. 0,
  2037. [],
  2038. [],
  2039. []
  2040. ]