58c5b54c-b5df-41fd-9824-fae746c5af2a.json 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "pipeline/post-process/fxaa-hq1",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "name": "fxaa1",
  10. "passes": [
  11. {
  12. "pass": "cc-fxaa",
  13. "rasterizerState": {
  14. "cullMode": 0
  15. },
  16. "program": "pipeline/post-process/fxaa-hq1|fxaa-vs|fxaa-edge-fs:frag",
  17. "depthStencilState": {
  18. "depthTest": false,
  19. "depthWrite": false
  20. }
  21. }
  22. ]
  23. }
  24. ],
  25. "shaders": [
  26. {
  27. "blocks": [],
  28. "samplerTextures": [],
  29. "samplers": [],
  30. "textures": [],
  31. "buffers": [],
  32. "images": [],
  33. "subpassInputs": [],
  34. "attributes": [
  35. {
  36. "name": "a_position",
  37. "defines": [],
  38. "format": 32,
  39. "location": 0
  40. },
  41. {
  42. "name": "a_normal",
  43. "defines": [],
  44. "format": 32,
  45. "location": 1
  46. },
  47. {
  48. "name": "a_texCoord",
  49. "defines": [],
  50. "format": 21,
  51. "location": 2
  52. },
  53. {
  54. "name": "a_tangent",
  55. "defines": [],
  56. "format": 44,
  57. "location": 3
  58. },
  59. {
  60. "name": "a_joints",
  61. "defines": [
  62. "CC_USE_SKINNING"
  63. ],
  64. "location": 4
  65. },
  66. {
  67. "name": "a_weights",
  68. "defines": [
  69. "CC_USE_SKINNING"
  70. ],
  71. "format": 44,
  72. "location": 5
  73. },
  74. {
  75. "name": "a_jointAnimInfo",
  76. "defines": [
  77. "USE_INSTANCING",
  78. "CC_USE_BAKED_ANIMATION"
  79. ],
  80. "format": 44,
  81. "isInstanced": true,
  82. "location": 6
  83. },
  84. {
  85. "name": "a_matWorld0",
  86. "defines": [
  87. "USE_INSTANCING"
  88. ],
  89. "format": 44,
  90. "isInstanced": true,
  91. "location": 7
  92. },
  93. {
  94. "name": "a_matWorld1",
  95. "defines": [
  96. "USE_INSTANCING"
  97. ],
  98. "format": 44,
  99. "isInstanced": true,
  100. "location": 8
  101. },
  102. {
  103. "name": "a_matWorld2",
  104. "defines": [
  105. "USE_INSTANCING"
  106. ],
  107. "format": 44,
  108. "isInstanced": true,
  109. "location": 9
  110. },
  111. {
  112. "name": "a_lightingMapUVParam",
  113. "defines": [
  114. "USE_INSTANCING",
  115. "CC_USE_LIGHTMAP"
  116. ],
  117. "format": 44,
  118. "isInstanced": true,
  119. "location": 10
  120. },
  121. {
  122. "name": "a_localShadowBiasAndProbeId",
  123. "defines": [
  124. "USE_INSTANCING"
  125. ],
  126. "format": 44,
  127. "isInstanced": true,
  128. "location": 11
  129. },
  130. {
  131. "name": "a_reflectionProbeData",
  132. "defines": [
  133. "USE_INSTANCING",
  134. "CC_USE_REFLECTION_PROBE"
  135. ],
  136. "format": 44,
  137. "isInstanced": true,
  138. "location": 12
  139. },
  140. {
  141. "name": "a_sh_linear_const_r",
  142. "defines": [
  143. "USE_INSTANCING",
  144. "CC_USE_LIGHT_PROBE"
  145. ],
  146. "format": 44,
  147. "isInstanced": true,
  148. "location": 13
  149. },
  150. {
  151. "name": "a_sh_linear_const_g",
  152. "defines": [
  153. "USE_INSTANCING",
  154. "CC_USE_LIGHT_PROBE"
  155. ],
  156. "format": 44,
  157. "isInstanced": true,
  158. "location": 14
  159. },
  160. {
  161. "name": "a_sh_linear_const_b",
  162. "defines": [
  163. "USE_INSTANCING",
  164. "CC_USE_LIGHT_PROBE"
  165. ],
  166. "format": 44,
  167. "isInstanced": true,
  168. "location": 15
  169. },
  170. {
  171. "name": "a_vertexId",
  172. "defines": [
  173. "CC_USE_MORPH"
  174. ],
  175. "format": 11,
  176. "location": 16
  177. }
  178. ],
  179. "varyings": [
  180. {
  181. "name": "v_uv",
  182. "type": 14,
  183. "count": 1,
  184. "defines": [],
  185. "stageFlags": 17,
  186. "location": 0
  187. }
  188. ],
  189. "fragColors": [
  190. {
  191. "name": "cc_FragColor",
  192. "typename": "vec4",
  193. "type": 16,
  194. "count": 1,
  195. "defines": [],
  196. "stageFlags": 16,
  197. "location": 0
  198. }
  199. ],
  200. "descriptors": [
  201. {
  202. "rate": 0,
  203. "blocks": [],
  204. "samplerTextures": [],
  205. "samplers": [],
  206. "textures": [],
  207. "buffers": [],
  208. "images": [],
  209. "subpassInputs": []
  210. },
  211. {
  212. "rate": 1,
  213. "blocks": [],
  214. "samplerTextures": [],
  215. "samplers": [],
  216. "textures": [],
  217. "buffers": [],
  218. "images": [],
  219. "subpassInputs": []
  220. },
  221. {
  222. "rate": 2,
  223. "blocks": [],
  224. "samplerTextures": [],
  225. "samplers": [],
  226. "textures": [],
  227. "buffers": [],
  228. "images": [],
  229. "subpassInputs": []
  230. },
  231. {
  232. "rate": 3,
  233. "blocks": [
  234. {
  235. "name": "Pipeline",
  236. "members": [
  237. {
  238. "name": "g_platform",
  239. "type": 16,
  240. "count": 1
  241. }
  242. ],
  243. "defines": [],
  244. "stageFlags": 1,
  245. "binding": 0
  246. },
  247. {
  248. "name": "fxaaUBO",
  249. "members": [
  250. {
  251. "name": "texSize",
  252. "type": 16,
  253. "count": 1
  254. }
  255. ],
  256. "defines": [],
  257. "stageFlags": 16,
  258. "binding": 1
  259. }
  260. ],
  261. "samplerTextures": [
  262. {
  263. "name": "sceneColorMap",
  264. "type": 28,
  265. "count": 1,
  266. "defines": [],
  267. "stageFlags": 16,
  268. "binding": 2
  269. }
  270. ],
  271. "samplers": [],
  272. "textures": [],
  273. "buffers": [],
  274. "images": [],
  275. "subpassInputs": []
  276. }
  277. ],
  278. "hash": 1811285614,
  279. "glsl4": {
  280. "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 = 1, binding = 0) uniform Pipeline {\n vec4 g_platform;\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).y = g_platform.w == 0.0 ? -(In.position).y : (In.position).y;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  281. "frag": "\nprecision highp float;\nprecision mediump int;\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\nvec4 fragTextureGrad (sampler2D tex, vec2 P, vec2 dPdx, vec2 dPdy) {\n #if defined(CC_USE_WGPU)\n return textureLod(tex, P, 0.0);\n #else\n return textureGrad(tex, P, dPdx, dPdy);\n #endif\n}\nvec4 fragTextureGrad (samplerCube tex, vec3 P, vec3 dPdx, vec3 dPdy) {\n #if defined(CC_USE_WGPU)\n return textureLod(tex, P, 0.0);\n #else\n return textureGrad(tex, P, dPdx, dPdy);\n #endif\n}\n#define int2 vec2\n#define float2 vec2\n#define float3 vec3\n#define float4 vec4\n#define FxaaBool3 bvec3\n#define FxaaInt2 vec2\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaBool2Float(a) mix(0.0, 1.0, (a))\n#define FxaaPow3(x, y) pow(x, y)\n#define FxaaSel3(f, t, b) mix((f), (t), (b))\n#define FxaaToFloat3(a) FxaaFloat3((a), (a), (a))\nfloat4 FxaaTexLod0(sampler2D tex, float2 pos) {\n #if defined(CC_USE_WGPU)\n return textureLod(tex, pos.xy, 0.0);\n #else\n return texture(tex, pos.xy);\n #endif\n}\nfloat4 FxaaTexGrad(sampler2D tex, float2 pos, float2 grad) {\n return fragTextureGrad(tex, pos.xy, grad, grad);\n}\nfloat4 FxaaTexOff(sampler2D tex, float2 pos, int2 off, float2 rcpFrame) {\n return FxaaTexLod0(tex, pos.xy + vec2(off.x, off.y) * rcpFrame);\n}\n#define FXAA_SRGB_ROP 0\n#ifndef FXAA_PRESET\n #define FXAA_PRESET 3\n#endif\n#if (FXAA_PRESET == 0)\n #define FXAA_EDGE_THRESHOLD (1.0/4.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/12.0)\n #define FXAA_SEARCH_STEPS 2\n #define FXAA_SEARCH_ACCELERATION 4\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 1\n #define FXAA_SUBPIX_CAP (2.0/3.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 1)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/16.0)\n #define FXAA_SEARCH_STEPS 4\n #define FXAA_SEARCH_ACCELERATION 3\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 2)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 8\n #define FXAA_SEARCH_ACCELERATION 2\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 3)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 16\n #define FXAA_SEARCH_ACCELERATION 1\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 4)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 24\n #define FXAA_SEARCH_ACCELERATION 1\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 5)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 32\n #define FXAA_SEARCH_ACCELERATION 1\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#define FXAA_SUBPIX_TRIM_SCALE (1.0/(1.0 - FXAA_SUBPIX_TRIM))\nfloat FxaaLuma(float3 rgb) {\n return rgb.y * (0.587/0.299) + rgb.x; }\nfloat3 FxaaLerp3(float3 a, float3 b, float amountOfA) {\n return (FxaaToFloat3(-amountOfA) * b) +\n ((a * FxaaToFloat3(amountOfA)) + b); }\nfloat3 FxaaFilterReturn(float3 rgb) {\n #if FXAA_SRGB_ROP\n return FxaaSel3(\n rgb * FxaaToFloat3(1.0/12.92),\n FxaaPow3(\n rgb * FxaaToFloat3(1.0/1.055) + FxaaToFloat3(0.055/1.055),\n FxaaToFloat3(2.4)),\n rgb > FxaaToFloat3(0.04045));\n #else\n return rgb;\n #endif\n}\nfloat3 FxaaPixelShader(float2 pos, sampler2D tex, float2 rcpFrame) {\n float3 rgbN = FxaaTexOff(tex, pos.xy, FxaaInt2( 0,-1), rcpFrame).xyz;\n float3 rgbW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1, 0), rcpFrame).xyz;\n float3 rgbM = FxaaTexOff(tex, pos.xy, FxaaInt2( 0, 0), rcpFrame).xyz;\n float3 rgbE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1, 0), rcpFrame).xyz;\n float3 rgbS = FxaaTexOff(tex, pos.xy, FxaaInt2( 0, 1), rcpFrame).xyz;\n float lumaN = FxaaLuma(rgbN);\n float lumaW = FxaaLuma(rgbW);\n float lumaM = FxaaLuma(rgbM);\n float lumaE = FxaaLuma(rgbE);\n float lumaS = FxaaLuma(rgbS);\n float rangeMin = min(lumaM, min(min(lumaN, lumaW), min(lumaS, lumaE)));\n float rangeMax = max(lumaM, max(max(lumaN, lumaW), max(lumaS, lumaE)));\n float range = rangeMax - rangeMin;\n #if FXAA_DEBUG\n float lumaO = lumaM / (1.0 + (0.587/0.299));\n #endif\n if(range < max(FXAA_EDGE_THRESHOLD_MIN, rangeMax * FXAA_EDGE_THRESHOLD)) {\n #if FXAA_DEBUG\n return FxaaFilterReturn(FxaaToFloat3(lumaO));\n #endif\n return FxaaFilterReturn(rgbM); }\n #if FXAA_SUBPIX > 0\n #if FXAA_SUBPIX_FASTER\n float3 rgbL = (rgbN + rgbW + rgbE + rgbS + rgbM) *\n FxaaToFloat3(1.0/5.0);\n #else\n float3 rgbL = rgbN + rgbW + rgbM + rgbE + rgbS;\n #endif\n #endif\n #if FXAA_SUBPIX != 0\n float lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;\n float rangeL = abs(lumaL - lumaM);\n #endif\n #if FXAA_SUBPIX == 1\n float blendL = max(0.0,\n (rangeL / range) - FXAA_SUBPIX_TRIM) * FXAA_SUBPIX_TRIM_SCALE;\n blendL = min(FXAA_SUBPIX_CAP, blendL);\n #endif\n #if FXAA_SUBPIX == 2\n float blendL = rangeL / range;\n #endif\n float3 rgbNW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1,-1), rcpFrame).xyz;\n float3 rgbNE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1,-1), rcpFrame).xyz;\n float3 rgbSW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1, 1), rcpFrame).xyz;\n float3 rgbSE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1, 1), rcpFrame).xyz;\n #if (FXAA_SUBPIX_FASTER == 0) && (FXAA_SUBPIX > 0)\n rgbL += (rgbNW + rgbNE + rgbSW + rgbSE);\n rgbL *= FxaaToFloat3(1.0/9.0);\n #endif\n float lumaNW = FxaaLuma(rgbNW);\n float lumaNE = FxaaLuma(rgbNE);\n float lumaSW = FxaaLuma(rgbSW);\n float lumaSE = FxaaLuma(rgbSE);\n float edgeVert =\n abs((0.25 * lumaNW) + (-0.5 * lumaN) + (0.25 * lumaNE)) +\n abs((0.50 * lumaW ) + (-1.0 * lumaM) + (0.50 * lumaE )) +\n abs((0.25 * lumaSW) + (-0.5 * lumaS) + (0.25 * lumaSE));\n float edgeHorz =\n abs((0.25 * lumaNW) + (-0.5 * lumaW) + (0.25 * lumaSW)) +\n abs((0.50 * lumaN ) + (-1.0 * lumaM) + (0.50 * lumaS )) +\n abs((0.25 * lumaNE) + (-0.5 * lumaE) + (0.25 * lumaSE));\n bool horzSpan = edgeHorz >= edgeVert;\n float lengthSign = horzSpan ? -rcpFrame.y : -rcpFrame.x;\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n float gradientN = abs(lumaN - lumaM);\n float gradientS = abs(lumaS - lumaM);\n lumaN = (lumaN + lumaM) * 0.5;\n lumaS = (lumaS + lumaM) * 0.5;\n bool pairN = gradientN >= gradientS;\n if(!pairN) lumaN = lumaS;\n if(!pairN) gradientN = gradientS;\n if(!pairN) lengthSign *= -1.0;\n float2 posN;\n posN.x = pos.x + (horzSpan ? 0.0 : lengthSign * 0.5);\n posN.y = pos.y + (horzSpan ? lengthSign * 0.5 : 0.0);\n gradientN *= FXAA_SEARCH_THRESHOLD;\n float2 posP = posN;\n float2 offNP = horzSpan ?\n FxaaFloat2(rcpFrame.x, 0.0) :\n FxaaFloat2(0.0, rcpFrame.y);\n float lumaEndN = lumaN;\n float lumaEndP = lumaN;\n bool doneN = false;\n bool doneP = false;\n #if FXAA_SEARCH_ACCELERATION == 1\n posN += offNP * FxaaFloat2(-1.0, -1.0);\n posP += offNP * FxaaFloat2( 1.0, 1.0);\n #endif\n #if FXAA_SEARCH_ACCELERATION == 2\n posN += offNP * FxaaFloat2(-1.5, -1.5);\n posP += offNP * FxaaFloat2( 1.5, 1.5);\n offNP *= FxaaFloat2(2.0, 2.0);\n #endif\n #if FXAA_SEARCH_ACCELERATION == 3\n posN += offNP * FxaaFloat2(-2.0, -2.0);\n posP += offNP * FxaaFloat2( 2.0, 2.0);\n offNP *= FxaaFloat2(3.0, 3.0);\n #endif\n #if FXAA_SEARCH_ACCELERATION == 4\n posN += offNP * FxaaFloat2(-2.5, -2.5);\n posP += offNP * FxaaFloat2( 2.5, 2.5);\n offNP *= FxaaFloat2(4.0, 4.0);\n #endif\n for(int i = 0; i < FXAA_SEARCH_STEPS; i++) {\n #if FXAA_SEARCH_ACCELERATION == 1\n if(!doneN) lumaEndN =\n FxaaLuma(FxaaTexLod0(tex, posN.xy).xyz);\n if(!doneP) lumaEndP =\n FxaaLuma(FxaaTexLod0(tex, posP.xy).xyz);\n #else\n if(!doneN) lumaEndN =\n FxaaLuma(FxaaTexGrad(tex, posN.xy, offNP).xyz);\n if(!doneP) lumaEndP =\n FxaaLuma(FxaaTexGrad(tex, posP.xy, offNP).xyz);\n #endif\n doneN = doneN || (abs(lumaEndN - lumaN) >= gradientN);\n doneP = doneP || (abs(lumaEndP - lumaN) >= gradientN);\n if(doneN && doneP) break;\n if(!doneN) posN -= offNP;\n if(!doneP) posP += offNP; }\n float dstN = horzSpan ? pos.x - posN.x : pos.y - posN.y;\n float dstP = horzSpan ? posP.x - pos.x : posP.y - pos.y;\n bool directionN = dstN < dstP;\n lumaEndN = directionN ? lumaEndN : lumaEndP;\n if(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))\n lengthSign = 0.0;\n float spanLength = (dstP + dstN);\n dstN = directionN ? dstN : dstP;\n float subPixelOffset = (0.5 + (dstN * (-1.0/spanLength))) * lengthSign;\n float3 rgbF = FxaaTexLod0(tex, FxaaFloat2(\n pos.x + (horzSpan ? 0.0 : subPixelOffset),\n pos.y + (horzSpan ? subPixelOffset : 0.0))).xyz;\n #if FXAA_SUBPIX == 0\n return FxaaFilterReturn(rgbF);\n #else\n return FxaaFilterReturn(FxaaLerp3(rgbL, rgbF, blendL));\n #endif\n}\nlayout(set = 1, binding = 1) uniform fxaaUBO {\n vec4 texSize;\n};\nlayout(set = 1, binding = 2) uniform sampler2D sceneColorMap;\nlayout(location = 0) in vec2 v_uv;\nvec4 frag () {\n vec3 color = FxaaPixelShader(v_uv, sceneColorMap, texSize.zw);\n float alpha = texture(sceneColorMap, v_uv).a;\n return vec4(color, alpha);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  282. },
  283. "glsl3": {
  284. "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 Pipeline {\n vec4 g_platform;\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).y = g_platform.w == 0.0 ? -(In.position).y : (In.position).y;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  285. "frag": "\nprecision highp float;\nprecision mediump int;\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\nvec4 fragTextureGrad (sampler2D tex, vec2 P, vec2 dPdx, vec2 dPdy) {\n #if defined(CC_USE_WGPU)\n return textureLod(tex, P, 0.0);\n #else\n return textureGrad(tex, P, dPdx, dPdy);\n #endif\n}\nvec4 fragTextureGrad (samplerCube tex, vec3 P, vec3 dPdx, vec3 dPdy) {\n #if defined(CC_USE_WGPU)\n return textureLod(tex, P, 0.0);\n #else\n return textureGrad(tex, P, dPdx, dPdy);\n #endif\n}\n#define int2 vec2\n#define float2 vec2\n#define float3 vec3\n#define float4 vec4\n#define FxaaBool3 bvec3\n#define FxaaInt2 vec2\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaBool2Float(a) mix(0.0, 1.0, (a))\n#define FxaaPow3(x, y) pow(x, y)\n#define FxaaSel3(f, t, b) mix((f), (t), (b))\n#define FxaaToFloat3(a) FxaaFloat3((a), (a), (a))\nfloat4 FxaaTexLod0(sampler2D tex, float2 pos) {\n #if defined(CC_USE_WGPU)\n return textureLod(tex, pos.xy, 0.0);\n #else\n return texture(tex, pos.xy);\n #endif\n}\nfloat4 FxaaTexGrad(sampler2D tex, float2 pos, float2 grad) {\n return fragTextureGrad(tex, pos.xy, grad, grad);\n}\nfloat4 FxaaTexOff(sampler2D tex, float2 pos, int2 off, float2 rcpFrame) {\n return FxaaTexLod0(tex, pos.xy + vec2(off.x, off.y) * rcpFrame);\n}\n#define FXAA_SRGB_ROP 0\n#ifndef FXAA_PRESET\n #define FXAA_PRESET 3\n#endif\n#if (FXAA_PRESET == 0)\n #define FXAA_EDGE_THRESHOLD (1.0/4.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/12.0)\n #define FXAA_SEARCH_STEPS 2\n #define FXAA_SEARCH_ACCELERATION 4\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 1\n #define FXAA_SUBPIX_CAP (2.0/3.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 1)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/16.0)\n #define FXAA_SEARCH_STEPS 4\n #define FXAA_SEARCH_ACCELERATION 3\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 2)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 8\n #define FXAA_SEARCH_ACCELERATION 2\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 3)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 16\n #define FXAA_SEARCH_ACCELERATION 1\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 4)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 24\n #define FXAA_SEARCH_ACCELERATION 1\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 5)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 32\n #define FXAA_SEARCH_ACCELERATION 1\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#define FXAA_SUBPIX_TRIM_SCALE (1.0/(1.0 - FXAA_SUBPIX_TRIM))\nfloat FxaaLuma(float3 rgb) {\n return rgb.y * (0.587/0.299) + rgb.x; }\nfloat3 FxaaLerp3(float3 a, float3 b, float amountOfA) {\n return (FxaaToFloat3(-amountOfA) * b) +\n ((a * FxaaToFloat3(amountOfA)) + b); }\nfloat3 FxaaFilterReturn(float3 rgb) {\n #if FXAA_SRGB_ROP\n return FxaaSel3(\n rgb * FxaaToFloat3(1.0/12.92),\n FxaaPow3(\n rgb * FxaaToFloat3(1.0/1.055) + FxaaToFloat3(0.055/1.055),\n FxaaToFloat3(2.4)),\n rgb > FxaaToFloat3(0.04045));\n #else\n return rgb;\n #endif\n}\nfloat3 FxaaPixelShader(float2 pos, sampler2D tex, float2 rcpFrame) {\n float3 rgbN = FxaaTexOff(tex, pos.xy, FxaaInt2( 0,-1), rcpFrame).xyz;\n float3 rgbW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1, 0), rcpFrame).xyz;\n float3 rgbM = FxaaTexOff(tex, pos.xy, FxaaInt2( 0, 0), rcpFrame).xyz;\n float3 rgbE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1, 0), rcpFrame).xyz;\n float3 rgbS = FxaaTexOff(tex, pos.xy, FxaaInt2( 0, 1), rcpFrame).xyz;\n float lumaN = FxaaLuma(rgbN);\n float lumaW = FxaaLuma(rgbW);\n float lumaM = FxaaLuma(rgbM);\n float lumaE = FxaaLuma(rgbE);\n float lumaS = FxaaLuma(rgbS);\n float rangeMin = min(lumaM, min(min(lumaN, lumaW), min(lumaS, lumaE)));\n float rangeMax = max(lumaM, max(max(lumaN, lumaW), max(lumaS, lumaE)));\n float range = rangeMax - rangeMin;\n #if FXAA_DEBUG\n float lumaO = lumaM / (1.0 + (0.587/0.299));\n #endif\n if(range < max(FXAA_EDGE_THRESHOLD_MIN, rangeMax * FXAA_EDGE_THRESHOLD)) {\n #if FXAA_DEBUG\n return FxaaFilterReturn(FxaaToFloat3(lumaO));\n #endif\n return FxaaFilterReturn(rgbM); }\n #if FXAA_SUBPIX > 0\n #if FXAA_SUBPIX_FASTER\n float3 rgbL = (rgbN + rgbW + rgbE + rgbS + rgbM) *\n FxaaToFloat3(1.0/5.0);\n #else\n float3 rgbL = rgbN + rgbW + rgbM + rgbE + rgbS;\n #endif\n #endif\n #if FXAA_SUBPIX != 0\n float lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;\n float rangeL = abs(lumaL - lumaM);\n #endif\n #if FXAA_SUBPIX == 1\n float blendL = max(0.0,\n (rangeL / range) - FXAA_SUBPIX_TRIM) * FXAA_SUBPIX_TRIM_SCALE;\n blendL = min(FXAA_SUBPIX_CAP, blendL);\n #endif\n #if FXAA_SUBPIX == 2\n float blendL = rangeL / range;\n #endif\n float3 rgbNW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1,-1), rcpFrame).xyz;\n float3 rgbNE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1,-1), rcpFrame).xyz;\n float3 rgbSW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1, 1), rcpFrame).xyz;\n float3 rgbSE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1, 1), rcpFrame).xyz;\n #if (FXAA_SUBPIX_FASTER == 0) && (FXAA_SUBPIX > 0)\n rgbL += (rgbNW + rgbNE + rgbSW + rgbSE);\n rgbL *= FxaaToFloat3(1.0/9.0);\n #endif\n float lumaNW = FxaaLuma(rgbNW);\n float lumaNE = FxaaLuma(rgbNE);\n float lumaSW = FxaaLuma(rgbSW);\n float lumaSE = FxaaLuma(rgbSE);\n float edgeVert =\n abs((0.25 * lumaNW) + (-0.5 * lumaN) + (0.25 * lumaNE)) +\n abs((0.50 * lumaW ) + (-1.0 * lumaM) + (0.50 * lumaE )) +\n abs((0.25 * lumaSW) + (-0.5 * lumaS) + (0.25 * lumaSE));\n float edgeHorz =\n abs((0.25 * lumaNW) + (-0.5 * lumaW) + (0.25 * lumaSW)) +\n abs((0.50 * lumaN ) + (-1.0 * lumaM) + (0.50 * lumaS )) +\n abs((0.25 * lumaNE) + (-0.5 * lumaE) + (0.25 * lumaSE));\n bool horzSpan = edgeHorz >= edgeVert;\n float lengthSign = horzSpan ? -rcpFrame.y : -rcpFrame.x;\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n float gradientN = abs(lumaN - lumaM);\n float gradientS = abs(lumaS - lumaM);\n lumaN = (lumaN + lumaM) * 0.5;\n lumaS = (lumaS + lumaM) * 0.5;\n bool pairN = gradientN >= gradientS;\n if(!pairN) lumaN = lumaS;\n if(!pairN) gradientN = gradientS;\n if(!pairN) lengthSign *= -1.0;\n float2 posN;\n posN.x = pos.x + (horzSpan ? 0.0 : lengthSign * 0.5);\n posN.y = pos.y + (horzSpan ? lengthSign * 0.5 : 0.0);\n gradientN *= FXAA_SEARCH_THRESHOLD;\n float2 posP = posN;\n float2 offNP = horzSpan ?\n FxaaFloat2(rcpFrame.x, 0.0) :\n FxaaFloat2(0.0, rcpFrame.y);\n float lumaEndN = lumaN;\n float lumaEndP = lumaN;\n bool doneN = false;\n bool doneP = false;\n #if FXAA_SEARCH_ACCELERATION == 1\n posN += offNP * FxaaFloat2(-1.0, -1.0);\n posP += offNP * FxaaFloat2( 1.0, 1.0);\n #endif\n #if FXAA_SEARCH_ACCELERATION == 2\n posN += offNP * FxaaFloat2(-1.5, -1.5);\n posP += offNP * FxaaFloat2( 1.5, 1.5);\n offNP *= FxaaFloat2(2.0, 2.0);\n #endif\n #if FXAA_SEARCH_ACCELERATION == 3\n posN += offNP * FxaaFloat2(-2.0, -2.0);\n posP += offNP * FxaaFloat2( 2.0, 2.0);\n offNP *= FxaaFloat2(3.0, 3.0);\n #endif\n #if FXAA_SEARCH_ACCELERATION == 4\n posN += offNP * FxaaFloat2(-2.5, -2.5);\n posP += offNP * FxaaFloat2( 2.5, 2.5);\n offNP *= FxaaFloat2(4.0, 4.0);\n #endif\n for(int i = 0; i < FXAA_SEARCH_STEPS; i++) {\n #if FXAA_SEARCH_ACCELERATION == 1\n if(!doneN) lumaEndN =\n FxaaLuma(FxaaTexLod0(tex, posN.xy).xyz);\n if(!doneP) lumaEndP =\n FxaaLuma(FxaaTexLod0(tex, posP.xy).xyz);\n #else\n if(!doneN) lumaEndN =\n FxaaLuma(FxaaTexGrad(tex, posN.xy, offNP).xyz);\n if(!doneP) lumaEndP =\n FxaaLuma(FxaaTexGrad(tex, posP.xy, offNP).xyz);\n #endif\n doneN = doneN || (abs(lumaEndN - lumaN) >= gradientN);\n doneP = doneP || (abs(lumaEndP - lumaN) >= gradientN);\n if(doneN && doneP) break;\n if(!doneN) posN -= offNP;\n if(!doneP) posP += offNP; }\n float dstN = horzSpan ? pos.x - posN.x : pos.y - posN.y;\n float dstP = horzSpan ? posP.x - pos.x : posP.y - pos.y;\n bool directionN = dstN < dstP;\n lumaEndN = directionN ? lumaEndN : lumaEndP;\n if(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))\n lengthSign = 0.0;\n float spanLength = (dstP + dstN);\n dstN = directionN ? dstN : dstP;\n float subPixelOffset = (0.5 + (dstN * (-1.0/spanLength))) * lengthSign;\n float3 rgbF = FxaaTexLod0(tex, FxaaFloat2(\n pos.x + (horzSpan ? 0.0 : subPixelOffset),\n pos.y + (horzSpan ? subPixelOffset : 0.0))).xyz;\n #if FXAA_SUBPIX == 0\n return FxaaFilterReturn(rgbF);\n #else\n return FxaaFilterReturn(FxaaLerp3(rgbL, rgbF, blendL));\n #endif\n}\nlayout(std140) uniform fxaaUBO {\n vec4 texSize;\n};\nuniform sampler2D sceneColorMap;\nin vec2 v_uv;\nvec4 frag () {\n vec3 color = FxaaPixelShader(v_uv, sceneColorMap, texSize.zw);\n float alpha = texture(sceneColorMap, v_uv).a;\n return vec4(color, alpha);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  286. },
  287. "glsl1": {
  288. "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\n uniform vec4 g_platform;\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).y = g_platform.w == 0.0 ? -(In.position).y : (In.position).y;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}",
  289. "frag": "\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\nprecision mediump int;\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\nvec4 fragTextureGrad (sampler2D tex, vec2 P, vec2 dPdx, vec2 dPdy) {\n #ifdef GL_EXT_shader_texture_lod\n return texture2DGradEXT(tex, P, dPdx, dPdy);\n #else\n return texture2D(tex, P);\n #endif\n}\nvec4 fragTextureGrad (samplerCube tex, vec3 P, vec3 dPdx, vec3 dPdy) {\n #ifdef GL_EXT_shader_texture_lod\n return textureCubeGradEXT(tex, P, dPdx, dPdy);\n #else\n return textureCube(tex, P);\n #endif\n}\n#define int2 vec2\n#define float2 vec2\n#define float3 vec3\n#define float4 vec4\n#define FxaaBool3 bvec3\n#define FxaaInt2 vec2\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaBool2Float(a) mix(0.0, 1.0, (a))\n#define FxaaPow3(x, y) pow(x, y)\n#define FxaaSel3(f, t, b) mix((f), (t), (b))\n#define FxaaToFloat3(a) FxaaFloat3((a), (a), (a))\nfloat4 FxaaTexLod0(sampler2D tex, float2 pos) {\n #if defined(CC_USE_WGPU)\n return texture2DLod(tex, pos.xy, 0.0);\n #else\n return texture2D(tex, pos.xy);\n #endif\n}\nfloat4 FxaaTexGrad(sampler2D tex, float2 pos, float2 grad) {\n return fragTextureGrad(tex, pos.xy, grad, grad);\n}\nfloat4 FxaaTexOff(sampler2D tex, float2 pos, int2 off, float2 rcpFrame) {\n return FxaaTexLod0(tex, pos.xy + vec2(off.x, off.y) * rcpFrame);\n}\n#define FXAA_SRGB_ROP 0\n#ifndef FXAA_PRESET\n #define FXAA_PRESET 3\n#endif\n#if (FXAA_PRESET == 0)\n #define FXAA_EDGE_THRESHOLD (1.0/4.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/12.0)\n #define FXAA_SEARCH_STEPS 2\n #define FXAA_SEARCH_ACCELERATION 4\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 1\n #define FXAA_SUBPIX_CAP (2.0/3.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 1)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/16.0)\n #define FXAA_SEARCH_STEPS 4\n #define FXAA_SEARCH_ACCELERATION 3\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 2)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 8\n #define FXAA_SEARCH_ACCELERATION 2\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 3)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 16\n #define FXAA_SEARCH_ACCELERATION 1\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 4)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 24\n #define FXAA_SEARCH_ACCELERATION 1\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#if (FXAA_PRESET == 5)\n #define FXAA_EDGE_THRESHOLD (1.0/8.0)\n #define FXAA_EDGE_THRESHOLD_MIN (1.0/24.0)\n #define FXAA_SEARCH_STEPS 32\n #define FXAA_SEARCH_ACCELERATION 1\n #define FXAA_SEARCH_THRESHOLD (1.0/4.0)\n #define FXAA_SUBPIX 1\n #define FXAA_SUBPIX_FASTER 0\n #define FXAA_SUBPIX_CAP (3.0/4.0)\n #define FXAA_SUBPIX_TRIM (1.0/4.0)\n#endif\n#define FXAA_SUBPIX_TRIM_SCALE (1.0/(1.0 - FXAA_SUBPIX_TRIM))\nfloat FxaaLuma(float3 rgb) {\n return rgb.y * (0.587/0.299) + rgb.x; }\nfloat3 FxaaLerp3(float3 a, float3 b, float amountOfA) {\n return (FxaaToFloat3(-amountOfA) * b) +\n ((a * FxaaToFloat3(amountOfA)) + b); }\nfloat3 FxaaFilterReturn(float3 rgb) {\n #if FXAA_SRGB_ROP\n return FxaaSel3(\n rgb * FxaaToFloat3(1.0/12.92),\n FxaaPow3(\n rgb * FxaaToFloat3(1.0/1.055) + FxaaToFloat3(0.055/1.055),\n FxaaToFloat3(2.4)),\n rgb > FxaaToFloat3(0.04045));\n #else\n return rgb;\n #endif\n}\nfloat3 FxaaPixelShader(float2 pos, sampler2D tex, float2 rcpFrame) {\n float3 rgbN = FxaaTexOff(tex, pos.xy, FxaaInt2( 0,-1), rcpFrame).xyz;\n float3 rgbW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1, 0), rcpFrame).xyz;\n float3 rgbM = FxaaTexOff(tex, pos.xy, FxaaInt2( 0, 0), rcpFrame).xyz;\n float3 rgbE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1, 0), rcpFrame).xyz;\n float3 rgbS = FxaaTexOff(tex, pos.xy, FxaaInt2( 0, 1), rcpFrame).xyz;\n float lumaN = FxaaLuma(rgbN);\n float lumaW = FxaaLuma(rgbW);\n float lumaM = FxaaLuma(rgbM);\n float lumaE = FxaaLuma(rgbE);\n float lumaS = FxaaLuma(rgbS);\n float rangeMin = min(lumaM, min(min(lumaN, lumaW), min(lumaS, lumaE)));\n float rangeMax = max(lumaM, max(max(lumaN, lumaW), max(lumaS, lumaE)));\n float range = rangeMax - rangeMin;\n #if FXAA_DEBUG\n float lumaO = lumaM / (1.0 + (0.587/0.299));\n #endif\n if(range < max(FXAA_EDGE_THRESHOLD_MIN, rangeMax * FXAA_EDGE_THRESHOLD)) {\n #if FXAA_DEBUG\n return FxaaFilterReturn(FxaaToFloat3(lumaO));\n #endif\n return FxaaFilterReturn(rgbM); }\n #if FXAA_SUBPIX > 0\n #if FXAA_SUBPIX_FASTER\n float3 rgbL = (rgbN + rgbW + rgbE + rgbS + rgbM) *\n FxaaToFloat3(1.0/5.0);\n #else\n float3 rgbL = rgbN + rgbW + rgbM + rgbE + rgbS;\n #endif\n #endif\n #if FXAA_SUBPIX != 0\n float lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;\n float rangeL = abs(lumaL - lumaM);\n #endif\n #if FXAA_SUBPIX == 1\n float blendL = max(0.0,\n (rangeL / range) - FXAA_SUBPIX_TRIM) * FXAA_SUBPIX_TRIM_SCALE;\n blendL = min(FXAA_SUBPIX_CAP, blendL);\n #endif\n #if FXAA_SUBPIX == 2\n float blendL = rangeL / range;\n #endif\n float3 rgbNW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1,-1), rcpFrame).xyz;\n float3 rgbNE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1,-1), rcpFrame).xyz;\n float3 rgbSW = FxaaTexOff(tex, pos.xy, FxaaInt2(-1, 1), rcpFrame).xyz;\n float3 rgbSE = FxaaTexOff(tex, pos.xy, FxaaInt2( 1, 1), rcpFrame).xyz;\n #if (FXAA_SUBPIX_FASTER == 0) && (FXAA_SUBPIX > 0)\n rgbL += (rgbNW + rgbNE + rgbSW + rgbSE);\n rgbL *= FxaaToFloat3(1.0/9.0);\n #endif\n float lumaNW = FxaaLuma(rgbNW);\n float lumaNE = FxaaLuma(rgbNE);\n float lumaSW = FxaaLuma(rgbSW);\n float lumaSE = FxaaLuma(rgbSE);\n float edgeVert =\n abs((0.25 * lumaNW) + (-0.5 * lumaN) + (0.25 * lumaNE)) +\n abs((0.50 * lumaW ) + (-1.0 * lumaM) + (0.50 * lumaE )) +\n abs((0.25 * lumaSW) + (-0.5 * lumaS) + (0.25 * lumaSE));\n float edgeHorz =\n abs((0.25 * lumaNW) + (-0.5 * lumaW) + (0.25 * lumaSW)) +\n abs((0.50 * lumaN ) + (-1.0 * lumaM) + (0.50 * lumaS )) +\n abs((0.25 * lumaNE) + (-0.5 * lumaE) + (0.25 * lumaSE));\n bool horzSpan = edgeHorz >= edgeVert;\n float lengthSign = horzSpan ? -rcpFrame.y : -rcpFrame.x;\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n float gradientN = abs(lumaN - lumaM);\n float gradientS = abs(lumaS - lumaM);\n lumaN = (lumaN + lumaM) * 0.5;\n lumaS = (lumaS + lumaM) * 0.5;\n bool pairN = gradientN >= gradientS;\n if(!pairN) lumaN = lumaS;\n if(!pairN) gradientN = gradientS;\n if(!pairN) lengthSign *= -1.0;\n float2 posN;\n posN.x = pos.x + (horzSpan ? 0.0 : lengthSign * 0.5);\n posN.y = pos.y + (horzSpan ? lengthSign * 0.5 : 0.0);\n gradientN *= FXAA_SEARCH_THRESHOLD;\n float2 posP = posN;\n float2 offNP = horzSpan ?\n FxaaFloat2(rcpFrame.x, 0.0) :\n FxaaFloat2(0.0, rcpFrame.y);\n float lumaEndN = lumaN;\n float lumaEndP = lumaN;\n bool doneN = false;\n bool doneP = false;\n #if FXAA_SEARCH_ACCELERATION == 1\n posN += offNP * FxaaFloat2(-1.0, -1.0);\n posP += offNP * FxaaFloat2( 1.0, 1.0);\n #endif\n #if FXAA_SEARCH_ACCELERATION == 2\n posN += offNP * FxaaFloat2(-1.5, -1.5);\n posP += offNP * FxaaFloat2( 1.5, 1.5);\n offNP *= FxaaFloat2(2.0, 2.0);\n #endif\n #if FXAA_SEARCH_ACCELERATION == 3\n posN += offNP * FxaaFloat2(-2.0, -2.0);\n posP += offNP * FxaaFloat2( 2.0, 2.0);\n offNP *= FxaaFloat2(3.0, 3.0);\n #endif\n #if FXAA_SEARCH_ACCELERATION == 4\n posN += offNP * FxaaFloat2(-2.5, -2.5);\n posP += offNP * FxaaFloat2( 2.5, 2.5);\n offNP *= FxaaFloat2(4.0, 4.0);\n #endif\n for(int i = 0; i < FXAA_SEARCH_STEPS; i++) {\n #if FXAA_SEARCH_ACCELERATION == 1\n if(!doneN) lumaEndN =\n FxaaLuma(FxaaTexLod0(tex, posN.xy).xyz);\n if(!doneP) lumaEndP =\n FxaaLuma(FxaaTexLod0(tex, posP.xy).xyz);\n #else\n if(!doneN) lumaEndN =\n FxaaLuma(FxaaTexGrad(tex, posN.xy, offNP).xyz);\n if(!doneP) lumaEndP =\n FxaaLuma(FxaaTexGrad(tex, posP.xy, offNP).xyz);\n #endif\n doneN = doneN || (abs(lumaEndN - lumaN) >= gradientN);\n doneP = doneP || (abs(lumaEndP - lumaN) >= gradientN);\n if(doneN && doneP) break;\n if(!doneN) posN -= offNP;\n if(!doneP) posP += offNP; }\n float dstN = horzSpan ? pos.x - posN.x : pos.y - posN.y;\n float dstP = horzSpan ? posP.x - pos.x : posP.y - pos.y;\n bool directionN = dstN < dstP;\n lumaEndN = directionN ? lumaEndN : lumaEndP;\n if(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))\n lengthSign = 0.0;\n float spanLength = (dstP + dstN);\n dstN = directionN ? dstN : dstP;\n float subPixelOffset = (0.5 + (dstN * (-1.0/spanLength))) * lengthSign;\n float3 rgbF = FxaaTexLod0(tex, FxaaFloat2(\n pos.x + (horzSpan ? 0.0 : subPixelOffset),\n pos.y + (horzSpan ? subPixelOffset : 0.0))).xyz;\n #if FXAA_SUBPIX == 0\n return FxaaFilterReturn(rgbF);\n #else\n return FxaaFilterReturn(FxaaLerp3(rgbL, rgbF, blendL));\n #endif\n}\n uniform vec4 texSize;\nuniform sampler2D sceneColorMap;\nvarying vec2 v_uv;\nvec4 frag () {\n vec3 color = FxaaPixelShader(v_uv, sceneColorMap, texSize.zw);\n float alpha = texture2D(sceneColorMap, v_uv).a;\n return vec4(color, alpha);\n}\nvoid main() { gl_FragColor = frag(); }"
  290. },
  291. "builtins": {
  292. "globals": {
  293. "blocks": [],
  294. "samplerTextures": [],
  295. "buffers": [],
  296. "images": []
  297. },
  298. "locals": {
  299. "blocks": [],
  300. "samplerTextures": [],
  301. "buffers": [],
  302. "images": []
  303. },
  304. "statistics": {
  305. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 1,
  306. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 1
  307. }
  308. },
  309. "defines": [
  310. {
  311. "name": "USE_INSTANCING",
  312. "type": "boolean",
  313. "defines": [],
  314. "editor": {
  315. "elevated": true
  316. }
  317. },
  318. {
  319. "name": "CC_USE_SKINNING",
  320. "type": "boolean",
  321. "defines": []
  322. },
  323. {
  324. "name": "CC_USE_BAKED_ANIMATION",
  325. "type": "boolean",
  326. "defines": [
  327. "USE_INSTANCING"
  328. ]
  329. },
  330. {
  331. "name": "CC_USE_LIGHTMAP",
  332. "type": "boolean",
  333. "defines": [
  334. "USE_INSTANCING"
  335. ]
  336. },
  337. {
  338. "name": "CC_USE_REFLECTION_PROBE",
  339. "type": "boolean",
  340. "defines": [
  341. "USE_INSTANCING"
  342. ]
  343. },
  344. {
  345. "name": "CC_RECEIVE_SHADOW",
  346. "type": "boolean",
  347. "defines": [
  348. "USE_INSTANCING"
  349. ]
  350. },
  351. {
  352. "name": "CC_USE_LIGHT_PROBE",
  353. "type": "boolean",
  354. "defines": [
  355. "USE_INSTANCING"
  356. ]
  357. },
  358. {
  359. "name": "CC_USE_MORPH",
  360. "type": "boolean",
  361. "defines": []
  362. },
  363. {
  364. "name": "FXAA_DEBUG",
  365. "type": "boolean",
  366. "defines": []
  367. }
  368. ],
  369. "name": "pipeline/post-process/fxaa-hq1|fxaa-vs|fxaa-edge-fs:frag"
  370. }
  371. ],
  372. "combinations": [],
  373. "hideInEditor": false
  374. }