dace6a58-1705-48c7-a275-70afc9534e88.json 198 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "pipeline/post-process/hbao",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "passes": [
  10. {
  11. "pass": "hbao-pass",
  12. "rasterizerState": {
  13. "cullMode": 0
  14. },
  15. "program": "pipeline/post-process/hbao|hbao-vs|hbao-fs",
  16. "depthStencilState": {
  17. "depthTest": false,
  18. "depthWrite": false
  19. }
  20. },
  21. {
  22. "pass": "blurx-pass",
  23. "rasterizerState": {
  24. "cullMode": 0
  25. },
  26. "program": "pipeline/post-process/hbao|hbao-vs|blurx-fs",
  27. "depthStencilState": {
  28. "depthTest": false,
  29. "depthWrite": false
  30. }
  31. },
  32. {
  33. "pass": "blury-pass",
  34. "rasterizerState": {
  35. "cullMode": 0
  36. },
  37. "program": "pipeline/post-process/hbao|hbao-vs|blury-fs",
  38. "depthStencilState": {
  39. "depthTest": false,
  40. "depthWrite": false
  41. }
  42. },
  43. {
  44. "pass": "combine-pass",
  45. "rasterizerState": {
  46. "cullMode": 0
  47. },
  48. "blendState": {
  49. "targets": [
  50. {
  51. "blend": true,
  52. "blendSrc": 0,
  53. "blendDst": 2,
  54. "blendSrcAlpha": 0,
  55. "blendDstAlpha": 1
  56. }
  57. ]
  58. },
  59. "program": "pipeline/post-process/hbao|hbao-vs|combine-fs",
  60. "depthStencilState": {
  61. "depthTest": false,
  62. "depthWrite": false
  63. }
  64. }
  65. ]
  66. }
  67. ],
  68. "shaders": [
  69. {
  70. "blocks": [
  71. {
  72. "name": "hbaoUBO",
  73. "members": [
  74. {
  75. "name": "uvDepthToEyePosParams",
  76. "type": 16,
  77. "count": 1
  78. },
  79. {
  80. "name": "radiusParam",
  81. "type": 16,
  82. "count": 1
  83. },
  84. {
  85. "name": "miscParam",
  86. "type": 16,
  87. "count": 1
  88. },
  89. {
  90. "name": "randomTexSize",
  91. "type": 16,
  92. "count": 1
  93. },
  94. {
  95. "name": "blurParam",
  96. "type": 16,
  97. "count": 1
  98. }
  99. ],
  100. "defines": [],
  101. "stageFlags": 16,
  102. "binding": 0
  103. }
  104. ],
  105. "samplerTextures": [
  106. {
  107. "name": "RandomTex",
  108. "type": 28,
  109. "count": 1,
  110. "defines": [],
  111. "stageFlags": 16,
  112. "binding": 2
  113. }
  114. ],
  115. "samplers": [],
  116. "textures": [],
  117. "buffers": [],
  118. "images": [],
  119. "subpassInputs": [],
  120. "attributes": [
  121. {
  122. "name": "a_position",
  123. "defines": [],
  124. "format": 32,
  125. "location": 0
  126. },
  127. {
  128. "name": "a_normal",
  129. "defines": [],
  130. "format": 32,
  131. "location": 1
  132. },
  133. {
  134. "name": "a_texCoord",
  135. "defines": [],
  136. "format": 21,
  137. "location": 2
  138. },
  139. {
  140. "name": "a_tangent",
  141. "defines": [],
  142. "format": 44,
  143. "location": 3
  144. },
  145. {
  146. "name": "a_joints",
  147. "defines": [
  148. "CC_USE_SKINNING"
  149. ],
  150. "location": 4
  151. },
  152. {
  153. "name": "a_weights",
  154. "defines": [
  155. "CC_USE_SKINNING"
  156. ],
  157. "format": 44,
  158. "location": 5
  159. },
  160. {
  161. "name": "a_jointAnimInfo",
  162. "defines": [
  163. "USE_INSTANCING",
  164. "CC_USE_BAKED_ANIMATION"
  165. ],
  166. "format": 44,
  167. "isInstanced": true,
  168. "location": 6
  169. },
  170. {
  171. "name": "a_matWorld0",
  172. "defines": [
  173. "USE_INSTANCING"
  174. ],
  175. "format": 44,
  176. "isInstanced": true,
  177. "location": 7
  178. },
  179. {
  180. "name": "a_matWorld1",
  181. "defines": [
  182. "USE_INSTANCING"
  183. ],
  184. "format": 44,
  185. "isInstanced": true,
  186. "location": 8
  187. },
  188. {
  189. "name": "a_matWorld2",
  190. "defines": [
  191. "USE_INSTANCING"
  192. ],
  193. "format": 44,
  194. "isInstanced": true,
  195. "location": 9
  196. },
  197. {
  198. "name": "a_lightingMapUVParam",
  199. "defines": [
  200. "USE_INSTANCING",
  201. "CC_USE_LIGHTMAP"
  202. ],
  203. "format": 44,
  204. "isInstanced": true,
  205. "location": 10
  206. },
  207. {
  208. "name": "a_localShadowBiasAndProbeId",
  209. "defines": [
  210. "USE_INSTANCING"
  211. ],
  212. "format": 44,
  213. "isInstanced": true,
  214. "location": 11
  215. },
  216. {
  217. "name": "a_reflectionProbeData",
  218. "defines": [
  219. "USE_INSTANCING",
  220. "CC_USE_REFLECTION_PROBE"
  221. ],
  222. "format": 44,
  223. "isInstanced": true,
  224. "location": 12
  225. },
  226. {
  227. "name": "a_sh_linear_const_r",
  228. "defines": [
  229. "USE_INSTANCING",
  230. "CC_USE_LIGHT_PROBE"
  231. ],
  232. "format": 44,
  233. "isInstanced": true,
  234. "location": 13
  235. },
  236. {
  237. "name": "a_sh_linear_const_g",
  238. "defines": [
  239. "USE_INSTANCING",
  240. "CC_USE_LIGHT_PROBE"
  241. ],
  242. "format": 44,
  243. "isInstanced": true,
  244. "location": 14
  245. },
  246. {
  247. "name": "a_sh_linear_const_b",
  248. "defines": [
  249. "USE_INSTANCING",
  250. "CC_USE_LIGHT_PROBE"
  251. ],
  252. "format": 44,
  253. "isInstanced": true,
  254. "location": 15
  255. },
  256. {
  257. "name": "a_vertexId",
  258. "defines": [
  259. "CC_USE_MORPH"
  260. ],
  261. "format": 11,
  262. "location": 16
  263. }
  264. ],
  265. "varyings": [
  266. {
  267. "name": "v_uv",
  268. "type": 14,
  269. "count": 1,
  270. "defines": [],
  271. "stageFlags": 17,
  272. "location": 0
  273. }
  274. ],
  275. "fragColors": [
  276. {
  277. "name": "fragColor",
  278. "typename": "vec4",
  279. "type": 16,
  280. "count": 1,
  281. "defines": [],
  282. "stageFlags": 16,
  283. "location": 0
  284. }
  285. ],
  286. "descriptors": [
  287. {
  288. "rate": 0,
  289. "blocks": [],
  290. "samplerTextures": [],
  291. "samplers": [],
  292. "textures": [],
  293. "buffers": [],
  294. "images": [],
  295. "subpassInputs": []
  296. },
  297. {
  298. "rate": 1,
  299. "blocks": [
  300. {
  301. "name": "hbaoUBO",
  302. "members": [
  303. {
  304. "name": "uvDepthToEyePosParams",
  305. "type": 16,
  306. "count": 1
  307. },
  308. {
  309. "name": "radiusParam",
  310. "type": 16,
  311. "count": 1
  312. },
  313. {
  314. "name": "miscParam",
  315. "type": 16,
  316. "count": 1
  317. },
  318. {
  319. "name": "randomTexSize",
  320. "type": 16,
  321. "count": 1
  322. },
  323. {
  324. "name": "blurParam",
  325. "type": 16,
  326. "count": 1
  327. }
  328. ],
  329. "defines": [],
  330. "stageFlags": 16,
  331. "binding": 0
  332. }
  333. ],
  334. "samplerTextures": [
  335. {
  336. "name": "RandomTex",
  337. "type": 28,
  338. "count": 1,
  339. "defines": [],
  340. "stageFlags": 16,
  341. "binding": 2
  342. }
  343. ],
  344. "samplers": [],
  345. "textures": [],
  346. "buffers": [],
  347. "images": [],
  348. "subpassInputs": []
  349. },
  350. {
  351. "rate": 2,
  352. "blocks": [],
  353. "samplerTextures": [],
  354. "samplers": [],
  355. "textures": [],
  356. "buffers": [],
  357. "images": [],
  358. "subpassInputs": []
  359. },
  360. {
  361. "rate": 3,
  362. "blocks": [
  363. {
  364. "tags": {
  365. "builtin": "global"
  366. },
  367. "name": "CCGlobal",
  368. "members": [
  369. {
  370. "name": "cc_time",
  371. "typename": "vec4",
  372. "type": 16,
  373. "count": 1,
  374. "precision": "highp "
  375. },
  376. {
  377. "name": "cc_screenSize",
  378. "typename": "vec4",
  379. "type": 16,
  380. "count": 1,
  381. "precision": "mediump "
  382. },
  383. {
  384. "name": "cc_nativeSize",
  385. "typename": "vec4",
  386. "type": 16,
  387. "count": 1,
  388. "precision": "mediump "
  389. },
  390. {
  391. "name": "cc_probeInfo",
  392. "typename": "vec4",
  393. "type": 16,
  394. "count": 1,
  395. "precision": "mediump "
  396. },
  397. {
  398. "name": "cc_debug_view_mode",
  399. "typename": "vec4",
  400. "type": 16,
  401. "count": 1,
  402. "precision": "mediump "
  403. }
  404. ],
  405. "defines": [],
  406. "stageFlags": 17
  407. },
  408. {
  409. "tags": {
  410. "builtin": "global"
  411. },
  412. "name": "CCCamera",
  413. "members": [
  414. {
  415. "name": "cc_matView",
  416. "typename": "mat4",
  417. "type": 25,
  418. "count": 1,
  419. "precision": "highp "
  420. },
  421. {
  422. "name": "cc_matViewInv",
  423. "typename": "mat4",
  424. "type": 25,
  425. "count": 1,
  426. "precision": "highp "
  427. },
  428. {
  429. "name": "cc_matProj",
  430. "typename": "mat4",
  431. "type": 25,
  432. "count": 1,
  433. "precision": "highp "
  434. },
  435. {
  436. "name": "cc_matProjInv",
  437. "typename": "mat4",
  438. "type": 25,
  439. "count": 1,
  440. "precision": "highp "
  441. },
  442. {
  443. "name": "cc_matViewProj",
  444. "typename": "mat4",
  445. "type": 25,
  446. "count": 1,
  447. "precision": "highp "
  448. },
  449. {
  450. "name": "cc_matViewProjInv",
  451. "typename": "mat4",
  452. "type": 25,
  453. "count": 1,
  454. "precision": "highp "
  455. },
  456. {
  457. "name": "cc_cameraPos",
  458. "typename": "vec4",
  459. "type": 16,
  460. "count": 1,
  461. "precision": "highp "
  462. },
  463. {
  464. "name": "cc_surfaceTransform",
  465. "typename": "vec4",
  466. "type": 16,
  467. "count": 1,
  468. "precision": "mediump "
  469. },
  470. {
  471. "name": "cc_screenScale",
  472. "typename": "vec4",
  473. "type": 16,
  474. "count": 1,
  475. "precision": "mediump "
  476. },
  477. {
  478. "name": "cc_exposure",
  479. "typename": "vec4",
  480. "type": 16,
  481. "count": 1,
  482. "precision": "mediump "
  483. },
  484. {
  485. "name": "cc_mainLitDir",
  486. "typename": "vec4",
  487. "type": 16,
  488. "count": 1,
  489. "precision": "mediump "
  490. },
  491. {
  492. "name": "cc_mainLitColor",
  493. "typename": "vec4",
  494. "type": 16,
  495. "count": 1,
  496. "precision": "mediump "
  497. },
  498. {
  499. "name": "cc_ambientSky",
  500. "typename": "vec4",
  501. "type": 16,
  502. "count": 1,
  503. "precision": "mediump "
  504. },
  505. {
  506. "name": "cc_ambientGround",
  507. "typename": "vec4",
  508. "type": 16,
  509. "count": 1,
  510. "precision": "mediump "
  511. },
  512. {
  513. "name": "cc_fogColor",
  514. "typename": "vec4",
  515. "type": 16,
  516. "count": 1,
  517. "precision": "mediump "
  518. },
  519. {
  520. "name": "cc_fogBase",
  521. "typename": "vec4",
  522. "type": 16,
  523. "count": 1,
  524. "precision": "mediump "
  525. },
  526. {
  527. "name": "cc_fogAdd",
  528. "typename": "vec4",
  529. "type": 16,
  530. "count": 1,
  531. "precision": "mediump "
  532. },
  533. {
  534. "name": "cc_nearFar",
  535. "typename": "vec4",
  536. "type": 16,
  537. "count": 1,
  538. "precision": "mediump "
  539. },
  540. {
  541. "name": "cc_viewPort",
  542. "typename": "vec4",
  543. "type": 16,
  544. "count": 1,
  545. "precision": "mediump "
  546. }
  547. ],
  548. "defines": [],
  549. "stageFlags": 17
  550. }
  551. ],
  552. "samplerTextures": [
  553. {
  554. "name": "DepthTex",
  555. "type": 28,
  556. "count": 1,
  557. "defines": [],
  558. "stageFlags": 16,
  559. "binding": 1
  560. },
  561. {
  562. "name": "AOTexNearest",
  563. "type": 28,
  564. "count": 1,
  565. "defines": [],
  566. "stageFlags": 16,
  567. "binding": 3
  568. }
  569. ],
  570. "samplers": [],
  571. "textures": [],
  572. "buffers": [],
  573. "images": [],
  574. "subpassInputs": []
  575. }
  576. ],
  577. "hash": 2385848179,
  578. "glsl4": {
  579. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\nlayout(location = 3) in vec4 a_tangent;\n#if CC_USE_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(location = 0) out vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  580. "frag": "\nprecision highp float;\nprecision highp float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetCameraDepthRH(float depthHS, mat4 matProj)\n{\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n}\nfloat GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n{\n return -matProj32 / (depthHS + matProj22);\n}\nvec4 GetWorldPosFromNDCPosRH(vec3 posHS, mat4 matProj, mat4 matViewProjInv)\n{\n float w = -GetCameraDepthRH(posHS.z, matProj);\n return matViewProjInv * vec4(posHS * w, w);\n}\nfloat rsqrt(float value) { return 1.0 / sqrt(value); }\nvec2 rsqrt(vec2 value) { return vec2(1.0) / sqrt(value); }\nvec3 rsqrt(vec3 value) { return vec3(1.0) / sqrt(value); }\nvec4 rsqrt(vec4 value) { return vec4(1.0) / sqrt(value); }\nfloat rand(vec2 seeds_zero_to_one) {\n return fract(sin(dot(seeds_zero_to_one.xy, vec2(12.9898, 78.233))) * 43758.5453);\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}\nlayout(set = 1, binding = 0) uniform hbaoUBO {\n vec4 uvDepthToEyePosParams;\n vec4 radiusParam;\n vec4 miscParam;\n vec4 randomTexSize;\n vec4 blurParam;\n};\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nlayout(set = 1, binding = 1) uniform sampler2D DepthTex;\nlayout(set = 1, binding = 2) uniform sampler2D RandomTex;\nvec2 fixUV(vec2 uv)\n{\n return saturate(uv);\n}\nfloat InvLength(vec2 v)\n{\n\treturn rsqrt(dot(v,v));\n}\nfloat Tangent(vec3 P, vec3 S)\n{\n\treturn (P.z - S.z) * InvLength(S.xy - P.xy);\n}\nvec3 UVToEye(vec2 uv, float eye_z)\n{\n uv = g_UVToViewA * uv + g_UVToViewB;\n return vec3(uv * eye_z, eye_z);\n}\nfloat GetLinearDepth(vec2 uv) {\n float depthHS = texture(DepthTex, fixUV(uv)).r * 2.0 - 1.0;\n return -GetCameraDepthRH(depthHS, cc_matProj);\n}\nvec3 FetchEyePos(vec2 uv)\n{\n float depth = GetLinearDepth(uv);\n return UVToEye(uv, depth);\n}\nfloat Length2(vec3 v)\n{\n \treturn dot(v, v);\n}\nvec3 MinDiff(vec3 P, vec3 Pr, vec3 Pl)\n{\n \tvec3 V1 = Pr - P;\n \tvec3 V2 = P - Pl;\n \treturn (Length2(V1) < Length2(V2)) ? V1 : V2;\n}\nfloat Falloff(float d2)\n{\n return d2 * g_NegInvR2 + 1.0;\n}\nvec2 SnapUVOffset(vec2 uv)\n{\n return round(uv * g_AOResolution) * g_InvAOResolution;\n}\nfloat TanToSin(float x)\n{\n \treturn x * rsqrt(x*x + 1.0);\n}\nvec3 TangentVector(vec2 deltaUV, vec3 dPdu, vec3 dPdv)\n{\n \treturn deltaUV.x * dPdu + deltaUV.y * dPdv;\n}\nfloat Tangent(vec3 T)\n{\n \treturn -T.z * InvLength(T.xy);\n}\nfloat BiasedTangent(vec3 T)\n{\n return Tangent(T) + g_TanAngleBias;\n}\nvec2 RotateDirections(vec2 Dir, vec2 CosSin)\n{\n \treturn vec2(Dir.x*CosSin.x - Dir.y*CosSin.y,\n \t\tDir.x*CosSin.y + Dir.y*CosSin.x);\n}\nfloat IntegerateOcclusion(vec2 uv0,\n vec2 snapped_duv,\n vec3 P,\n vec3 dPdu,\n vec3 dPdv,\n inout float tanH)\n{\n float ao = 0.0;\n vec3 T1 = TangentVector(snapped_duv, dPdu, dPdv);\n float tanT = BiasedTangent(T1);\n float sinT = TanToSin(tanT);\n vec3 S = FetchEyePos(uv0 + snapped_duv);\n float tanS = Tangent(P, S);\n float sinS = TanToSin(tanS);\n float d2 = Length2(S - P);\n if ((d2 < g_R2) && (tanS > tanT))\n {\n ao = Falloff(d2) * (sinS - sinT);\n tanH = max(tanH, tanS);\n }\n return ao;\n}\nfloat HorizonOcclusion(vec2 deltaUV,\n vec2 texelDeltaUV,\n vec2 uv0,\n vec3 P,\n float numSteps,\n float randstep,\n vec3 dPdu,\n vec3 dPdv)\n{\n float ao = 0.0;\n vec2 uv = uv0 + SnapUVOffset( randstep * deltaUV );\n deltaUV = SnapUVOffset( deltaUV );\n vec3 T = deltaUV.x * dPdu + deltaUV.y * dPdv;\n float tanH = BiasedTangent(T);\n#if SAMPLE_FIRST_STEP\n vec2 snapped_duv = SnapUVOffset( randstep * deltaUV + texelDeltaUV );\n ao = IntegerateOcclusion(uv0, snapped_duv, P, dPdu, dPdv, tanH);\n --numSteps;\n#endif\n float sinH = tanH / sqrt(1.0 + tanH*tanH);\n for (float j = 1.0; j <= NUM_STEPS_LOOP; j += 1.0)\n {\n if (j <= numSteps)\n {\n uv += deltaUV;\n vec3 S = FetchEyePos(uv);\n float tanS = Tangent(P, S);\n float d2 = Length2(S - P);\n if ((d2 < g_R2) && (tanS > tanH))\n {\n float sinS = tanS / sqrt(1.0 + tanS*tanS);\n ao += Falloff(d2) * (sinS - sinH);\n tanH = tanS;\n sinH = sinS;\n }\n }\n }\n return ao;\n}\nvoid ComputeSteps(inout vec2 step_size_uv, inout float numSteps, float ray_radius_pix, float rand)\n{\n numSteps = min(NUM_STEPS, ray_radius_pix);\n float step_size_pix = ray_radius_pix / (numSteps + 1.0);\n float maxNumSteps = g_MaxRadiusPixels / step_size_pix;\n if (maxNumSteps < numSteps)\n {\n numSteps = floor(maxNumSteps + rand);\n numSteps = max(numSteps, 1.0);\n step_size_pix = g_MaxRadiusPixels / numSteps;\n }\n step_size_uv = step_size_pix * g_InvAOResolution;\n}\nfloat CalculateAO(vec2 uv)\n{\n vec3 P = FetchEyePos(uv);\n vec3 rand = texture(RandomTex, uv * g_AOResolution.xy * randomTexSize.zw).xyz;\n vec2 ray_radius_uv = 0.5 * g_R * g_FocalLen / P.z;\n float ray_radius_pix = ray_radius_uv.x * g_AOResolution.x;\n if (ray_radius_pix < 1.0)\n {\n return 1.0;\n }\n float numSteps;\n vec2 step_size;\n ComputeSteps(step_size, numSteps, ray_radius_pix, rand.z);\n vec3 Pr = FetchEyePos(uv + vec2(g_InvAOResolution.x, 0.0));\n vec3 Pl = FetchEyePos(uv + vec2(-g_InvAOResolution.x, 0.0));\n vec3 Pt = FetchEyePos(uv + vec2(0.0, g_InvAOResolution.y));\n vec3 Pb = FetchEyePos(uv + vec2(0.0, -g_InvAOResolution.y));\n vec3 dPdu = MinDiff(P, Pr, Pl);\n vec3 dPdv = MinDiff(P, Pt, Pb) * (g_AOResolution.y * g_InvAOResolution.x);\n float ao = 0.0;\n float alpha = CONSTANT_2PI * INV_NUM_DIRECTIONS;\n for (int d = 0; d < NUM_DIRECTIONS; ++d)\n {\n float angle = alpha * float(d);\n vec2 dir = RotateDirections(vec2(cos(angle), sin(angle)), rand.xy);\n vec2 deltaUV = dir * step_size.xy;\n vec2 texelDeltaUV = dir * g_InvAOResolution;\n ao += HorizonOcclusion(deltaUV, texelDeltaUV, uv, P, numSteps, rand.z, dPdu, dPdv);\n }\n ao = 1.0 - ao * INV_NUM_DIRECTIONS * g_Strength;\n #if CC_USE_FOG != 4 && !CC_USE_FLOAT_OUTPUT\n float fogFactor = 1.0;\n float depth = texture(DepthTex, uv).r;\n vec3 posHS = vec3(uv, depth) * 2.0 - vec3(1.0);\n posHS.xy = cc_cameraPos.w == 0.0 ? vec2(posHS.xy.x, -posHS.xy.y) : posHS.xy;\n vec4 worldPos = GetWorldPosFromNDCPosRH(posHS, cc_matProj, cc_matViewProjInv);\n CC_TRANSFER_FOG_BASE(vec4(worldPos.xyz, 1.0), fogFactor);\n ao = mix(1.0, ao, pow(fogFactor * 0.9, 4.0));\n #endif\n return ao;\n}\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nlayout(set = 1, binding = 3) uniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\n#define g_AOSaturation blurParam.w\nlayout(location = 0) in vec2 v_uv;\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n float ao = CalculateAO(v_uv);\n fragColor = vec4(ao, ao, ao, 1.0);\n}"
  581. },
  582. "glsl3": {
  583. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nout vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  584. "frag": "\nprecision highp float;\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetCameraDepthRH(float depthHS, mat4 matProj)\n{\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n}\nfloat GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n{\n return -matProj32 / (depthHS + matProj22);\n}\nvec4 GetWorldPosFromNDCPosRH(vec3 posHS, mat4 matProj, mat4 matViewProjInv)\n{\n float w = -GetCameraDepthRH(posHS.z, matProj);\n return matViewProjInv * vec4(posHS * w, w);\n}\nfloat rsqrt(float value) { return 1.0 / sqrt(value); }\nvec2 rsqrt(vec2 value) { return vec2(1.0) / sqrt(value); }\nvec3 rsqrt(vec3 value) { return vec3(1.0) / sqrt(value); }\nvec4 rsqrt(vec4 value) { return vec4(1.0) / sqrt(value); }\nfloat rand(vec2 seeds_zero_to_one) {\n return fract(sin(dot(seeds_zero_to_one.xy, vec2(12.9898, 78.233))) * 43758.5453);\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}\nlayout(std140) uniform hbaoUBO {\n vec4 uvDepthToEyePosParams;\n vec4 radiusParam;\n vec4 miscParam;\n vec4 randomTexSize;\n vec4 blurParam;\n};\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nuniform sampler2D DepthTex;\nuniform sampler2D RandomTex;\nvec2 fixUV(vec2 uv)\n{\n return saturate(uv);\n}\nfloat InvLength(vec2 v)\n{\n\treturn rsqrt(dot(v,v));\n}\nfloat Tangent(vec3 P, vec3 S)\n{\n\treturn (P.z - S.z) * InvLength(S.xy - P.xy);\n}\nvec3 UVToEye(vec2 uv, float eye_z)\n{\n uv = g_UVToViewA * uv + g_UVToViewB;\n return vec3(uv * eye_z, eye_z);\n}\nfloat GetLinearDepth(vec2 uv) {\n float depthHS = texture(DepthTex, fixUV(uv)).r * 2.0 - 1.0;\n return -GetCameraDepthRH(depthHS, cc_matProj);\n}\nvec3 FetchEyePos(vec2 uv)\n{\n float depth = GetLinearDepth(uv);\n return UVToEye(uv, depth);\n}\nfloat Length2(vec3 v)\n{\n \treturn dot(v, v);\n}\nvec3 MinDiff(vec3 P, vec3 Pr, vec3 Pl)\n{\n \tvec3 V1 = Pr - P;\n \tvec3 V2 = P - Pl;\n \treturn (Length2(V1) < Length2(V2)) ? V1 : V2;\n}\nfloat Falloff(float d2)\n{\n return d2 * g_NegInvR2 + 1.0;\n}\nvec2 SnapUVOffset(vec2 uv)\n{\n return round(uv * g_AOResolution) * g_InvAOResolution;\n}\nfloat TanToSin(float x)\n{\n \treturn x * rsqrt(x*x + 1.0);\n}\nvec3 TangentVector(vec2 deltaUV, vec3 dPdu, vec3 dPdv)\n{\n \treturn deltaUV.x * dPdu + deltaUV.y * dPdv;\n}\nfloat Tangent(vec3 T)\n{\n \treturn -T.z * InvLength(T.xy);\n}\nfloat BiasedTangent(vec3 T)\n{\n return Tangent(T) + g_TanAngleBias;\n}\nvec2 RotateDirections(vec2 Dir, vec2 CosSin)\n{\n \treturn vec2(Dir.x*CosSin.x - Dir.y*CosSin.y,\n \t\tDir.x*CosSin.y + Dir.y*CosSin.x);\n}\nfloat IntegerateOcclusion(vec2 uv0,\n vec2 snapped_duv,\n vec3 P,\n vec3 dPdu,\n vec3 dPdv,\n inout float tanH)\n{\n float ao = 0.0;\n vec3 T1 = TangentVector(snapped_duv, dPdu, dPdv);\n float tanT = BiasedTangent(T1);\n float sinT = TanToSin(tanT);\n vec3 S = FetchEyePos(uv0 + snapped_duv);\n float tanS = Tangent(P, S);\n float sinS = TanToSin(tanS);\n float d2 = Length2(S - P);\n if ((d2 < g_R2) && (tanS > tanT))\n {\n ao = Falloff(d2) * (sinS - sinT);\n tanH = max(tanH, tanS);\n }\n return ao;\n}\nfloat HorizonOcclusion(vec2 deltaUV,\n vec2 texelDeltaUV,\n vec2 uv0,\n vec3 P,\n float numSteps,\n float randstep,\n vec3 dPdu,\n vec3 dPdv)\n{\n float ao = 0.0;\n vec2 uv = uv0 + SnapUVOffset( randstep * deltaUV );\n deltaUV = SnapUVOffset( deltaUV );\n vec3 T = deltaUV.x * dPdu + deltaUV.y * dPdv;\n float tanH = BiasedTangent(T);\n#if SAMPLE_FIRST_STEP\n vec2 snapped_duv = SnapUVOffset( randstep * deltaUV + texelDeltaUV );\n ao = IntegerateOcclusion(uv0, snapped_duv, P, dPdu, dPdv, tanH);\n --numSteps;\n#endif\n float sinH = tanH / sqrt(1.0 + tanH*tanH);\n for (float j = 1.0; j <= NUM_STEPS_LOOP; j += 1.0)\n {\n if (j <= numSteps)\n {\n uv += deltaUV;\n vec3 S = FetchEyePos(uv);\n float tanS = Tangent(P, S);\n float d2 = Length2(S - P);\n if ((d2 < g_R2) && (tanS > tanH))\n {\n float sinS = tanS / sqrt(1.0 + tanS*tanS);\n ao += Falloff(d2) * (sinS - sinH);\n tanH = tanS;\n sinH = sinS;\n }\n }\n }\n return ao;\n}\nvoid ComputeSteps(inout vec2 step_size_uv, inout float numSteps, float ray_radius_pix, float rand)\n{\n numSteps = min(NUM_STEPS, ray_radius_pix);\n float step_size_pix = ray_radius_pix / (numSteps + 1.0);\n float maxNumSteps = g_MaxRadiusPixels / step_size_pix;\n if (maxNumSteps < numSteps)\n {\n numSteps = floor(maxNumSteps + rand);\n numSteps = max(numSteps, 1.0);\n step_size_pix = g_MaxRadiusPixels / numSteps;\n }\n step_size_uv = step_size_pix * g_InvAOResolution;\n}\nfloat CalculateAO(vec2 uv)\n{\n vec3 P = FetchEyePos(uv);\n vec3 rand = texture(RandomTex, uv * g_AOResolution.xy * randomTexSize.zw).xyz;\n vec2 ray_radius_uv = 0.5 * g_R * g_FocalLen / P.z;\n float ray_radius_pix = ray_radius_uv.x * g_AOResolution.x;\n if (ray_radius_pix < 1.0)\n {\n return 1.0;\n }\n float numSteps;\n vec2 step_size;\n ComputeSteps(step_size, numSteps, ray_radius_pix, rand.z);\n vec3 Pr = FetchEyePos(uv + vec2(g_InvAOResolution.x, 0.0));\n vec3 Pl = FetchEyePos(uv + vec2(-g_InvAOResolution.x, 0.0));\n vec3 Pt = FetchEyePos(uv + vec2(0.0, g_InvAOResolution.y));\n vec3 Pb = FetchEyePos(uv + vec2(0.0, -g_InvAOResolution.y));\n vec3 dPdu = MinDiff(P, Pr, Pl);\n vec3 dPdv = MinDiff(P, Pt, Pb) * (g_AOResolution.y * g_InvAOResolution.x);\n float ao = 0.0;\n float alpha = CONSTANT_2PI * INV_NUM_DIRECTIONS;\n for (int d = 0; d < NUM_DIRECTIONS; ++d)\n {\n float angle = alpha * float(d);\n vec2 dir = RotateDirections(vec2(cos(angle), sin(angle)), rand.xy);\n vec2 deltaUV = dir * step_size.xy;\n vec2 texelDeltaUV = dir * g_InvAOResolution;\n ao += HorizonOcclusion(deltaUV, texelDeltaUV, uv, P, numSteps, rand.z, dPdu, dPdv);\n }\n ao = 1.0 - ao * INV_NUM_DIRECTIONS * g_Strength;\n #if CC_USE_FOG != 4 && !CC_USE_FLOAT_OUTPUT\n float fogFactor = 1.0;\n float depth = texture(DepthTex, uv).r;\n vec3 posHS = vec3(uv, depth) * 2.0 - vec3(1.0);\n posHS.xy = cc_cameraPos.w == 0.0 ? vec2(posHS.xy.x, -posHS.xy.y) : posHS.xy;\n vec4 worldPos = GetWorldPosFromNDCPosRH(posHS, cc_matProj, cc_matViewProjInv);\n CC_TRANSFER_FOG_BASE(vec4(worldPos.xyz, 1.0), fogFactor);\n ao = mix(1.0, ao, pow(fogFactor * 0.9, 4.0));\n #endif\n return ao;\n}\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nuniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\n#define g_AOSaturation blurParam.w\nin vec2 v_uv;\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n float ao = CalculateAO(v_uv);\n fragColor = vec4(ao, ao, ao, 1.0);\n}"
  585. },
  586. "glsl1": {
  587. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\nuniform highp vec4 cc_cameraPos;\nvarying vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  588. "frag": "\nprecision highp float;\nprecision highp float;\nuniform mediump vec4 cc_screenSize;\nuniform highp mat4 cc_matProj;\n uniform highp mat4 cc_matViewProjInv;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetCameraDepthRH(float depthHS, mat4 matProj)\n{\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n}\nfloat GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n{\n return -matProj32 / (depthHS + matProj22);\n}\nvec4 GetWorldPosFromNDCPosRH(vec3 posHS, mat4 matProj, mat4 matViewProjInv)\n{\n float w = -GetCameraDepthRH(posHS.z, matProj);\n return matViewProjInv * vec4(posHS * w, w);\n}\n float round(float value) {\n float f = fract(value);\n return value - f + (f < 0.5 ? 0.0 : 1.0);\n }\n vec2 round(vec2 value) { return vec2(round(value.x), round(value.y)); }\n vec3 round(vec3 value) { return vec3(round(value.x), round(value.y), round(value.z)); }\n vec4 round(vec4 value) { return vec4(round(value.x), round(value.y), round(value.z), round(value.w)); }\nfloat rsqrt(float value) { return 1.0 / sqrt(value); }\nvec2 rsqrt(vec2 value) { return vec2(1.0) / sqrt(value); }\nvec3 rsqrt(vec3 value) { return vec3(1.0) / sqrt(value); }\nvec4 rsqrt(vec4 value) { return vec4(1.0) / sqrt(value); }\nfloat rand(vec2 seeds_zero_to_one) {\n return fract(sin(dot(seeds_zero_to_one.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n uniform vec4 uvDepthToEyePosParams;\n uniform vec4 radiusParam;\n uniform vec4 miscParam;\n uniform vec4 randomTexSize;\n uniform vec4 blurParam;\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nuniform sampler2D DepthTex;\nuniform sampler2D RandomTex;\nvec2 fixUV(vec2 uv)\n{\n return saturate(uv);\n}\nfloat InvLength(vec2 v)\n{\n\treturn rsqrt(dot(v,v));\n}\nfloat Tangent(vec3 P, vec3 S)\n{\n\treturn (P.z - S.z) * InvLength(S.xy - P.xy);\n}\nvec3 UVToEye(vec2 uv, float eye_z)\n{\n uv = g_UVToViewA * uv + g_UVToViewB;\n return vec3(uv * eye_z, eye_z);\n}\nfloat GetLinearDepth(vec2 uv) {\n float depthHS = texture2D(DepthTex, fixUV(uv)).r * 2.0 - 1.0;\n return -GetCameraDepthRH(depthHS, cc_matProj);\n}\nvec3 FetchEyePos(vec2 uv)\n{\n float depth = GetLinearDepth(uv);\n return UVToEye(uv, depth);\n}\nfloat Length2(vec3 v)\n{\n \treturn dot(v, v);\n}\nvec3 MinDiff(vec3 P, vec3 Pr, vec3 Pl)\n{\n \tvec3 V1 = Pr - P;\n \tvec3 V2 = P - Pl;\n \treturn (Length2(V1) < Length2(V2)) ? V1 : V2;\n}\nfloat Falloff(float d2)\n{\n return d2 * g_NegInvR2 + 1.0;\n}\nvec2 SnapUVOffset(vec2 uv)\n{\n return round(uv * g_AOResolution) * g_InvAOResolution;\n}\nfloat TanToSin(float x)\n{\n \treturn x * rsqrt(x*x + 1.0);\n}\nvec3 TangentVector(vec2 deltaUV, vec3 dPdu, vec3 dPdv)\n{\n \treturn deltaUV.x * dPdu + deltaUV.y * dPdv;\n}\nfloat Tangent(vec3 T)\n{\n \treturn -T.z * InvLength(T.xy);\n}\nfloat BiasedTangent(vec3 T)\n{\n return Tangent(T) + g_TanAngleBias;\n}\nvec2 RotateDirections(vec2 Dir, vec2 CosSin)\n{\n \treturn vec2(Dir.x*CosSin.x - Dir.y*CosSin.y,\n \t\tDir.x*CosSin.y + Dir.y*CosSin.x);\n}\nfloat IntegerateOcclusion(vec2 uv0,\n vec2 snapped_duv,\n vec3 P,\n vec3 dPdu,\n vec3 dPdv,\n inout float tanH)\n{\n float ao = 0.0;\n vec3 T1 = TangentVector(snapped_duv, dPdu, dPdv);\n float tanT = BiasedTangent(T1);\n float sinT = TanToSin(tanT);\n vec3 S = FetchEyePos(uv0 + snapped_duv);\n float tanS = Tangent(P, S);\n float sinS = TanToSin(tanS);\n float d2 = Length2(S - P);\n if ((d2 < g_R2) && (tanS > tanT))\n {\n ao = Falloff(d2) * (sinS - sinT);\n tanH = max(tanH, tanS);\n }\n return ao;\n}\nfloat HorizonOcclusion(vec2 deltaUV,\n vec2 texelDeltaUV,\n vec2 uv0,\n vec3 P,\n float numSteps,\n float randstep,\n vec3 dPdu,\n vec3 dPdv)\n{\n float ao = 0.0;\n vec2 uv = uv0 + SnapUVOffset( randstep * deltaUV );\n deltaUV = SnapUVOffset( deltaUV );\n vec3 T = deltaUV.x * dPdu + deltaUV.y * dPdv;\n float tanH = BiasedTangent(T);\n#if SAMPLE_FIRST_STEP\n vec2 snapped_duv = SnapUVOffset( randstep * deltaUV + texelDeltaUV );\n ao = IntegerateOcclusion(uv0, snapped_duv, P, dPdu, dPdv, tanH);\n --numSteps;\n#endif\n float sinH = tanH / sqrt(1.0 + tanH*tanH);\n for (float j = 1.0; j <= NUM_STEPS_LOOP; j += 1.0)\n {\n if (j <= numSteps)\n {\n uv += deltaUV;\n vec3 S = FetchEyePos(uv);\n float tanS = Tangent(P, S);\n float d2 = Length2(S - P);\n if ((d2 < g_R2) && (tanS > tanH))\n {\n float sinS = tanS / sqrt(1.0 + tanS*tanS);\n ao += Falloff(d2) * (sinS - sinH);\n tanH = tanS;\n sinH = sinS;\n }\n }\n }\n return ao;\n}\nvoid ComputeSteps(inout vec2 step_size_uv, inout float numSteps, float ray_radius_pix, float rand)\n{\n numSteps = min(NUM_STEPS, ray_radius_pix);\n float step_size_pix = ray_radius_pix / (numSteps + 1.0);\n float maxNumSteps = g_MaxRadiusPixels / step_size_pix;\n if (maxNumSteps < numSteps)\n {\n numSteps = floor(maxNumSteps + rand);\n numSteps = max(numSteps, 1.0);\n step_size_pix = g_MaxRadiusPixels / numSteps;\n }\n step_size_uv = step_size_pix * g_InvAOResolution;\n}\nfloat CalculateAO(vec2 uv)\n{\n vec3 P = FetchEyePos(uv);\n vec3 rand = texture2D(RandomTex, uv * g_AOResolution.xy * randomTexSize.zw).xyz;\n vec2 ray_radius_uv = 0.5 * g_R * g_FocalLen / P.z;\n float ray_radius_pix = ray_radius_uv.x * g_AOResolution.x;\n if (ray_radius_pix < 1.0)\n {\n return 1.0;\n }\n float numSteps;\n vec2 step_size;\n ComputeSteps(step_size, numSteps, ray_radius_pix, rand.z);\n vec3 Pr = FetchEyePos(uv + vec2(g_InvAOResolution.x, 0.0));\n vec3 Pl = FetchEyePos(uv + vec2(-g_InvAOResolution.x, 0.0));\n vec3 Pt = FetchEyePos(uv + vec2(0.0, g_InvAOResolution.y));\n vec3 Pb = FetchEyePos(uv + vec2(0.0, -g_InvAOResolution.y));\n vec3 dPdu = MinDiff(P, Pr, Pl);\n vec3 dPdv = MinDiff(P, Pt, Pb) * (g_AOResolution.y * g_InvAOResolution.x);\n float ao = 0.0;\n float alpha = CONSTANT_2PI * INV_NUM_DIRECTIONS;\n for (int d = 0; d < NUM_DIRECTIONS; ++d)\n {\n float angle = alpha * float(d);\n vec2 dir = RotateDirections(vec2(cos(angle), sin(angle)), rand.xy);\n vec2 deltaUV = dir * step_size.xy;\n vec2 texelDeltaUV = dir * g_InvAOResolution;\n ao += HorizonOcclusion(deltaUV, texelDeltaUV, uv, P, numSteps, rand.z, dPdu, dPdv);\n }\n ao = 1.0 - ao * INV_NUM_DIRECTIONS * g_Strength;\n #if CC_USE_FOG != 4 && !CC_USE_FLOAT_OUTPUT\n float fogFactor = 1.0;\n float depth = texture2D(DepthTex, uv).r;\n vec3 posHS = vec3(uv, depth) * 2.0 - vec3(1.0);\n posHS.xy = cc_cameraPos.w == 0.0 ? vec2(posHS.xy.x, -posHS.xy.y) : posHS.xy;\n vec4 worldPos = GetWorldPosFromNDCPosRH(posHS, cc_matProj, cc_matViewProjInv);\n CC_TRANSFER_FOG_BASE(vec4(worldPos.xyz, 1.0), fogFactor);\n ao = mix(1.0, ao, pow(fogFactor * 0.9, 4.0));\n #endif\n return ao;\n}\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nuniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\n#define g_AOSaturation blurParam.w\nvarying vec2 v_uv;\nvoid main () {\n float ao = CalculateAO(v_uv);\n gl_FragColor = vec4(ao, ao, ao, 1.0);\n}"
  589. },
  590. "builtins": {
  591. "globals": {
  592. "blocks": [
  593. {
  594. "name": "CCGlobal",
  595. "defines": []
  596. },
  597. {
  598. "name": "CCCamera",
  599. "defines": []
  600. }
  601. ],
  602. "samplerTextures": [],
  603. "buffers": [],
  604. "images": []
  605. },
  606. "locals": {
  607. "blocks": [],
  608. "samplerTextures": [],
  609. "buffers": [],
  610. "images": []
  611. },
  612. "statistics": {
  613. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 42,
  614. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 47
  615. }
  616. },
  617. "defines": [
  618. {
  619. "name": "USE_INSTANCING",
  620. "type": "boolean",
  621. "defines": [],
  622. "editor": {
  623. "elevated": true
  624. }
  625. },
  626. {
  627. "name": "CC_USE_SKINNING",
  628. "type": "boolean",
  629. "defines": []
  630. },
  631. {
  632. "name": "CC_USE_BAKED_ANIMATION",
  633. "type": "boolean",
  634. "defines": [
  635. "USE_INSTANCING"
  636. ]
  637. },
  638. {
  639. "name": "CC_USE_LIGHTMAP",
  640. "type": "boolean",
  641. "defines": [
  642. "USE_INSTANCING"
  643. ]
  644. },
  645. {
  646. "name": "CC_USE_REFLECTION_PROBE",
  647. "type": "boolean",
  648. "defines": [
  649. "USE_INSTANCING"
  650. ]
  651. },
  652. {
  653. "name": "CC_RECEIVE_SHADOW",
  654. "type": "boolean",
  655. "defines": [
  656. "USE_INSTANCING"
  657. ]
  658. },
  659. {
  660. "name": "CC_USE_LIGHT_PROBE",
  661. "type": "boolean",
  662. "defines": [
  663. "USE_INSTANCING"
  664. ]
  665. },
  666. {
  667. "name": "CC_USE_MORPH",
  668. "type": "boolean",
  669. "defines": []
  670. },
  671. {
  672. "name": "CC_USE_FOG",
  673. "type": "number",
  674. "defines": [],
  675. "range": [
  676. 0,
  677. 4
  678. ]
  679. },
  680. {
  681. "name": "SAMPLE_FIRST_STEP",
  682. "type": "boolean",
  683. "defines": []
  684. },
  685. {
  686. "name": "CC_USE_FLOAT_OUTPUT",
  687. "type": "boolean",
  688. "defines": [
  689. "CC_USE_FOG"
  690. ]
  691. }
  692. ],
  693. "name": "pipeline/post-process/hbao|hbao-vs|hbao-fs"
  694. },
  695. {
  696. "blocks": [
  697. {
  698. "name": "hbaoUBO",
  699. "members": [
  700. {
  701. "name": "uvDepthToEyePosParams",
  702. "type": 16,
  703. "count": 1
  704. },
  705. {
  706. "name": "radiusParam",
  707. "type": 16,
  708. "count": 1
  709. },
  710. {
  711. "name": "miscParam",
  712. "type": 16,
  713. "count": 1
  714. },
  715. {
  716. "name": "randomTexSize",
  717. "type": 16,
  718. "count": 1
  719. },
  720. {
  721. "name": "blurParam",
  722. "type": 16,
  723. "count": 1
  724. }
  725. ],
  726. "defines": [],
  727. "stageFlags": 16,
  728. "binding": 0
  729. }
  730. ],
  731. "samplerTextures": [
  732. {
  733. "name": "RandomTex",
  734. "type": 28,
  735. "count": 1,
  736. "defines": [],
  737. "stageFlags": 16,
  738. "binding": 2
  739. }
  740. ],
  741. "samplers": [],
  742. "textures": [],
  743. "buffers": [],
  744. "images": [],
  745. "subpassInputs": [],
  746. "attributes": [
  747. {
  748. "name": "a_position",
  749. "defines": [],
  750. "format": 32,
  751. "location": 0
  752. },
  753. {
  754. "name": "a_normal",
  755. "defines": [],
  756. "format": 32,
  757. "location": 1
  758. },
  759. {
  760. "name": "a_texCoord",
  761. "defines": [],
  762. "format": 21,
  763. "location": 2
  764. },
  765. {
  766. "name": "a_tangent",
  767. "defines": [],
  768. "format": 44,
  769. "location": 3
  770. },
  771. {
  772. "name": "a_joints",
  773. "defines": [
  774. "CC_USE_SKINNING"
  775. ],
  776. "location": 4
  777. },
  778. {
  779. "name": "a_weights",
  780. "defines": [
  781. "CC_USE_SKINNING"
  782. ],
  783. "format": 44,
  784. "location": 5
  785. },
  786. {
  787. "name": "a_jointAnimInfo",
  788. "defines": [
  789. "USE_INSTANCING",
  790. "CC_USE_BAKED_ANIMATION"
  791. ],
  792. "format": 44,
  793. "isInstanced": true,
  794. "location": 6
  795. },
  796. {
  797. "name": "a_matWorld0",
  798. "defines": [
  799. "USE_INSTANCING"
  800. ],
  801. "format": 44,
  802. "isInstanced": true,
  803. "location": 7
  804. },
  805. {
  806. "name": "a_matWorld1",
  807. "defines": [
  808. "USE_INSTANCING"
  809. ],
  810. "format": 44,
  811. "isInstanced": true,
  812. "location": 8
  813. },
  814. {
  815. "name": "a_matWorld2",
  816. "defines": [
  817. "USE_INSTANCING"
  818. ],
  819. "format": 44,
  820. "isInstanced": true,
  821. "location": 9
  822. },
  823. {
  824. "name": "a_lightingMapUVParam",
  825. "defines": [
  826. "USE_INSTANCING",
  827. "CC_USE_LIGHTMAP"
  828. ],
  829. "format": 44,
  830. "isInstanced": true,
  831. "location": 10
  832. },
  833. {
  834. "name": "a_localShadowBiasAndProbeId",
  835. "defines": [
  836. "USE_INSTANCING"
  837. ],
  838. "format": 44,
  839. "isInstanced": true,
  840. "location": 11
  841. },
  842. {
  843. "name": "a_reflectionProbeData",
  844. "defines": [
  845. "USE_INSTANCING",
  846. "CC_USE_REFLECTION_PROBE"
  847. ],
  848. "format": 44,
  849. "isInstanced": true,
  850. "location": 12
  851. },
  852. {
  853. "name": "a_sh_linear_const_r",
  854. "defines": [
  855. "USE_INSTANCING",
  856. "CC_USE_LIGHT_PROBE"
  857. ],
  858. "format": 44,
  859. "isInstanced": true,
  860. "location": 13
  861. },
  862. {
  863. "name": "a_sh_linear_const_g",
  864. "defines": [
  865. "USE_INSTANCING",
  866. "CC_USE_LIGHT_PROBE"
  867. ],
  868. "format": 44,
  869. "isInstanced": true,
  870. "location": 14
  871. },
  872. {
  873. "name": "a_sh_linear_const_b",
  874. "defines": [
  875. "USE_INSTANCING",
  876. "CC_USE_LIGHT_PROBE"
  877. ],
  878. "format": 44,
  879. "isInstanced": true,
  880. "location": 15
  881. },
  882. {
  883. "name": "a_vertexId",
  884. "defines": [
  885. "CC_USE_MORPH"
  886. ],
  887. "format": 11,
  888. "location": 16
  889. }
  890. ],
  891. "varyings": [
  892. {
  893. "name": "v_uv",
  894. "type": 14,
  895. "count": 1,
  896. "defines": [],
  897. "stageFlags": 17,
  898. "location": 0
  899. }
  900. ],
  901. "fragColors": [
  902. {
  903. "name": "fragColor",
  904. "typename": "vec4",
  905. "type": 16,
  906. "count": 1,
  907. "defines": [],
  908. "stageFlags": 16,
  909. "location": 0
  910. }
  911. ],
  912. "descriptors": [
  913. {
  914. "rate": 0,
  915. "blocks": [],
  916. "samplerTextures": [],
  917. "samplers": [],
  918. "textures": [],
  919. "buffers": [],
  920. "images": [],
  921. "subpassInputs": []
  922. },
  923. {
  924. "rate": 1,
  925. "blocks": [
  926. {
  927. "name": "hbaoUBO",
  928. "members": [
  929. {
  930. "name": "uvDepthToEyePosParams",
  931. "type": 16,
  932. "count": 1
  933. },
  934. {
  935. "name": "radiusParam",
  936. "type": 16,
  937. "count": 1
  938. },
  939. {
  940. "name": "miscParam",
  941. "type": 16,
  942. "count": 1
  943. },
  944. {
  945. "name": "randomTexSize",
  946. "type": 16,
  947. "count": 1
  948. },
  949. {
  950. "name": "blurParam",
  951. "type": 16,
  952. "count": 1
  953. }
  954. ],
  955. "defines": [],
  956. "stageFlags": 16,
  957. "binding": 0
  958. }
  959. ],
  960. "samplerTextures": [
  961. {
  962. "name": "RandomTex",
  963. "type": 28,
  964. "count": 1,
  965. "defines": [],
  966. "stageFlags": 16,
  967. "binding": 2
  968. }
  969. ],
  970. "samplers": [],
  971. "textures": [],
  972. "buffers": [],
  973. "images": [],
  974. "subpassInputs": []
  975. },
  976. {
  977. "rate": 2,
  978. "blocks": [],
  979. "samplerTextures": [],
  980. "samplers": [],
  981. "textures": [],
  982. "buffers": [],
  983. "images": [],
  984. "subpassInputs": []
  985. },
  986. {
  987. "rate": 3,
  988. "blocks": [
  989. {
  990. "tags": {
  991. "builtin": "global"
  992. },
  993. "name": "CCGlobal",
  994. "members": [
  995. {
  996. "name": "cc_time",
  997. "typename": "vec4",
  998. "type": 16,
  999. "count": 1,
  1000. "precision": "highp "
  1001. },
  1002. {
  1003. "name": "cc_screenSize",
  1004. "typename": "vec4",
  1005. "type": 16,
  1006. "count": 1,
  1007. "precision": "mediump "
  1008. },
  1009. {
  1010. "name": "cc_nativeSize",
  1011. "typename": "vec4",
  1012. "type": 16,
  1013. "count": 1,
  1014. "precision": "mediump "
  1015. },
  1016. {
  1017. "name": "cc_probeInfo",
  1018. "typename": "vec4",
  1019. "type": 16,
  1020. "count": 1,
  1021. "precision": "mediump "
  1022. },
  1023. {
  1024. "name": "cc_debug_view_mode",
  1025. "typename": "vec4",
  1026. "type": 16,
  1027. "count": 1,
  1028. "precision": "mediump "
  1029. }
  1030. ],
  1031. "defines": [],
  1032. "stageFlags": 17
  1033. },
  1034. {
  1035. "tags": {
  1036. "builtin": "global"
  1037. },
  1038. "name": "CCCamera",
  1039. "members": [
  1040. {
  1041. "name": "cc_matView",
  1042. "typename": "mat4",
  1043. "type": 25,
  1044. "count": 1,
  1045. "precision": "highp "
  1046. },
  1047. {
  1048. "name": "cc_matViewInv",
  1049. "typename": "mat4",
  1050. "type": 25,
  1051. "count": 1,
  1052. "precision": "highp "
  1053. },
  1054. {
  1055. "name": "cc_matProj",
  1056. "typename": "mat4",
  1057. "type": 25,
  1058. "count": 1,
  1059. "precision": "highp "
  1060. },
  1061. {
  1062. "name": "cc_matProjInv",
  1063. "typename": "mat4",
  1064. "type": 25,
  1065. "count": 1,
  1066. "precision": "highp "
  1067. },
  1068. {
  1069. "name": "cc_matViewProj",
  1070. "typename": "mat4",
  1071. "type": 25,
  1072. "count": 1,
  1073. "precision": "highp "
  1074. },
  1075. {
  1076. "name": "cc_matViewProjInv",
  1077. "typename": "mat4",
  1078. "type": 25,
  1079. "count": 1,
  1080. "precision": "highp "
  1081. },
  1082. {
  1083. "name": "cc_cameraPos",
  1084. "typename": "vec4",
  1085. "type": 16,
  1086. "count": 1,
  1087. "precision": "highp "
  1088. },
  1089. {
  1090. "name": "cc_surfaceTransform",
  1091. "typename": "vec4",
  1092. "type": 16,
  1093. "count": 1,
  1094. "precision": "mediump "
  1095. },
  1096. {
  1097. "name": "cc_screenScale",
  1098. "typename": "vec4",
  1099. "type": 16,
  1100. "count": 1,
  1101. "precision": "mediump "
  1102. },
  1103. {
  1104. "name": "cc_exposure",
  1105. "typename": "vec4",
  1106. "type": 16,
  1107. "count": 1,
  1108. "precision": "mediump "
  1109. },
  1110. {
  1111. "name": "cc_mainLitDir",
  1112. "typename": "vec4",
  1113. "type": 16,
  1114. "count": 1,
  1115. "precision": "mediump "
  1116. },
  1117. {
  1118. "name": "cc_mainLitColor",
  1119. "typename": "vec4",
  1120. "type": 16,
  1121. "count": 1,
  1122. "precision": "mediump "
  1123. },
  1124. {
  1125. "name": "cc_ambientSky",
  1126. "typename": "vec4",
  1127. "type": 16,
  1128. "count": 1,
  1129. "precision": "mediump "
  1130. },
  1131. {
  1132. "name": "cc_ambientGround",
  1133. "typename": "vec4",
  1134. "type": 16,
  1135. "count": 1,
  1136. "precision": "mediump "
  1137. },
  1138. {
  1139. "name": "cc_fogColor",
  1140. "typename": "vec4",
  1141. "type": 16,
  1142. "count": 1,
  1143. "precision": "mediump "
  1144. },
  1145. {
  1146. "name": "cc_fogBase",
  1147. "typename": "vec4",
  1148. "type": 16,
  1149. "count": 1,
  1150. "precision": "mediump "
  1151. },
  1152. {
  1153. "name": "cc_fogAdd",
  1154. "typename": "vec4",
  1155. "type": 16,
  1156. "count": 1,
  1157. "precision": "mediump "
  1158. },
  1159. {
  1160. "name": "cc_nearFar",
  1161. "typename": "vec4",
  1162. "type": 16,
  1163. "count": 1,
  1164. "precision": "mediump "
  1165. },
  1166. {
  1167. "name": "cc_viewPort",
  1168. "typename": "vec4",
  1169. "type": 16,
  1170. "count": 1,
  1171. "precision": "mediump "
  1172. }
  1173. ],
  1174. "defines": [],
  1175. "stageFlags": 17
  1176. }
  1177. ],
  1178. "samplerTextures": [
  1179. {
  1180. "name": "DepthTex",
  1181. "type": 28,
  1182. "count": 1,
  1183. "defines": [],
  1184. "stageFlags": 16,
  1185. "binding": 1
  1186. },
  1187. {
  1188. "name": "AOTexNearest",
  1189. "type": 28,
  1190. "count": 1,
  1191. "defines": [],
  1192. "stageFlags": 16,
  1193. "binding": 3
  1194. }
  1195. ],
  1196. "samplers": [],
  1197. "textures": [],
  1198. "buffers": [],
  1199. "images": [],
  1200. "subpassInputs": []
  1201. }
  1202. ],
  1203. "hash": 2988452062,
  1204. "glsl4": {
  1205. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\nlayout(location = 3) in vec4 a_tangent;\n#if CC_USE_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(location = 0) out vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  1206. "frag": "\nprecision highp float;\nprecision highp float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetCameraDepthRH(float depthHS, mat4 matProj)\n{\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n}\nfloat GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n{\n return -matProj32 / (depthHS + matProj22);\n}\n#if CC_USE_FOG != 4\n#endif\nlayout(set = 1, binding = 0) uniform hbaoUBO {\n vec4 uvDepthToEyePosParams;\n vec4 radiusParam;\n vec4 miscParam;\n vec4 randomTexSize;\n vec4 blurParam;\n};\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nlayout(set = 1, binding = 1) uniform sampler2D DepthTex;\nlayout(set = 1, binding = 2) uniform sampler2D RandomTex;\nvec2 fixUV(vec2 uv)\n{\n return saturate(uv);\n}\nfloat GetLinearDepth(vec2 uv) {\n float depthHS = texture(DepthTex, fixUV(uv)).r * 2.0 - 1.0;\n return -GetCameraDepthRH(depthHS, cc_matProj);\n}\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nlayout(set = 1, binding = 3) uniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\nfloat CrossBilateralWeight(float r, float d, float d0, float blurFalloff, float blurDepthThreshold)\n{\n return exp2(-r*r*blurFalloff) * (abs(d - d0) < blurDepthThreshold ? 1.0 : 0.0);\n}\nvec2 SumWeightedAO(int i, float centerCameraDepth, vec2 centerUV, vec2 sampleDir, float blurFalloff, float blurDepthThreshold)\n{\n float r = 2.0 * float(i) + 0.5;\n vec2 sampleUV = centerUV + r * sampleDir * g_InvFullResolution;\n float d = GetLinearDepthBilinear(sampleUV);\n float sampledAO = texture(AOTexNearest, fixUV(sampleUV)).x;\n float w = CrossBilateralWeight(r, d, centerCameraDepth, blurFalloff, blurDepthThreshold);\n return vec2(w * sampledAO, w);\n}\nfloat BlurCore(vec2 uv, vec2 sampleDir)\n{\n float ao = texture(AOTexNearest, uv).x;\n float weight = 1.0;\n float centerCameraDepth = GetLinearDepth(uv);\n for(int i = -HALF_KERNEL_RADIUS; i <= HALF_KERNEL_RADIUS; i++)\n {\n vec2 aoAndW = SumWeightedAO(i, centerCameraDepth, uv, sampleDir, g_BlurFallOff, g_BlurDepthThreshold);\n ao += aoAndW.x;\n weight += aoAndW.y;\n }\n return ao / weight;\n}\n#define g_AOSaturation blurParam.w\nlayout(location = 0) in vec2 v_uv;\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n float ao = BlurCore(v_uv, vec2(1.0, 0.0));\n fragColor = vec4(ao, ao, ao, 1.0);\n}"
  1207. },
  1208. "glsl3": {
  1209. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nout vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  1210. "frag": "\nprecision highp float;\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetCameraDepthRH(float depthHS, mat4 matProj)\n{\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n}\nfloat GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n{\n return -matProj32 / (depthHS + matProj22);\n}\n#if CC_USE_FOG != 4\n#endif\nlayout(std140) uniform hbaoUBO {\n vec4 uvDepthToEyePosParams;\n vec4 radiusParam;\n vec4 miscParam;\n vec4 randomTexSize;\n vec4 blurParam;\n};\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nuniform sampler2D DepthTex;\nuniform sampler2D RandomTex;\nvec2 fixUV(vec2 uv)\n{\n return saturate(uv);\n}\nfloat GetLinearDepth(vec2 uv) {\n float depthHS = texture(DepthTex, fixUV(uv)).r * 2.0 - 1.0;\n return -GetCameraDepthRH(depthHS, cc_matProj);\n}\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nuniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\nfloat CrossBilateralWeight(float r, float d, float d0, float blurFalloff, float blurDepthThreshold)\n{\n return exp2(-r*r*blurFalloff) * (abs(d - d0) < blurDepthThreshold ? 1.0 : 0.0);\n}\nvec2 SumWeightedAO(int i, float centerCameraDepth, vec2 centerUV, vec2 sampleDir, float blurFalloff, float blurDepthThreshold)\n{\n float r = 2.0 * float(i) + 0.5;\n vec2 sampleUV = centerUV + r * sampleDir * g_InvFullResolution;\n float d = GetLinearDepthBilinear(sampleUV);\n float sampledAO = texture(AOTexNearest, fixUV(sampleUV)).x;\n float w = CrossBilateralWeight(r, d, centerCameraDepth, blurFalloff, blurDepthThreshold);\n return vec2(w * sampledAO, w);\n}\nfloat BlurCore(vec2 uv, vec2 sampleDir)\n{\n float ao = texture(AOTexNearest, uv).x;\n float weight = 1.0;\n float centerCameraDepth = GetLinearDepth(uv);\n for(int i = -HALF_KERNEL_RADIUS; i <= HALF_KERNEL_RADIUS; i++)\n {\n vec2 aoAndW = SumWeightedAO(i, centerCameraDepth, uv, sampleDir, g_BlurFallOff, g_BlurDepthThreshold);\n ao += aoAndW.x;\n weight += aoAndW.y;\n }\n return ao / weight;\n}\n#define g_AOSaturation blurParam.w\nin vec2 v_uv;\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n float ao = BlurCore(v_uv, vec2(1.0, 0.0));\n fragColor = vec4(ao, ao, ao, 1.0);\n}"
  1211. },
  1212. "glsl1": {
  1213. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\nuniform highp vec4 cc_cameraPos;\nvarying vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  1214. "frag": "\nprecision highp float;\nprecision highp float;\nuniform mediump vec4 cc_screenSize;\nuniform highp mat4 cc_matProj;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetCameraDepthRH(float depthHS, mat4 matProj)\n{\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n}\nfloat GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n{\n return -matProj32 / (depthHS + matProj22);\n}\n#if CC_USE_FOG != 4\n#endif\n uniform vec4 uvDepthToEyePosParams;\n uniform vec4 radiusParam;\n uniform vec4 miscParam;\n uniform vec4 blurParam;\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nuniform sampler2D DepthTex;\nuniform sampler2D RandomTex;\nvec2 fixUV(vec2 uv)\n{\n return saturate(uv);\n}\nfloat GetLinearDepth(vec2 uv) {\n float depthHS = texture2D(DepthTex, fixUV(uv)).r * 2.0 - 1.0;\n return -GetCameraDepthRH(depthHS, cc_matProj);\n}\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nuniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\nfloat CrossBilateralWeight(float r, float d, float d0, float blurFalloff, float blurDepthThreshold)\n{\n return exp2(-r*r*blurFalloff) * (abs(d - d0) < blurDepthThreshold ? 1.0 : 0.0);\n}\nvec2 SumWeightedAO(int i, float centerCameraDepth, vec2 centerUV, vec2 sampleDir, float blurFalloff, float blurDepthThreshold)\n{\n float r = 2.0 * float(i) + 0.5;\n vec2 sampleUV = centerUV + r * sampleDir * g_InvFullResolution;\n float d = GetLinearDepthBilinear(sampleUV);\n float sampledAO = texture2D(AOTexNearest, fixUV(sampleUV)).x;\n float w = CrossBilateralWeight(r, d, centerCameraDepth, blurFalloff, blurDepthThreshold);\n return vec2(w * sampledAO, w);\n}\nfloat BlurCore(vec2 uv, vec2 sampleDir)\n{\n float ao = texture2D(AOTexNearest, uv).x;\n float weight = 1.0;\n float centerCameraDepth = GetLinearDepth(uv);\n for(int i = -HALF_KERNEL_RADIUS; i <= HALF_KERNEL_RADIUS; i++)\n {\n vec2 aoAndW = SumWeightedAO(i, centerCameraDepth, uv, sampleDir, g_BlurFallOff, g_BlurDepthThreshold);\n ao += aoAndW.x;\n weight += aoAndW.y;\n }\n return ao / weight;\n}\n#define g_AOSaturation blurParam.w\nvarying vec2 v_uv;\nvoid main () {\n float ao = BlurCore(v_uv, vec2(1.0, 0.0));\n gl_FragColor = vec4(ao, ao, ao, 1.0);\n}"
  1215. },
  1216. "builtins": {
  1217. "globals": {
  1218. "blocks": [
  1219. {
  1220. "name": "CCGlobal",
  1221. "defines": []
  1222. },
  1223. {
  1224. "name": "CCCamera",
  1225. "defines": []
  1226. }
  1227. ],
  1228. "samplerTextures": [],
  1229. "buffers": [],
  1230. "images": []
  1231. },
  1232. "locals": {
  1233. "blocks": [],
  1234. "samplerTextures": [],
  1235. "buffers": [],
  1236. "images": []
  1237. },
  1238. "statistics": {
  1239. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 42,
  1240. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 47
  1241. }
  1242. },
  1243. "defines": [
  1244. {
  1245. "name": "USE_INSTANCING",
  1246. "type": "boolean",
  1247. "defines": [],
  1248. "editor": {
  1249. "elevated": true
  1250. }
  1251. },
  1252. {
  1253. "name": "CC_USE_SKINNING",
  1254. "type": "boolean",
  1255. "defines": []
  1256. },
  1257. {
  1258. "name": "CC_USE_BAKED_ANIMATION",
  1259. "type": "boolean",
  1260. "defines": [
  1261. "USE_INSTANCING"
  1262. ]
  1263. },
  1264. {
  1265. "name": "CC_USE_LIGHTMAP",
  1266. "type": "boolean",
  1267. "defines": [
  1268. "USE_INSTANCING"
  1269. ]
  1270. },
  1271. {
  1272. "name": "CC_USE_REFLECTION_PROBE",
  1273. "type": "boolean",
  1274. "defines": [
  1275. "USE_INSTANCING"
  1276. ]
  1277. },
  1278. {
  1279. "name": "CC_RECEIVE_SHADOW",
  1280. "type": "boolean",
  1281. "defines": [
  1282. "USE_INSTANCING"
  1283. ]
  1284. },
  1285. {
  1286. "name": "CC_USE_LIGHT_PROBE",
  1287. "type": "boolean",
  1288. "defines": [
  1289. "USE_INSTANCING"
  1290. ]
  1291. },
  1292. {
  1293. "name": "CC_USE_MORPH",
  1294. "type": "boolean",
  1295. "defines": []
  1296. },
  1297. {
  1298. "name": "CC_USE_FOG",
  1299. "type": "number",
  1300. "defines": [],
  1301. "range": [
  1302. 0,
  1303. 4
  1304. ]
  1305. }
  1306. ],
  1307. "name": "pipeline/post-process/hbao|hbao-vs|blurx-fs"
  1308. },
  1309. {
  1310. "blocks": [
  1311. {
  1312. "name": "hbaoUBO",
  1313. "members": [
  1314. {
  1315. "name": "uvDepthToEyePosParams",
  1316. "type": 16,
  1317. "count": 1
  1318. },
  1319. {
  1320. "name": "radiusParam",
  1321. "type": 16,
  1322. "count": 1
  1323. },
  1324. {
  1325. "name": "miscParam",
  1326. "type": 16,
  1327. "count": 1
  1328. },
  1329. {
  1330. "name": "randomTexSize",
  1331. "type": 16,
  1332. "count": 1
  1333. },
  1334. {
  1335. "name": "blurParam",
  1336. "type": 16,
  1337. "count": 1
  1338. }
  1339. ],
  1340. "defines": [],
  1341. "stageFlags": 16,
  1342. "binding": 0
  1343. }
  1344. ],
  1345. "samplerTextures": [
  1346. {
  1347. "name": "RandomTex",
  1348. "type": 28,
  1349. "count": 1,
  1350. "defines": [],
  1351. "stageFlags": 16,
  1352. "binding": 2
  1353. }
  1354. ],
  1355. "samplers": [],
  1356. "textures": [],
  1357. "buffers": [],
  1358. "images": [],
  1359. "subpassInputs": [],
  1360. "attributes": [
  1361. {
  1362. "name": "a_position",
  1363. "defines": [],
  1364. "format": 32,
  1365. "location": 0
  1366. },
  1367. {
  1368. "name": "a_normal",
  1369. "defines": [],
  1370. "format": 32,
  1371. "location": 1
  1372. },
  1373. {
  1374. "name": "a_texCoord",
  1375. "defines": [],
  1376. "format": 21,
  1377. "location": 2
  1378. },
  1379. {
  1380. "name": "a_tangent",
  1381. "defines": [],
  1382. "format": 44,
  1383. "location": 3
  1384. },
  1385. {
  1386. "name": "a_joints",
  1387. "defines": [
  1388. "CC_USE_SKINNING"
  1389. ],
  1390. "location": 4
  1391. },
  1392. {
  1393. "name": "a_weights",
  1394. "defines": [
  1395. "CC_USE_SKINNING"
  1396. ],
  1397. "format": 44,
  1398. "location": 5
  1399. },
  1400. {
  1401. "name": "a_jointAnimInfo",
  1402. "defines": [
  1403. "USE_INSTANCING",
  1404. "CC_USE_BAKED_ANIMATION"
  1405. ],
  1406. "format": 44,
  1407. "isInstanced": true,
  1408. "location": 6
  1409. },
  1410. {
  1411. "name": "a_matWorld0",
  1412. "defines": [
  1413. "USE_INSTANCING"
  1414. ],
  1415. "format": 44,
  1416. "isInstanced": true,
  1417. "location": 7
  1418. },
  1419. {
  1420. "name": "a_matWorld1",
  1421. "defines": [
  1422. "USE_INSTANCING"
  1423. ],
  1424. "format": 44,
  1425. "isInstanced": true,
  1426. "location": 8
  1427. },
  1428. {
  1429. "name": "a_matWorld2",
  1430. "defines": [
  1431. "USE_INSTANCING"
  1432. ],
  1433. "format": 44,
  1434. "isInstanced": true,
  1435. "location": 9
  1436. },
  1437. {
  1438. "name": "a_lightingMapUVParam",
  1439. "defines": [
  1440. "USE_INSTANCING",
  1441. "CC_USE_LIGHTMAP"
  1442. ],
  1443. "format": 44,
  1444. "isInstanced": true,
  1445. "location": 10
  1446. },
  1447. {
  1448. "name": "a_localShadowBiasAndProbeId",
  1449. "defines": [
  1450. "USE_INSTANCING"
  1451. ],
  1452. "format": 44,
  1453. "isInstanced": true,
  1454. "location": 11
  1455. },
  1456. {
  1457. "name": "a_reflectionProbeData",
  1458. "defines": [
  1459. "USE_INSTANCING",
  1460. "CC_USE_REFLECTION_PROBE"
  1461. ],
  1462. "format": 44,
  1463. "isInstanced": true,
  1464. "location": 12
  1465. },
  1466. {
  1467. "name": "a_sh_linear_const_r",
  1468. "defines": [
  1469. "USE_INSTANCING",
  1470. "CC_USE_LIGHT_PROBE"
  1471. ],
  1472. "format": 44,
  1473. "isInstanced": true,
  1474. "location": 13
  1475. },
  1476. {
  1477. "name": "a_sh_linear_const_g",
  1478. "defines": [
  1479. "USE_INSTANCING",
  1480. "CC_USE_LIGHT_PROBE"
  1481. ],
  1482. "format": 44,
  1483. "isInstanced": true,
  1484. "location": 14
  1485. },
  1486. {
  1487. "name": "a_sh_linear_const_b",
  1488. "defines": [
  1489. "USE_INSTANCING",
  1490. "CC_USE_LIGHT_PROBE"
  1491. ],
  1492. "format": 44,
  1493. "isInstanced": true,
  1494. "location": 15
  1495. },
  1496. {
  1497. "name": "a_vertexId",
  1498. "defines": [
  1499. "CC_USE_MORPH"
  1500. ],
  1501. "format": 11,
  1502. "location": 16
  1503. }
  1504. ],
  1505. "varyings": [
  1506. {
  1507. "name": "v_uv",
  1508. "type": 14,
  1509. "count": 1,
  1510. "defines": [],
  1511. "stageFlags": 17,
  1512. "location": 0
  1513. }
  1514. ],
  1515. "fragColors": [
  1516. {
  1517. "name": "fragColor",
  1518. "typename": "vec4",
  1519. "type": 16,
  1520. "count": 1,
  1521. "defines": [],
  1522. "stageFlags": 16,
  1523. "location": 0
  1524. }
  1525. ],
  1526. "descriptors": [
  1527. {
  1528. "rate": 0,
  1529. "blocks": [],
  1530. "samplerTextures": [],
  1531. "samplers": [],
  1532. "textures": [],
  1533. "buffers": [],
  1534. "images": [],
  1535. "subpassInputs": []
  1536. },
  1537. {
  1538. "rate": 1,
  1539. "blocks": [
  1540. {
  1541. "name": "hbaoUBO",
  1542. "members": [
  1543. {
  1544. "name": "uvDepthToEyePosParams",
  1545. "type": 16,
  1546. "count": 1
  1547. },
  1548. {
  1549. "name": "radiusParam",
  1550. "type": 16,
  1551. "count": 1
  1552. },
  1553. {
  1554. "name": "miscParam",
  1555. "type": 16,
  1556. "count": 1
  1557. },
  1558. {
  1559. "name": "randomTexSize",
  1560. "type": 16,
  1561. "count": 1
  1562. },
  1563. {
  1564. "name": "blurParam",
  1565. "type": 16,
  1566. "count": 1
  1567. }
  1568. ],
  1569. "defines": [],
  1570. "stageFlags": 16,
  1571. "binding": 0
  1572. }
  1573. ],
  1574. "samplerTextures": [
  1575. {
  1576. "name": "RandomTex",
  1577. "type": 28,
  1578. "count": 1,
  1579. "defines": [],
  1580. "stageFlags": 16,
  1581. "binding": 2
  1582. }
  1583. ],
  1584. "samplers": [],
  1585. "textures": [],
  1586. "buffers": [],
  1587. "images": [],
  1588. "subpassInputs": []
  1589. },
  1590. {
  1591. "rate": 2,
  1592. "blocks": [],
  1593. "samplerTextures": [],
  1594. "samplers": [],
  1595. "textures": [],
  1596. "buffers": [],
  1597. "images": [],
  1598. "subpassInputs": []
  1599. },
  1600. {
  1601. "rate": 3,
  1602. "blocks": [
  1603. {
  1604. "tags": {
  1605. "builtin": "global"
  1606. },
  1607. "name": "CCGlobal",
  1608. "members": [
  1609. {
  1610. "name": "cc_time",
  1611. "typename": "vec4",
  1612. "type": 16,
  1613. "count": 1,
  1614. "precision": "highp "
  1615. },
  1616. {
  1617. "name": "cc_screenSize",
  1618. "typename": "vec4",
  1619. "type": 16,
  1620. "count": 1,
  1621. "precision": "mediump "
  1622. },
  1623. {
  1624. "name": "cc_nativeSize",
  1625. "typename": "vec4",
  1626. "type": 16,
  1627. "count": 1,
  1628. "precision": "mediump "
  1629. },
  1630. {
  1631. "name": "cc_probeInfo",
  1632. "typename": "vec4",
  1633. "type": 16,
  1634. "count": 1,
  1635. "precision": "mediump "
  1636. },
  1637. {
  1638. "name": "cc_debug_view_mode",
  1639. "typename": "vec4",
  1640. "type": 16,
  1641. "count": 1,
  1642. "precision": "mediump "
  1643. }
  1644. ],
  1645. "defines": [],
  1646. "stageFlags": 17
  1647. },
  1648. {
  1649. "tags": {
  1650. "builtin": "global"
  1651. },
  1652. "name": "CCCamera",
  1653. "members": [
  1654. {
  1655. "name": "cc_matView",
  1656. "typename": "mat4",
  1657. "type": 25,
  1658. "count": 1,
  1659. "precision": "highp "
  1660. },
  1661. {
  1662. "name": "cc_matViewInv",
  1663. "typename": "mat4",
  1664. "type": 25,
  1665. "count": 1,
  1666. "precision": "highp "
  1667. },
  1668. {
  1669. "name": "cc_matProj",
  1670. "typename": "mat4",
  1671. "type": 25,
  1672. "count": 1,
  1673. "precision": "highp "
  1674. },
  1675. {
  1676. "name": "cc_matProjInv",
  1677. "typename": "mat4",
  1678. "type": 25,
  1679. "count": 1,
  1680. "precision": "highp "
  1681. },
  1682. {
  1683. "name": "cc_matViewProj",
  1684. "typename": "mat4",
  1685. "type": 25,
  1686. "count": 1,
  1687. "precision": "highp "
  1688. },
  1689. {
  1690. "name": "cc_matViewProjInv",
  1691. "typename": "mat4",
  1692. "type": 25,
  1693. "count": 1,
  1694. "precision": "highp "
  1695. },
  1696. {
  1697. "name": "cc_cameraPos",
  1698. "typename": "vec4",
  1699. "type": 16,
  1700. "count": 1,
  1701. "precision": "highp "
  1702. },
  1703. {
  1704. "name": "cc_surfaceTransform",
  1705. "typename": "vec4",
  1706. "type": 16,
  1707. "count": 1,
  1708. "precision": "mediump "
  1709. },
  1710. {
  1711. "name": "cc_screenScale",
  1712. "typename": "vec4",
  1713. "type": 16,
  1714. "count": 1,
  1715. "precision": "mediump "
  1716. },
  1717. {
  1718. "name": "cc_exposure",
  1719. "typename": "vec4",
  1720. "type": 16,
  1721. "count": 1,
  1722. "precision": "mediump "
  1723. },
  1724. {
  1725. "name": "cc_mainLitDir",
  1726. "typename": "vec4",
  1727. "type": 16,
  1728. "count": 1,
  1729. "precision": "mediump "
  1730. },
  1731. {
  1732. "name": "cc_mainLitColor",
  1733. "typename": "vec4",
  1734. "type": 16,
  1735. "count": 1,
  1736. "precision": "mediump "
  1737. },
  1738. {
  1739. "name": "cc_ambientSky",
  1740. "typename": "vec4",
  1741. "type": 16,
  1742. "count": 1,
  1743. "precision": "mediump "
  1744. },
  1745. {
  1746. "name": "cc_ambientGround",
  1747. "typename": "vec4",
  1748. "type": 16,
  1749. "count": 1,
  1750. "precision": "mediump "
  1751. },
  1752. {
  1753. "name": "cc_fogColor",
  1754. "typename": "vec4",
  1755. "type": 16,
  1756. "count": 1,
  1757. "precision": "mediump "
  1758. },
  1759. {
  1760. "name": "cc_fogBase",
  1761. "typename": "vec4",
  1762. "type": 16,
  1763. "count": 1,
  1764. "precision": "mediump "
  1765. },
  1766. {
  1767. "name": "cc_fogAdd",
  1768. "typename": "vec4",
  1769. "type": 16,
  1770. "count": 1,
  1771. "precision": "mediump "
  1772. },
  1773. {
  1774. "name": "cc_nearFar",
  1775. "typename": "vec4",
  1776. "type": 16,
  1777. "count": 1,
  1778. "precision": "mediump "
  1779. },
  1780. {
  1781. "name": "cc_viewPort",
  1782. "typename": "vec4",
  1783. "type": 16,
  1784. "count": 1,
  1785. "precision": "mediump "
  1786. }
  1787. ],
  1788. "defines": [],
  1789. "stageFlags": 17
  1790. }
  1791. ],
  1792. "samplerTextures": [
  1793. {
  1794. "name": "DepthTex",
  1795. "type": 28,
  1796. "count": 1,
  1797. "defines": [],
  1798. "stageFlags": 16,
  1799. "binding": 1
  1800. },
  1801. {
  1802. "name": "AOTexNearest",
  1803. "type": 28,
  1804. "count": 1,
  1805. "defines": [],
  1806. "stageFlags": 16,
  1807. "binding": 3
  1808. }
  1809. ],
  1810. "samplers": [],
  1811. "textures": [],
  1812. "buffers": [],
  1813. "images": [],
  1814. "subpassInputs": []
  1815. }
  1816. ],
  1817. "hash": 3415474874,
  1818. "glsl4": {
  1819. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\nlayout(location = 3) in vec4 a_tangent;\n#if CC_USE_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(location = 0) out vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  1820. "frag": "\nprecision highp float;\nprecision highp float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetCameraDepthRH(float depthHS, mat4 matProj)\n{\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n}\nfloat GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n{\n return -matProj32 / (depthHS + matProj22);\n}\n#if CC_USE_FOG != 4\n#endif\nlayout(set = 1, binding = 0) uniform hbaoUBO {\n vec4 uvDepthToEyePosParams;\n vec4 radiusParam;\n vec4 miscParam;\n vec4 randomTexSize;\n vec4 blurParam;\n};\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nlayout(set = 1, binding = 1) uniform sampler2D DepthTex;\nlayout(set = 1, binding = 2) uniform sampler2D RandomTex;\nvec2 fixUV(vec2 uv)\n{\n return saturate(uv);\n}\nfloat GetLinearDepth(vec2 uv) {\n float depthHS = texture(DepthTex, fixUV(uv)).r * 2.0 - 1.0;\n return -GetCameraDepthRH(depthHS, cc_matProj);\n}\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nlayout(set = 1, binding = 3) uniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\nfloat CrossBilateralWeight(float r, float d, float d0, float blurFalloff, float blurDepthThreshold)\n{\n return exp2(-r*r*blurFalloff) * (abs(d - d0) < blurDepthThreshold ? 1.0 : 0.0);\n}\nvec2 SumWeightedAO(int i, float centerCameraDepth, vec2 centerUV, vec2 sampleDir, float blurFalloff, float blurDepthThreshold)\n{\n float r = 2.0 * float(i) + 0.5;\n vec2 sampleUV = centerUV + r * sampleDir * g_InvFullResolution;\n float d = GetLinearDepthBilinear(sampleUV);\n float sampledAO = texture(AOTexNearest, fixUV(sampleUV)).x;\n float w = CrossBilateralWeight(r, d, centerCameraDepth, blurFalloff, blurDepthThreshold);\n return vec2(w * sampledAO, w);\n}\nfloat BlurCore(vec2 uv, vec2 sampleDir)\n{\n float ao = texture(AOTexNearest, uv).x;\n float weight = 1.0;\n float centerCameraDepth = GetLinearDepth(uv);\n for(int i = -HALF_KERNEL_RADIUS; i <= HALF_KERNEL_RADIUS; i++)\n {\n vec2 aoAndW = SumWeightedAO(i, centerCameraDepth, uv, sampleDir, g_BlurFallOff, g_BlurDepthThreshold);\n ao += aoAndW.x;\n weight += aoAndW.y;\n }\n return ao / weight;\n}\n#define g_AOSaturation blurParam.w\nlayout(location = 0) in vec2 v_uv;\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n float ao = BlurCore(v_uv, vec2(0.0, 1.0));\n fragColor = vec4(ao, ao, ao, 1.0);\n}"
  1821. },
  1822. "glsl3": {
  1823. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nout vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  1824. "frag": "\nprecision highp float;\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetCameraDepthRH(float depthHS, mat4 matProj)\n{\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n}\nfloat GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n{\n return -matProj32 / (depthHS + matProj22);\n}\n#if CC_USE_FOG != 4\n#endif\nlayout(std140) uniform hbaoUBO {\n vec4 uvDepthToEyePosParams;\n vec4 radiusParam;\n vec4 miscParam;\n vec4 randomTexSize;\n vec4 blurParam;\n};\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nuniform sampler2D DepthTex;\nuniform sampler2D RandomTex;\nvec2 fixUV(vec2 uv)\n{\n return saturate(uv);\n}\nfloat GetLinearDepth(vec2 uv) {\n float depthHS = texture(DepthTex, fixUV(uv)).r * 2.0 - 1.0;\n return -GetCameraDepthRH(depthHS, cc_matProj);\n}\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nuniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\nfloat CrossBilateralWeight(float r, float d, float d0, float blurFalloff, float blurDepthThreshold)\n{\n return exp2(-r*r*blurFalloff) * (abs(d - d0) < blurDepthThreshold ? 1.0 : 0.0);\n}\nvec2 SumWeightedAO(int i, float centerCameraDepth, vec2 centerUV, vec2 sampleDir, float blurFalloff, float blurDepthThreshold)\n{\n float r = 2.0 * float(i) + 0.5;\n vec2 sampleUV = centerUV + r * sampleDir * g_InvFullResolution;\n float d = GetLinearDepthBilinear(sampleUV);\n float sampledAO = texture(AOTexNearest, fixUV(sampleUV)).x;\n float w = CrossBilateralWeight(r, d, centerCameraDepth, blurFalloff, blurDepthThreshold);\n return vec2(w * sampledAO, w);\n}\nfloat BlurCore(vec2 uv, vec2 sampleDir)\n{\n float ao = texture(AOTexNearest, uv).x;\n float weight = 1.0;\n float centerCameraDepth = GetLinearDepth(uv);\n for(int i = -HALF_KERNEL_RADIUS; i <= HALF_KERNEL_RADIUS; i++)\n {\n vec2 aoAndW = SumWeightedAO(i, centerCameraDepth, uv, sampleDir, g_BlurFallOff, g_BlurDepthThreshold);\n ao += aoAndW.x;\n weight += aoAndW.y;\n }\n return ao / weight;\n}\n#define g_AOSaturation blurParam.w\nin vec2 v_uv;\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n float ao = BlurCore(v_uv, vec2(0.0, 1.0));\n fragColor = vec4(ao, ao, ao, 1.0);\n}"
  1825. },
  1826. "glsl1": {
  1827. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\nuniform highp vec4 cc_cameraPos;\nvarying vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  1828. "frag": "\nprecision highp float;\nprecision highp float;\nuniform mediump vec4 cc_screenSize;\nuniform highp mat4 cc_matProj;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetCameraDepthRH(float depthHS, mat4 matProj)\n{\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n}\nfloat GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n{\n return -matProj32 / (depthHS + matProj22);\n}\n#if CC_USE_FOG != 4\n#endif\n uniform vec4 uvDepthToEyePosParams;\n uniform vec4 radiusParam;\n uniform vec4 miscParam;\n uniform vec4 blurParam;\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nuniform sampler2D DepthTex;\nuniform sampler2D RandomTex;\nvec2 fixUV(vec2 uv)\n{\n return saturate(uv);\n}\nfloat GetLinearDepth(vec2 uv) {\n float depthHS = texture2D(DepthTex, fixUV(uv)).r * 2.0 - 1.0;\n return -GetCameraDepthRH(depthHS, cc_matProj);\n}\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nuniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\nfloat CrossBilateralWeight(float r, float d, float d0, float blurFalloff, float blurDepthThreshold)\n{\n return exp2(-r*r*blurFalloff) * (abs(d - d0) < blurDepthThreshold ? 1.0 : 0.0);\n}\nvec2 SumWeightedAO(int i, float centerCameraDepth, vec2 centerUV, vec2 sampleDir, float blurFalloff, float blurDepthThreshold)\n{\n float r = 2.0 * float(i) + 0.5;\n vec2 sampleUV = centerUV + r * sampleDir * g_InvFullResolution;\n float d = GetLinearDepthBilinear(sampleUV);\n float sampledAO = texture2D(AOTexNearest, fixUV(sampleUV)).x;\n float w = CrossBilateralWeight(r, d, centerCameraDepth, blurFalloff, blurDepthThreshold);\n return vec2(w * sampledAO, w);\n}\nfloat BlurCore(vec2 uv, vec2 sampleDir)\n{\n float ao = texture2D(AOTexNearest, uv).x;\n float weight = 1.0;\n float centerCameraDepth = GetLinearDepth(uv);\n for(int i = -HALF_KERNEL_RADIUS; i <= HALF_KERNEL_RADIUS; i++)\n {\n vec2 aoAndW = SumWeightedAO(i, centerCameraDepth, uv, sampleDir, g_BlurFallOff, g_BlurDepthThreshold);\n ao += aoAndW.x;\n weight += aoAndW.y;\n }\n return ao / weight;\n}\n#define g_AOSaturation blurParam.w\nvarying vec2 v_uv;\nvoid main () {\n float ao = BlurCore(v_uv, vec2(0.0, 1.0));\n gl_FragColor = vec4(ao, ao, ao, 1.0);\n}"
  1829. },
  1830. "builtins": {
  1831. "globals": {
  1832. "blocks": [
  1833. {
  1834. "name": "CCGlobal",
  1835. "defines": []
  1836. },
  1837. {
  1838. "name": "CCCamera",
  1839. "defines": []
  1840. }
  1841. ],
  1842. "samplerTextures": [],
  1843. "buffers": [],
  1844. "images": []
  1845. },
  1846. "locals": {
  1847. "blocks": [],
  1848. "samplerTextures": [],
  1849. "buffers": [],
  1850. "images": []
  1851. },
  1852. "statistics": {
  1853. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 42,
  1854. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 47
  1855. }
  1856. },
  1857. "defines": [
  1858. {
  1859. "name": "USE_INSTANCING",
  1860. "type": "boolean",
  1861. "defines": [],
  1862. "editor": {
  1863. "elevated": true
  1864. }
  1865. },
  1866. {
  1867. "name": "CC_USE_SKINNING",
  1868. "type": "boolean",
  1869. "defines": []
  1870. },
  1871. {
  1872. "name": "CC_USE_BAKED_ANIMATION",
  1873. "type": "boolean",
  1874. "defines": [
  1875. "USE_INSTANCING"
  1876. ]
  1877. },
  1878. {
  1879. "name": "CC_USE_LIGHTMAP",
  1880. "type": "boolean",
  1881. "defines": [
  1882. "USE_INSTANCING"
  1883. ]
  1884. },
  1885. {
  1886. "name": "CC_USE_REFLECTION_PROBE",
  1887. "type": "boolean",
  1888. "defines": [
  1889. "USE_INSTANCING"
  1890. ]
  1891. },
  1892. {
  1893. "name": "CC_RECEIVE_SHADOW",
  1894. "type": "boolean",
  1895. "defines": [
  1896. "USE_INSTANCING"
  1897. ]
  1898. },
  1899. {
  1900. "name": "CC_USE_LIGHT_PROBE",
  1901. "type": "boolean",
  1902. "defines": [
  1903. "USE_INSTANCING"
  1904. ]
  1905. },
  1906. {
  1907. "name": "CC_USE_MORPH",
  1908. "type": "boolean",
  1909. "defines": []
  1910. },
  1911. {
  1912. "name": "CC_USE_FOG",
  1913. "type": "number",
  1914. "defines": [],
  1915. "range": [
  1916. 0,
  1917. 4
  1918. ]
  1919. }
  1920. ],
  1921. "name": "pipeline/post-process/hbao|hbao-vs|blury-fs"
  1922. },
  1923. {
  1924. "blocks": [
  1925. {
  1926. "name": "hbaoUBO",
  1927. "members": [
  1928. {
  1929. "name": "uvDepthToEyePosParams",
  1930. "type": 16,
  1931. "count": 1
  1932. },
  1933. {
  1934. "name": "radiusParam",
  1935. "type": 16,
  1936. "count": 1
  1937. },
  1938. {
  1939. "name": "miscParam",
  1940. "type": 16,
  1941. "count": 1
  1942. },
  1943. {
  1944. "name": "randomTexSize",
  1945. "type": 16,
  1946. "count": 1
  1947. },
  1948. {
  1949. "name": "blurParam",
  1950. "type": 16,
  1951. "count": 1
  1952. }
  1953. ],
  1954. "defines": [],
  1955. "stageFlags": 16,
  1956. "binding": 0
  1957. }
  1958. ],
  1959. "samplerTextures": [
  1960. {
  1961. "name": "RandomTex",
  1962. "type": 28,
  1963. "count": 1,
  1964. "defines": [],
  1965. "stageFlags": 16,
  1966. "binding": 2
  1967. }
  1968. ],
  1969. "samplers": [],
  1970. "textures": [],
  1971. "buffers": [],
  1972. "images": [],
  1973. "subpassInputs": [],
  1974. "attributes": [
  1975. {
  1976. "name": "a_position",
  1977. "defines": [],
  1978. "format": 32,
  1979. "location": 0
  1980. },
  1981. {
  1982. "name": "a_normal",
  1983. "defines": [],
  1984. "format": 32,
  1985. "location": 1
  1986. },
  1987. {
  1988. "name": "a_texCoord",
  1989. "defines": [],
  1990. "format": 21,
  1991. "location": 2
  1992. },
  1993. {
  1994. "name": "a_tangent",
  1995. "defines": [],
  1996. "format": 44,
  1997. "location": 3
  1998. },
  1999. {
  2000. "name": "a_joints",
  2001. "defines": [
  2002. "CC_USE_SKINNING"
  2003. ],
  2004. "location": 4
  2005. },
  2006. {
  2007. "name": "a_weights",
  2008. "defines": [
  2009. "CC_USE_SKINNING"
  2010. ],
  2011. "format": 44,
  2012. "location": 5
  2013. },
  2014. {
  2015. "name": "a_jointAnimInfo",
  2016. "defines": [
  2017. "USE_INSTANCING",
  2018. "CC_USE_BAKED_ANIMATION"
  2019. ],
  2020. "format": 44,
  2021. "isInstanced": true,
  2022. "location": 6
  2023. },
  2024. {
  2025. "name": "a_matWorld0",
  2026. "defines": [
  2027. "USE_INSTANCING"
  2028. ],
  2029. "format": 44,
  2030. "isInstanced": true,
  2031. "location": 7
  2032. },
  2033. {
  2034. "name": "a_matWorld1",
  2035. "defines": [
  2036. "USE_INSTANCING"
  2037. ],
  2038. "format": 44,
  2039. "isInstanced": true,
  2040. "location": 8
  2041. },
  2042. {
  2043. "name": "a_matWorld2",
  2044. "defines": [
  2045. "USE_INSTANCING"
  2046. ],
  2047. "format": 44,
  2048. "isInstanced": true,
  2049. "location": 9
  2050. },
  2051. {
  2052. "name": "a_lightingMapUVParam",
  2053. "defines": [
  2054. "USE_INSTANCING",
  2055. "CC_USE_LIGHTMAP"
  2056. ],
  2057. "format": 44,
  2058. "isInstanced": true,
  2059. "location": 10
  2060. },
  2061. {
  2062. "name": "a_localShadowBiasAndProbeId",
  2063. "defines": [
  2064. "USE_INSTANCING"
  2065. ],
  2066. "format": 44,
  2067. "isInstanced": true,
  2068. "location": 11
  2069. },
  2070. {
  2071. "name": "a_reflectionProbeData",
  2072. "defines": [
  2073. "USE_INSTANCING",
  2074. "CC_USE_REFLECTION_PROBE"
  2075. ],
  2076. "format": 44,
  2077. "isInstanced": true,
  2078. "location": 12
  2079. },
  2080. {
  2081. "name": "a_sh_linear_const_r",
  2082. "defines": [
  2083. "USE_INSTANCING",
  2084. "CC_USE_LIGHT_PROBE"
  2085. ],
  2086. "format": 44,
  2087. "isInstanced": true,
  2088. "location": 13
  2089. },
  2090. {
  2091. "name": "a_sh_linear_const_g",
  2092. "defines": [
  2093. "USE_INSTANCING",
  2094. "CC_USE_LIGHT_PROBE"
  2095. ],
  2096. "format": 44,
  2097. "isInstanced": true,
  2098. "location": 14
  2099. },
  2100. {
  2101. "name": "a_sh_linear_const_b",
  2102. "defines": [
  2103. "USE_INSTANCING",
  2104. "CC_USE_LIGHT_PROBE"
  2105. ],
  2106. "format": 44,
  2107. "isInstanced": true,
  2108. "location": 15
  2109. },
  2110. {
  2111. "name": "a_vertexId",
  2112. "defines": [
  2113. "CC_USE_MORPH"
  2114. ],
  2115. "format": 11,
  2116. "location": 16
  2117. }
  2118. ],
  2119. "varyings": [
  2120. {
  2121. "name": "v_uv",
  2122. "type": 14,
  2123. "count": 1,
  2124. "defines": [],
  2125. "stageFlags": 17,
  2126. "location": 0
  2127. }
  2128. ],
  2129. "fragColors": [
  2130. {
  2131. "name": "fragColor",
  2132. "typename": "vec4",
  2133. "type": 16,
  2134. "count": 1,
  2135. "defines": [],
  2136. "stageFlags": 16,
  2137. "location": 0
  2138. }
  2139. ],
  2140. "descriptors": [
  2141. {
  2142. "rate": 0,
  2143. "blocks": [],
  2144. "samplerTextures": [],
  2145. "samplers": [],
  2146. "textures": [],
  2147. "buffers": [],
  2148. "images": [],
  2149. "subpassInputs": []
  2150. },
  2151. {
  2152. "rate": 1,
  2153. "blocks": [
  2154. {
  2155. "name": "hbaoUBO",
  2156. "members": [
  2157. {
  2158. "name": "uvDepthToEyePosParams",
  2159. "type": 16,
  2160. "count": 1
  2161. },
  2162. {
  2163. "name": "radiusParam",
  2164. "type": 16,
  2165. "count": 1
  2166. },
  2167. {
  2168. "name": "miscParam",
  2169. "type": 16,
  2170. "count": 1
  2171. },
  2172. {
  2173. "name": "randomTexSize",
  2174. "type": 16,
  2175. "count": 1
  2176. },
  2177. {
  2178. "name": "blurParam",
  2179. "type": 16,
  2180. "count": 1
  2181. }
  2182. ],
  2183. "defines": [],
  2184. "stageFlags": 16,
  2185. "binding": 0
  2186. }
  2187. ],
  2188. "samplerTextures": [
  2189. {
  2190. "name": "RandomTex",
  2191. "type": 28,
  2192. "count": 1,
  2193. "defines": [],
  2194. "stageFlags": 16,
  2195. "binding": 2
  2196. }
  2197. ],
  2198. "samplers": [],
  2199. "textures": [],
  2200. "buffers": [],
  2201. "images": [],
  2202. "subpassInputs": []
  2203. },
  2204. {
  2205. "rate": 2,
  2206. "blocks": [],
  2207. "samplerTextures": [],
  2208. "samplers": [],
  2209. "textures": [],
  2210. "buffers": [],
  2211. "images": [],
  2212. "subpassInputs": []
  2213. },
  2214. {
  2215. "rate": 3,
  2216. "blocks": [
  2217. {
  2218. "tags": {
  2219. "builtin": "global"
  2220. },
  2221. "name": "CCGlobal",
  2222. "members": [
  2223. {
  2224. "name": "cc_time",
  2225. "typename": "vec4",
  2226. "type": 16,
  2227. "count": 1,
  2228. "precision": "highp "
  2229. },
  2230. {
  2231. "name": "cc_screenSize",
  2232. "typename": "vec4",
  2233. "type": 16,
  2234. "count": 1,
  2235. "precision": "mediump "
  2236. },
  2237. {
  2238. "name": "cc_nativeSize",
  2239. "typename": "vec4",
  2240. "type": 16,
  2241. "count": 1,
  2242. "precision": "mediump "
  2243. },
  2244. {
  2245. "name": "cc_probeInfo",
  2246. "typename": "vec4",
  2247. "type": 16,
  2248. "count": 1,
  2249. "precision": "mediump "
  2250. },
  2251. {
  2252. "name": "cc_debug_view_mode",
  2253. "typename": "vec4",
  2254. "type": 16,
  2255. "count": 1,
  2256. "precision": "mediump "
  2257. }
  2258. ],
  2259. "defines": [],
  2260. "stageFlags": 17
  2261. },
  2262. {
  2263. "tags": {
  2264. "builtin": "global"
  2265. },
  2266. "name": "CCCamera",
  2267. "members": [
  2268. {
  2269. "name": "cc_matView",
  2270. "typename": "mat4",
  2271. "type": 25,
  2272. "count": 1,
  2273. "precision": "highp "
  2274. },
  2275. {
  2276. "name": "cc_matViewInv",
  2277. "typename": "mat4",
  2278. "type": 25,
  2279. "count": 1,
  2280. "precision": "highp "
  2281. },
  2282. {
  2283. "name": "cc_matProj",
  2284. "typename": "mat4",
  2285. "type": 25,
  2286. "count": 1,
  2287. "precision": "highp "
  2288. },
  2289. {
  2290. "name": "cc_matProjInv",
  2291. "typename": "mat4",
  2292. "type": 25,
  2293. "count": 1,
  2294. "precision": "highp "
  2295. },
  2296. {
  2297. "name": "cc_matViewProj",
  2298. "typename": "mat4",
  2299. "type": 25,
  2300. "count": 1,
  2301. "precision": "highp "
  2302. },
  2303. {
  2304. "name": "cc_matViewProjInv",
  2305. "typename": "mat4",
  2306. "type": 25,
  2307. "count": 1,
  2308. "precision": "highp "
  2309. },
  2310. {
  2311. "name": "cc_cameraPos",
  2312. "typename": "vec4",
  2313. "type": 16,
  2314. "count": 1,
  2315. "precision": "highp "
  2316. },
  2317. {
  2318. "name": "cc_surfaceTransform",
  2319. "typename": "vec4",
  2320. "type": 16,
  2321. "count": 1,
  2322. "precision": "mediump "
  2323. },
  2324. {
  2325. "name": "cc_screenScale",
  2326. "typename": "vec4",
  2327. "type": 16,
  2328. "count": 1,
  2329. "precision": "mediump "
  2330. },
  2331. {
  2332. "name": "cc_exposure",
  2333. "typename": "vec4",
  2334. "type": 16,
  2335. "count": 1,
  2336. "precision": "mediump "
  2337. },
  2338. {
  2339. "name": "cc_mainLitDir",
  2340. "typename": "vec4",
  2341. "type": 16,
  2342. "count": 1,
  2343. "precision": "mediump "
  2344. },
  2345. {
  2346. "name": "cc_mainLitColor",
  2347. "typename": "vec4",
  2348. "type": 16,
  2349. "count": 1,
  2350. "precision": "mediump "
  2351. },
  2352. {
  2353. "name": "cc_ambientSky",
  2354. "typename": "vec4",
  2355. "type": 16,
  2356. "count": 1,
  2357. "precision": "mediump "
  2358. },
  2359. {
  2360. "name": "cc_ambientGround",
  2361. "typename": "vec4",
  2362. "type": 16,
  2363. "count": 1,
  2364. "precision": "mediump "
  2365. },
  2366. {
  2367. "name": "cc_fogColor",
  2368. "typename": "vec4",
  2369. "type": 16,
  2370. "count": 1,
  2371. "precision": "mediump "
  2372. },
  2373. {
  2374. "name": "cc_fogBase",
  2375. "typename": "vec4",
  2376. "type": 16,
  2377. "count": 1,
  2378. "precision": "mediump "
  2379. },
  2380. {
  2381. "name": "cc_fogAdd",
  2382. "typename": "vec4",
  2383. "type": 16,
  2384. "count": 1,
  2385. "precision": "mediump "
  2386. },
  2387. {
  2388. "name": "cc_nearFar",
  2389. "typename": "vec4",
  2390. "type": 16,
  2391. "count": 1,
  2392. "precision": "mediump "
  2393. },
  2394. {
  2395. "name": "cc_viewPort",
  2396. "typename": "vec4",
  2397. "type": 16,
  2398. "count": 1,
  2399. "precision": "mediump "
  2400. }
  2401. ],
  2402. "defines": [],
  2403. "stageFlags": 17
  2404. }
  2405. ],
  2406. "samplerTextures": [
  2407. {
  2408. "name": "DepthTex",
  2409. "type": 28,
  2410. "count": 1,
  2411. "defines": [],
  2412. "stageFlags": 16,
  2413. "binding": 1
  2414. },
  2415. {
  2416. "name": "AOTexNearest",
  2417. "type": 28,
  2418. "count": 1,
  2419. "defines": [],
  2420. "stageFlags": 16,
  2421. "binding": 3
  2422. }
  2423. ],
  2424. "samplers": [],
  2425. "textures": [],
  2426. "buffers": [],
  2427. "images": [],
  2428. "subpassInputs": []
  2429. }
  2430. ],
  2431. "hash": 2936562803,
  2432. "glsl4": {
  2433. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 2) in vec2 a_texCoord;\nlayout(location = 3) in vec4 a_tangent;\n#if CC_USE_SKINNING\n layout(location = 4) in u32vec4 a_joints;\n layout(location = 5) in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n layout(location = 6) in highp vec4 a_jointAnimInfo;\n #endif\n layout(location = 7) in vec4 a_matWorld0;\n layout(location = 8) in vec4 a_matWorld1;\n layout(location = 9) in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n layout(location = 10) in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n layout(location = 11) in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n layout(location = 12) in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n layout(location = 13) in vec4 a_sh_linear_const_r;\n layout(location = 14) in vec4 a_sh_linear_const_g;\n layout(location = 15) in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n#endif\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(location = 0) out vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  2434. "frag": "\nprecision highp float;\nprecision highp float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\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_USE_FOG != 4\n#endif\nlayout(set = 1, binding = 0) uniform hbaoUBO {\n vec4 uvDepthToEyePosParams;\n vec4 radiusParam;\n vec4 miscParam;\n vec4 randomTexSize;\n vec4 blurParam;\n};\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nlayout(set = 1, binding = 1) uniform sampler2D DepthTex;\nlayout(set = 1, binding = 2) uniform sampler2D RandomTex;\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nlayout(set = 1, binding = 3) uniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\n#define g_AOSaturation blurParam.w\nfloat Combine(vec2 uv)\n{\n float ao = texture(AOTexNearest, uv).x;\n return g_AOSaturation > 1.0 ? pow(ao, g_AOSaturation) : mix(1.0, ao, g_AOSaturation);\n}\nlayout(location = 0) in vec2 v_uv;\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n float ao = Combine(v_uv);\n fragColor = vec4(1.0, 1.0, 1.0, ao);\n}"
  2435. },
  2436. "glsl3": {
  2437. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nout vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  2438. "frag": "\nprecision highp float;\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\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_USE_FOG != 4\n#endif\nlayout(std140) uniform hbaoUBO {\n vec4 uvDepthToEyePosParams;\n vec4 radiusParam;\n vec4 miscParam;\n vec4 randomTexSize;\n vec4 blurParam;\n};\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nuniform sampler2D DepthTex;\nuniform sampler2D RandomTex;\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nuniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\n#define g_AOSaturation blurParam.w\nfloat Combine(vec2 uv)\n{\n float ao = texture(AOTexNearest, uv).x;\n return g_AOSaturation > 1.0 ? pow(ao, g_AOSaturation) : mix(1.0, ao, g_AOSaturation);\n}\nin vec2 v_uv;\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n float ao = Combine(v_uv);\n fragColor = vec4(1.0, 1.0, 1.0, ao);\n}"
  2439. },
  2440. "glsl1": {
  2441. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\nuniform highp vec4 cc_cameraPos;\nvarying vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n In.position.xy = cc_cameraPos.w == 0.0 ? vec2(In.position.xy.x, -In.position.xy.y) : In.position.xy;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  2442. "frag": "\nprecision highp float;\nprecision highp float;\nuniform mediump vec4 cc_screenSize;\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_USE_FOG != 4\n#endif\n uniform vec4 uvDepthToEyePosParams;\n uniform vec4 radiusParam;\n uniform vec4 miscParam;\n uniform vec4 blurParam;\n#define NUM_STEPS 8.0\n#define NUM_STEPS_LOOP NUM_STEPS*2.0\n#define INV_NUM_DIRECTIONS 0.125\n#define NUM_DIRECTIONS 8\n#define CONSTANT_2PI 6.2831852\n#define g_AOResolution cc_screenSize.xy\n#define g_InvAOResolution cc_screenSize.zw\n#define g_UVToViewA uvDepthToEyePosParams.xy\n#define g_UVToViewB uvDepthToEyePosParams.zw\n#define g_R radiusParam.x\n#define g_R2 radiusParam.y\n#define g_NegInvR2 radiusParam.z\n#define g_MaxRadiusPixels radiusParam.w\n#define g_FocalLen miscParam.xy\n#define g_TanAngleBias miscParam.z\n#define g_Strength miscParam.w\nuniform sampler2D DepthTex;\nuniform sampler2D RandomTex;\n#define KERNEL_FALLOFF 3.0f\n#define KERNEL_RADIUS 8\n#define HALF_KERNEL_RADIUS 4\n#define g_InvFullResolution cc_screenSize.zw\n#define g_BlurFallOff blurParam.x\n#define g_BlurDepthThreshold blurParam.y\n#define g_BlurSimpleRadius blurParam.z\nuniform sampler2D AOTexNearest;\n#define AOTexBilinear AOTexNearest\n#define GetLinearDepthBilinear GetLinearDepth\n#define g_AOSaturation blurParam.w\nfloat Combine(vec2 uv)\n{\n float ao = texture2D(AOTexNearest, uv).x;\n return g_AOSaturation > 1.0 ? pow(ao, g_AOSaturation) : mix(1.0, ao, g_AOSaturation);\n}\nvarying vec2 v_uv;\nvoid main () {\n float ao = Combine(v_uv);\n gl_FragColor = vec4(1.0, 1.0, 1.0, ao);\n}"
  2443. },
  2444. "builtins": {
  2445. "globals": {
  2446. "blocks": [
  2447. {
  2448. "name": "CCGlobal",
  2449. "defines": []
  2450. },
  2451. {
  2452. "name": "CCCamera",
  2453. "defines": []
  2454. }
  2455. ],
  2456. "samplerTextures": [],
  2457. "buffers": [],
  2458. "images": []
  2459. },
  2460. "locals": {
  2461. "blocks": [],
  2462. "samplerTextures": [],
  2463. "buffers": [],
  2464. "images": []
  2465. },
  2466. "statistics": {
  2467. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 42,
  2468. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 47
  2469. }
  2470. },
  2471. "defines": [
  2472. {
  2473. "name": "USE_INSTANCING",
  2474. "type": "boolean",
  2475. "defines": [],
  2476. "editor": {
  2477. "elevated": true
  2478. }
  2479. },
  2480. {
  2481. "name": "CC_USE_SKINNING",
  2482. "type": "boolean",
  2483. "defines": []
  2484. },
  2485. {
  2486. "name": "CC_USE_BAKED_ANIMATION",
  2487. "type": "boolean",
  2488. "defines": [
  2489. "USE_INSTANCING"
  2490. ]
  2491. },
  2492. {
  2493. "name": "CC_USE_LIGHTMAP",
  2494. "type": "boolean",
  2495. "defines": [
  2496. "USE_INSTANCING"
  2497. ]
  2498. },
  2499. {
  2500. "name": "CC_USE_REFLECTION_PROBE",
  2501. "type": "boolean",
  2502. "defines": [
  2503. "USE_INSTANCING"
  2504. ]
  2505. },
  2506. {
  2507. "name": "CC_RECEIVE_SHADOW",
  2508. "type": "boolean",
  2509. "defines": [
  2510. "USE_INSTANCING"
  2511. ]
  2512. },
  2513. {
  2514. "name": "CC_USE_LIGHT_PROBE",
  2515. "type": "boolean",
  2516. "defines": [
  2517. "USE_INSTANCING"
  2518. ]
  2519. },
  2520. {
  2521. "name": "CC_USE_MORPH",
  2522. "type": "boolean",
  2523. "defines": []
  2524. },
  2525. {
  2526. "name": "CC_USE_FOG",
  2527. "type": "number",
  2528. "defines": [],
  2529. "range": [
  2530. 0,
  2531. 4
  2532. ]
  2533. }
  2534. ],
  2535. "name": "pipeline/post-process/hbao|hbao-vs|combine-fs"
  2536. }
  2537. ],
  2538. "combinations": [],
  2539. "hideInEditor": false
  2540. }