4c3ce6de-e6d1-47f7-aa36-36b9b58f72d3.json 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "pipeline/post-process/taa",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "passes": [
  10. {
  11. "pass": "DeferredTAA0",
  12. "rasterizerState": {
  13. "cullMode": 0
  14. },
  15. "blendState": {
  16. "targets": [
  17. {
  18. "blend": true,
  19. "blendSrc": 1,
  20. "blendDst": 0
  21. }
  22. ]
  23. },
  24. "program": "pipeline/post-process/taa|vs|fs",
  25. "depthStencilState": {
  26. "depthTest": false,
  27. "depthWrite": false
  28. }
  29. },
  30. {
  31. "pass": "DeferredTAA1",
  32. "rasterizerState": {
  33. "cullMode": 0
  34. },
  35. "blendState": {
  36. "targets": [
  37. {
  38. "blend": true,
  39. "blendSrc": 1,
  40. "blendDst": 0
  41. }
  42. ]
  43. },
  44. "program": "pipeline/post-process/taa|vs|fs",
  45. "depthStencilState": {
  46. "depthTest": false,
  47. "depthWrite": false
  48. }
  49. },
  50. {
  51. "pass": "DeferredTAA-1",
  52. "rasterizerState": {
  53. "cullMode": 0
  54. },
  55. "blendState": {
  56. "targets": [
  57. {
  58. "blend": true,
  59. "blendSrc": 1,
  60. "blendDst": 0
  61. }
  62. ]
  63. },
  64. "program": "pipeline/post-process/taa|vs|fs",
  65. "depthStencilState": {
  66. "depthTest": false,
  67. "depthWrite": false
  68. }
  69. }
  70. ]
  71. }
  72. ],
  73. "shaders": [
  74. {
  75. "blocks": [
  76. {
  77. "name": "TaaUBO",
  78. "members": [
  79. {
  80. "name": "inputViewPort",
  81. "type": 16,
  82. "count": 1
  83. },
  84. {
  85. "name": "taaTextureSize",
  86. "type": 16,
  87. "count": 1
  88. },
  89. {
  90. "name": "taaParams1",
  91. "type": 16,
  92. "count": 1
  93. },
  94. {
  95. "name": "taaPrevViewProj",
  96. "type": 25,
  97. "count": 1
  98. }
  99. ],
  100. "defines": [],
  101. "stageFlags": 16,
  102. "binding": 0
  103. }
  104. ],
  105. "samplerTextures": [
  106. {
  107. "name": "motionMaskTex",
  108. "type": 28,
  109. "count": 1,
  110. "defines": [],
  111. "stageFlags": 16,
  112. "binding": 1
  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": "TaaUBO",
  302. "members": [
  303. {
  304. "name": "inputViewPort",
  305. "type": 16,
  306. "count": 1
  307. },
  308. {
  309. "name": "taaTextureSize",
  310. "type": 16,
  311. "count": 1
  312. },
  313. {
  314. "name": "taaParams1",
  315. "type": 16,
  316. "count": 1
  317. },
  318. {
  319. "name": "taaPrevViewProj",
  320. "type": 25,
  321. "count": 1
  322. }
  323. ],
  324. "defines": [],
  325. "stageFlags": 16,
  326. "binding": 0
  327. }
  328. ],
  329. "samplerTextures": [
  330. {
  331. "name": "motionMaskTex",
  332. "type": 28,
  333. "count": 1,
  334. "defines": [],
  335. "stageFlags": 16,
  336. "binding": 1
  337. }
  338. ],
  339. "samplers": [],
  340. "textures": [],
  341. "buffers": [],
  342. "images": [],
  343. "subpassInputs": []
  344. },
  345. {
  346. "rate": 2,
  347. "blocks": [],
  348. "samplerTextures": [],
  349. "samplers": [],
  350. "textures": [],
  351. "buffers": [],
  352. "images": [],
  353. "subpassInputs": []
  354. },
  355. {
  356. "rate": 3,
  357. "blocks": [
  358. {
  359. "tags": {
  360. "builtin": "global"
  361. },
  362. "name": "CCGlobal",
  363. "members": [
  364. {
  365. "name": "cc_time",
  366. "typename": "vec4",
  367. "type": 16,
  368. "count": 1,
  369. "precision": "highp "
  370. },
  371. {
  372. "name": "cc_screenSize",
  373. "typename": "vec4",
  374. "type": 16,
  375. "count": 1,
  376. "precision": "mediump "
  377. },
  378. {
  379. "name": "cc_nativeSize",
  380. "typename": "vec4",
  381. "type": 16,
  382. "count": 1,
  383. "precision": "mediump "
  384. },
  385. {
  386. "name": "cc_probeInfo",
  387. "typename": "vec4",
  388. "type": 16,
  389. "count": 1,
  390. "precision": "mediump "
  391. },
  392. {
  393. "name": "cc_debug_view_mode",
  394. "typename": "vec4",
  395. "type": 16,
  396. "count": 1,
  397. "precision": "mediump "
  398. }
  399. ],
  400. "defines": [],
  401. "stageFlags": 17
  402. },
  403. {
  404. "tags": {
  405. "builtin": "global"
  406. },
  407. "name": "CCCamera",
  408. "members": [
  409. {
  410. "name": "cc_matView",
  411. "typename": "mat4",
  412. "type": 25,
  413. "count": 1,
  414. "precision": "highp "
  415. },
  416. {
  417. "name": "cc_matViewInv",
  418. "typename": "mat4",
  419. "type": 25,
  420. "count": 1,
  421. "precision": "highp "
  422. },
  423. {
  424. "name": "cc_matProj",
  425. "typename": "mat4",
  426. "type": 25,
  427. "count": 1,
  428. "precision": "highp "
  429. },
  430. {
  431. "name": "cc_matProjInv",
  432. "typename": "mat4",
  433. "type": 25,
  434. "count": 1,
  435. "precision": "highp "
  436. },
  437. {
  438. "name": "cc_matViewProj",
  439. "typename": "mat4",
  440. "type": 25,
  441. "count": 1,
  442. "precision": "highp "
  443. },
  444. {
  445. "name": "cc_matViewProjInv",
  446. "typename": "mat4",
  447. "type": 25,
  448. "count": 1,
  449. "precision": "highp "
  450. },
  451. {
  452. "name": "cc_cameraPos",
  453. "typename": "vec4",
  454. "type": 16,
  455. "count": 1,
  456. "precision": "highp "
  457. },
  458. {
  459. "name": "cc_surfaceTransform",
  460. "typename": "vec4",
  461. "type": 16,
  462. "count": 1,
  463. "precision": "mediump "
  464. },
  465. {
  466. "name": "cc_screenScale",
  467. "typename": "vec4",
  468. "type": 16,
  469. "count": 1,
  470. "precision": "mediump "
  471. },
  472. {
  473. "name": "cc_exposure",
  474. "typename": "vec4",
  475. "type": 16,
  476. "count": 1,
  477. "precision": "mediump "
  478. },
  479. {
  480. "name": "cc_mainLitDir",
  481. "typename": "vec4",
  482. "type": 16,
  483. "count": 1,
  484. "precision": "mediump "
  485. },
  486. {
  487. "name": "cc_mainLitColor",
  488. "typename": "vec4",
  489. "type": 16,
  490. "count": 1,
  491. "precision": "mediump "
  492. },
  493. {
  494. "name": "cc_ambientSky",
  495. "typename": "vec4",
  496. "type": 16,
  497. "count": 1,
  498. "precision": "mediump "
  499. },
  500. {
  501. "name": "cc_ambientGround",
  502. "typename": "vec4",
  503. "type": 16,
  504. "count": 1,
  505. "precision": "mediump "
  506. },
  507. {
  508. "name": "cc_fogColor",
  509. "typename": "vec4",
  510. "type": 16,
  511. "count": 1,
  512. "precision": "mediump "
  513. },
  514. {
  515. "name": "cc_fogBase",
  516. "typename": "vec4",
  517. "type": 16,
  518. "count": 1,
  519. "precision": "mediump "
  520. },
  521. {
  522. "name": "cc_fogAdd",
  523. "typename": "vec4",
  524. "type": 16,
  525. "count": 1,
  526. "precision": "mediump "
  527. },
  528. {
  529. "name": "cc_nearFar",
  530. "typename": "vec4",
  531. "type": 16,
  532. "count": 1,
  533. "precision": "mediump "
  534. },
  535. {
  536. "name": "cc_viewPort",
  537. "typename": "vec4",
  538. "type": 16,
  539. "count": 1,
  540. "precision": "mediump "
  541. }
  542. ],
  543. "defines": [],
  544. "stageFlags": 17
  545. }
  546. ],
  547. "samplerTextures": [
  548. {
  549. "name": "inputTexture",
  550. "type": 28,
  551. "count": 1,
  552. "defines": [],
  553. "stageFlags": 16,
  554. "binding": 2
  555. },
  556. {
  557. "name": "depthTex",
  558. "type": 28,
  559. "count": 1,
  560. "defines": [],
  561. "stageFlags": 16,
  562. "binding": 3
  563. },
  564. {
  565. "name": "taaPrevTexture",
  566. "type": 28,
  567. "count": 1,
  568. "defines": [],
  569. "stageFlags": 16,
  570. "binding": 4
  571. }
  572. ],
  573. "samplers": [],
  574. "textures": [],
  575. "buffers": [],
  576. "images": [],
  577. "subpassInputs": []
  578. }
  579. ],
  580. "hash": 2397532844,
  581. "glsl4": {
  582. "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}",
  583. "frag": "\nprecision highp float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(location = 0) in vec2 v_uv;\nlayout(set = 1, binding = 0) uniform TaaUBO {\n vec4 inputViewPort;\n vec4 taaTextureSize;\n vec4 taaParams1;\n mat4 taaPrevViewProj;\n};\nlayout(set = 1, binding = 1) uniform highp sampler2D motionMaskTex;\nlayout(set = 1, binding = 2) uniform sampler2D inputTexture;\nlayout(set = 1, binding = 3) uniform highp sampler2D depthTex;\nlayout(set = 1, binding = 4) uniform sampler2D taaPrevTexture;\nvec3 screen2WS(vec3 screenPos) {\n vec4 ndc = vec4(screenPos.xyz * 2. - 1.0, 1.0);\n vec4 world = cc_matViewProjInv * ndc;\n world = world / world.w;\n return world.xyz;\n}\nvec2 taaInputTexSize();\nvec2 taaPrevTexSize();\nvec2 NDCScToUV(vec4 ndc) {\n ndc /= ndc.w;\n vec2 uv = ndc.xy * 0.5 + 0.5;\n float epsilon = cc_cameraPos.w - 1.0;\n if ((epsilon > -0.1) && (epsilon < 0.1)) {\n uv.y = -uv.y;\n }\n return uv;\n}\nvec2 getVelocity(vec2 unjittedUV, vec2 uv, out float depth) {\n depth = texture(depthTex, unjittedUV).r;\n vec3 worldPos = screen2WS(vec3(uv, depth));\n if (abs(worldPos.x) < 0.0001 && abs(worldPos.y) < 0.0001) {\n return vec2(0.);\n }\n vec4 historyNDC = taaPrevViewProj * vec4(worldPos, 1.);\n vec2 screenPos = NDCScToUV(historyNDC);\n return screenPos - uv;\n}\nvec3 RGBToYCoCg( vec3 RGB ) {\n float Y = dot( RGB, vec3( 1, 2, 1 ) );\n float Co = dot( RGB, vec3( 2, 0, -2 ) );\n float Cg = dot( RGB, vec3( -1, 2, -1 ) );\n return vec3( Y, Co, Cg );\n}\nvec3 YCoCgToRGB( vec3 YCoCg ) {\n float Y = YCoCg.x * 0.25;\n float Co = YCoCg.y * 0.25;\n float Cg = YCoCg.z * 0.25;\n float R = Y + Co - Cg;\n float G = Y + Cg;\n float B = Y - Co - Cg;\n return vec3( R, G, B );\n}\nvec4 taaSampleTex(sampler2D tex, vec2 uv) {\n vec4 color = texture(tex, uv);\n color.rgb = RGBToYCoCg(color.rgb);\n return color;\n}\nvoid minmax(sampler2D mainTex, in vec2 uv, out vec4 colorMin, out vec4 colorMax) {\n vec2 texSize = taaInputTexSize();\n vec2 du = vec2(texSize.x, 0.0);\n vec2 dv = vec2(0.0, texSize.y);\n vec4 t = taaSampleTex(mainTex, uv - dv);\n vec4 l = taaSampleTex(mainTex, uv - du);\n vec4 c = taaSampleTex(mainTex, uv);\n vec4 r = taaSampleTex(mainTex, uv + du);\n vec4 b = taaSampleTex(mainTex, uv + dv);\n colorMin = min(t, min(l, min(c, min(r, b))));\n colorMax = max(t, max(l, max(c, max(r, b))));\n}\nfloat HdrWeightY(float Color, float Exposure) {\n return 1. / (Color * Exposure + 4.0);\n}\nvec2 WeightedLerpFactors(float WeightA, float WeightB, float Blend) {\n float BlendA = (1.0 - Blend) * WeightA;\n float BlendB = Blend * WeightB;\n float RcpBlend = 1. / (BlendA + BlendB);\n BlendA *= RcpBlend;\n BlendB *= RcpBlend;\n return vec2(BlendA, BlendB);\n}\nvec4 temporalAAPS (sampler2D taaPrevTexture, sampler2D inputTexture, vec2 uv) {\n vec2 unjittedUV = uv - taaParams1.xy / 2.;\n vec2 scaledUnjittedUV = unjittedUV;\n float depth = 0.;\n vec2 velocity = getVelocity(scaledUnjittedUV, uv, depth);\n vec4 prevColor = taaSampleTex(taaPrevTexture, uv + velocity);\n vec4 color = taaSampleTex(inputTexture, scaledUnjittedUV);\n vec4 colorMin, colorMax;\n minmax(inputTexture, scaledUnjittedUV, colorMin, colorMax);\n vec3 resultColor;\n {\n prevColor.rgb = clamp(prevColor.rgb, colorMin.rgb, colorMax.rgb);\n float blendFinal = 1. - taaParams1.z;\n float currentWeight = HdrWeightY(color.x, 1.);\n float historyWeight = HdrWeightY(prevColor.x, 1.);\n vec2 weights = WeightedLerpFactors(historyWeight, currentWeight, blendFinal);\n resultColor = prevColor.rgb * weights.x + color.rgb * weights.y;\n }\n resultColor = YCoCgToRGB(resultColor.rgb);\n return vec4(resultColor, color.a);\n}\nlayout(location = 0) out vec4 fragColor;\nvec2 taaInputTexSize() {\n return taaTextureSize.xy;\n}\nvoid main () {\n vec4 mask = vec4(0.);\n #if USE_TAA_MASK\n mask = texture(motionMaskTex, v_uv);\n #endif\n if (mask.r > 0.) {\n fragColor = texture(inputTexture, v_uv);\n }\n else {\n fragColor = temporalAAPS(taaPrevTexture, inputTexture, v_uv);\n }\n}"
  584. },
  585. "glsl3": {
  586. "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}",
  587. "frag": "\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nin vec2 v_uv;\nlayout(std140) uniform TaaUBO {\n vec4 inputViewPort;\n vec4 taaTextureSize;\n vec4 taaParams1;\n mat4 taaPrevViewProj;\n};\nuniform highp sampler2D motionMaskTex;\nuniform sampler2D inputTexture;\nuniform highp sampler2D depthTex;\nuniform sampler2D taaPrevTexture;\nvec3 screen2WS(vec3 screenPos) {\n vec4 ndc = vec4(screenPos.xyz * 2. - 1.0, 1.0);\n vec4 world = cc_matViewProjInv * ndc;\n world = world / world.w;\n return world.xyz;\n}\nvec2 taaInputTexSize();\nvec2 taaPrevTexSize();\nvec2 NDCScToUV(vec4 ndc) {\n ndc /= ndc.w;\n vec2 uv = ndc.xy * 0.5 + 0.5;\n float epsilon = cc_cameraPos.w - 1.0;\n if ((epsilon > -0.1) && (epsilon < 0.1)) {\n uv.y = -uv.y;\n }\n return uv;\n}\nvec2 getVelocity(vec2 unjittedUV, vec2 uv, out float depth) {\n depth = texture(depthTex, unjittedUV).r;\n vec3 worldPos = screen2WS(vec3(uv, depth));\n if (abs(worldPos.x) < 0.0001 && abs(worldPos.y) < 0.0001) {\n return vec2(0.);\n }\n vec4 historyNDC = taaPrevViewProj * vec4(worldPos, 1.);\n vec2 screenPos = NDCScToUV(historyNDC);\n return screenPos - uv;\n}\nvec3 RGBToYCoCg( vec3 RGB ) {\n float Y = dot( RGB, vec3( 1, 2, 1 ) );\n float Co = dot( RGB, vec3( 2, 0, -2 ) );\n float Cg = dot( RGB, vec3( -1, 2, -1 ) );\n return vec3( Y, Co, Cg );\n}\nvec3 YCoCgToRGB( vec3 YCoCg ) {\n float Y = YCoCg.x * 0.25;\n float Co = YCoCg.y * 0.25;\n float Cg = YCoCg.z * 0.25;\n float R = Y + Co - Cg;\n float G = Y + Cg;\n float B = Y - Co - Cg;\n return vec3( R, G, B );\n}\nvec4 taaSampleTex(sampler2D tex, vec2 uv) {\n vec4 color = texture(tex, uv);\n color.rgb = RGBToYCoCg(color.rgb);\n return color;\n}\nvoid minmax(sampler2D mainTex, in vec2 uv, out vec4 colorMin, out vec4 colorMax) {\n vec2 texSize = taaInputTexSize();\n vec2 du = vec2(texSize.x, 0.0);\n vec2 dv = vec2(0.0, texSize.y);\n vec4 t = taaSampleTex(mainTex, uv - dv);\n vec4 l = taaSampleTex(mainTex, uv - du);\n vec4 c = taaSampleTex(mainTex, uv);\n vec4 r = taaSampleTex(mainTex, uv + du);\n vec4 b = taaSampleTex(mainTex, uv + dv);\n colorMin = min(t, min(l, min(c, min(r, b))));\n colorMax = max(t, max(l, max(c, max(r, b))));\n}\nfloat HdrWeightY(float Color, float Exposure) {\n return 1. / (Color * Exposure + 4.0);\n}\nvec2 WeightedLerpFactors(float WeightA, float WeightB, float Blend) {\n float BlendA = (1.0 - Blend) * WeightA;\n float BlendB = Blend * WeightB;\n float RcpBlend = 1. / (BlendA + BlendB);\n BlendA *= RcpBlend;\n BlendB *= RcpBlend;\n return vec2(BlendA, BlendB);\n}\nvec4 temporalAAPS (sampler2D taaPrevTexture, sampler2D inputTexture, vec2 uv) {\n vec2 unjittedUV = uv - taaParams1.xy / 2.;\n vec2 scaledUnjittedUV = unjittedUV;\n float depth = 0.;\n vec2 velocity = getVelocity(scaledUnjittedUV, uv, depth);\n vec4 prevColor = taaSampleTex(taaPrevTexture, uv + velocity);\n vec4 color = taaSampleTex(inputTexture, scaledUnjittedUV);\n vec4 colorMin, colorMax;\n minmax(inputTexture, scaledUnjittedUV, colorMin, colorMax);\n vec3 resultColor;\n {\n prevColor.rgb = clamp(prevColor.rgb, colorMin.rgb, colorMax.rgb);\n float blendFinal = 1. - taaParams1.z;\n float currentWeight = HdrWeightY(color.x, 1.);\n float historyWeight = HdrWeightY(prevColor.x, 1.);\n vec2 weights = WeightedLerpFactors(historyWeight, currentWeight, blendFinal);\n resultColor = prevColor.rgb * weights.x + color.rgb * weights.y;\n }\n resultColor = YCoCgToRGB(resultColor.rgb);\n return vec4(resultColor, color.a);\n}\nlayout(location = 0) out vec4 fragColor;\nvec2 taaInputTexSize() {\n return taaTextureSize.xy;\n}\nvoid main () {\n vec4 mask = vec4(0.);\n #if USE_TAA_MASK\n mask = texture(motionMaskTex, v_uv);\n #endif\n if (mask.r > 0.) {\n fragColor = texture(inputTexture, v_uv);\n }\n else {\n fragColor = temporalAAPS(taaPrevTexture, inputTexture, v_uv);\n }\n}"
  588. },
  589. "glsl1": {
  590. "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}",
  591. "frag": "\nprecision highp float;\nuniform highp mat4 cc_matViewProjInv;\n uniform highp vec4 cc_cameraPos;\nvarying vec2 v_uv;\n uniform vec4 taaTextureSize;\n uniform vec4 taaParams1;\n uniform mat4 taaPrevViewProj;\nuniform highp sampler2D motionMaskTex;\nuniform sampler2D inputTexture;\nuniform highp sampler2D depthTex;\nuniform sampler2D taaPrevTexture;\nvec3 screen2WS(vec3 screenPos) {\n vec4 ndc = vec4(screenPos.xyz * 2. - 1.0, 1.0);\n vec4 world = cc_matViewProjInv * ndc;\n world = world / world.w;\n return world.xyz;\n}\nvec2 taaInputTexSize();\nvec2 taaPrevTexSize();\nvec2 NDCScToUV(vec4 ndc) {\n ndc /= ndc.w;\n vec2 uv = ndc.xy * 0.5 + 0.5;\n float epsilon = cc_cameraPos.w - 1.0;\n if ((epsilon > -0.1) && (epsilon < 0.1)) {\n uv.y = -uv.y;\n }\n return uv;\n}\nvec2 getVelocity(vec2 unjittedUV, vec2 uv, out float depth) {\n depth = texture2D(depthTex, unjittedUV).r;\n vec3 worldPos = screen2WS(vec3(uv, depth));\n if (abs(worldPos.x) < 0.0001 && abs(worldPos.y) < 0.0001) {\n return vec2(0.);\n }\n vec4 historyNDC = taaPrevViewProj * vec4(worldPos, 1.);\n vec2 screenPos = NDCScToUV(historyNDC);\n return screenPos - uv;\n}\nvec3 RGBToYCoCg( vec3 RGB ) {\n float Y = dot( RGB, vec3( 1, 2, 1 ) );\n float Co = dot( RGB, vec3( 2, 0, -2 ) );\n float Cg = dot( RGB, vec3( -1, 2, -1 ) );\n return vec3( Y, Co, Cg );\n}\nvec3 YCoCgToRGB( vec3 YCoCg ) {\n float Y = YCoCg.x * 0.25;\n float Co = YCoCg.y * 0.25;\n float Cg = YCoCg.z * 0.25;\n float R = Y + Co - Cg;\n float G = Y + Cg;\n float B = Y - Co - Cg;\n return vec3( R, G, B );\n}\nvec4 taaSampleTex(sampler2D tex, vec2 uv) {\n vec4 color = texture2D(tex, uv);\n color.rgb = RGBToYCoCg(color.rgb);\n return color;\n}\nvoid minmax(sampler2D mainTex, in vec2 uv, out vec4 colorMin, out vec4 colorMax) {\n vec2 texSize = taaInputTexSize();\n vec2 du = vec2(texSize.x, 0.0);\n vec2 dv = vec2(0.0, texSize.y);\n vec4 t = taaSampleTex(mainTex, uv - dv);\n vec4 l = taaSampleTex(mainTex, uv - du);\n vec4 c = taaSampleTex(mainTex, uv);\n vec4 r = taaSampleTex(mainTex, uv + du);\n vec4 b = taaSampleTex(mainTex, uv + dv);\n colorMin = min(t, min(l, min(c, min(r, b))));\n colorMax = max(t, max(l, max(c, max(r, b))));\n}\nfloat HdrWeightY(float Color, float Exposure) {\n return 1. / (Color * Exposure + 4.0);\n}\nvec2 WeightedLerpFactors(float WeightA, float WeightB, float Blend) {\n float BlendA = (1.0 - Blend) * WeightA;\n float BlendB = Blend * WeightB;\n float RcpBlend = 1. / (BlendA + BlendB);\n BlendA *= RcpBlend;\n BlendB *= RcpBlend;\n return vec2(BlendA, BlendB);\n}\nvec4 temporalAAPS (sampler2D taaPrevTexture, sampler2D inputTexture, vec2 uv) {\n vec2 unjittedUV = uv - taaParams1.xy / 2.;\n vec2 scaledUnjittedUV = unjittedUV;\n float depth = 0.;\n vec2 velocity = getVelocity(scaledUnjittedUV, uv, depth);\n vec4 prevColor = taaSampleTex(taaPrevTexture, uv + velocity);\n vec4 color = taaSampleTex(inputTexture, scaledUnjittedUV);\n vec4 colorMin, colorMax;\n minmax(inputTexture, scaledUnjittedUV, colorMin, colorMax);\n vec3 resultColor;\n {\n prevColor.rgb = clamp(prevColor.rgb, colorMin.rgb, colorMax.rgb);\n float blendFinal = 1. - taaParams1.z;\n float currentWeight = HdrWeightY(color.x, 1.);\n float historyWeight = HdrWeightY(prevColor.x, 1.);\n vec2 weights = WeightedLerpFactors(historyWeight, currentWeight, blendFinal);\n resultColor = prevColor.rgb * weights.x + color.rgb * weights.y;\n }\n resultColor = YCoCgToRGB(resultColor.rgb);\n return vec4(resultColor, color.a);\n}\nvec2 taaInputTexSize() {\n return taaTextureSize.xy;\n}\nvoid main () {\n vec4 mask = vec4(0.);\n #if USE_TAA_MASK\n mask = texture2D(motionMaskTex, v_uv);\n #endif\n if (mask.r > 0.) {\n gl_FragColor = texture2D(inputTexture, v_uv);\n }\n else {\n gl_FragColor = temporalAAPS(taaPrevTexture, inputTexture, v_uv);\n }\n}"
  592. },
  593. "builtins": {
  594. "globals": {
  595. "blocks": [
  596. {
  597. "name": "CCGlobal",
  598. "defines": []
  599. },
  600. {
  601. "name": "CCCamera",
  602. "defines": []
  603. }
  604. ],
  605. "samplerTextures": [],
  606. "buffers": [],
  607. "images": []
  608. },
  609. "locals": {
  610. "blocks": [],
  611. "samplerTextures": [],
  612. "buffers": [],
  613. "images": []
  614. },
  615. "statistics": {
  616. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 42,
  617. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 49
  618. }
  619. },
  620. "defines": [
  621. {
  622. "name": "USE_INSTANCING",
  623. "type": "boolean",
  624. "defines": [],
  625. "editor": {
  626. "elevated": true
  627. }
  628. },
  629. {
  630. "name": "CC_USE_SKINNING",
  631. "type": "boolean",
  632. "defines": []
  633. },
  634. {
  635. "name": "CC_USE_BAKED_ANIMATION",
  636. "type": "boolean",
  637. "defines": [
  638. "USE_INSTANCING"
  639. ]
  640. },
  641. {
  642. "name": "CC_USE_LIGHTMAP",
  643. "type": "boolean",
  644. "defines": [
  645. "USE_INSTANCING"
  646. ]
  647. },
  648. {
  649. "name": "CC_USE_REFLECTION_PROBE",
  650. "type": "boolean",
  651. "defines": [
  652. "USE_INSTANCING"
  653. ]
  654. },
  655. {
  656. "name": "CC_RECEIVE_SHADOW",
  657. "type": "boolean",
  658. "defines": [
  659. "USE_INSTANCING"
  660. ]
  661. },
  662. {
  663. "name": "CC_USE_LIGHT_PROBE",
  664. "type": "boolean",
  665. "defines": [
  666. "USE_INSTANCING"
  667. ]
  668. },
  669. {
  670. "name": "CC_USE_MORPH",
  671. "type": "boolean",
  672. "defines": []
  673. },
  674. {
  675. "name": "USE_TAA_MASK",
  676. "type": "boolean",
  677. "defines": []
  678. }
  679. ],
  680. "name": "pipeline/post-process/taa|vs|fs"
  681. }
  682. ],
  683. "combinations": [],
  684. "hideInEditor": false
  685. }