6624c63c-0e3d-4d5f-bd15-a7805b71c521.json 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "pipeline/smaa",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "name": "smaa",
  10. "passes": [
  11. {
  12. "program": "pipeline/smaa|smaa-edge-vs:vert|smaa-edge-fs:frag",
  13. "depthStencilState": {
  14. "depthTest": false,
  15. "depthWrite": false
  16. },
  17. "properties": {
  18. "u_texSampler": {
  19. "type": 28,
  20. "samplerHash": 650
  21. }
  22. }
  23. },
  24. {
  25. "program": "pipeline/smaa|smaa-blend-vs:vert|smaa-blend-fs:frag",
  26. "depthStencilState": {
  27. "depthTest": false,
  28. "depthWrite": false
  29. },
  30. "properties": {
  31. "u_edgeTexSampler": {
  32. "type": 28,
  33. "samplerHash": 650
  34. },
  35. "u_areaTexSampler": {
  36. "type": 28,
  37. "samplerHash": 650
  38. },
  39. "u_searchTexSampler": {
  40. "type": 28,
  41. "samplerHash": 645
  42. }
  43. }
  44. }
  45. ]
  46. }
  47. ],
  48. "shaders": [
  49. {
  50. "blocks": [],
  51. "samplerTextures": [
  52. {
  53. "name": "u_texSampler",
  54. "type": 28,
  55. "count": 1,
  56. "defines": [],
  57. "stageFlags": 16,
  58. "binding": 0
  59. }
  60. ],
  61. "samplers": [],
  62. "textures": [],
  63. "buffers": [],
  64. "images": [],
  65. "subpassInputs": [],
  66. "attributes": [
  67. {
  68. "name": "a_position",
  69. "defines": [],
  70. "format": 21,
  71. "location": 0
  72. },
  73. {
  74. "name": "a_texCoord",
  75. "defines": [],
  76. "format": 21,
  77. "location": 1
  78. }
  79. ],
  80. "varyings": [
  81. {
  82. "name": "v_uv",
  83. "type": 14,
  84. "count": 1,
  85. "defines": [],
  86. "stageFlags": 17,
  87. "location": 0
  88. },
  89. {
  90. "name": "v_offsets",
  91. "type": 16,
  92. "count": 3,
  93. "defines": [],
  94. "stageFlags": 17,
  95. "location": 1
  96. }
  97. ],
  98. "fragColors": [
  99. {
  100. "name": "cc_FragColor",
  101. "typename": "vec4",
  102. "type": 16,
  103. "count": 1,
  104. "defines": [],
  105. "stageFlags": 16,
  106. "location": 0
  107. }
  108. ],
  109. "descriptors": [
  110. {
  111. "rate": 0,
  112. "blocks": [],
  113. "samplerTextures": [],
  114. "samplers": [],
  115. "textures": [],
  116. "buffers": [],
  117. "images": [],
  118. "subpassInputs": []
  119. },
  120. {
  121. "rate": 1,
  122. "blocks": [],
  123. "samplerTextures": [
  124. {
  125. "name": "u_texSampler",
  126. "type": 28,
  127. "count": 1,
  128. "defines": [],
  129. "stageFlags": 16,
  130. "binding": 0
  131. }
  132. ],
  133. "samplers": [],
  134. "textures": [],
  135. "buffers": [],
  136. "images": [],
  137. "subpassInputs": []
  138. },
  139. {
  140. "rate": 2,
  141. "blocks": [],
  142. "samplerTextures": [],
  143. "samplers": [],
  144. "textures": [],
  145. "buffers": [],
  146. "images": [],
  147. "subpassInputs": []
  148. },
  149. {
  150. "rate": 3,
  151. "blocks": [
  152. {
  153. "tags": {
  154. "builtin": "global"
  155. },
  156. "name": "CCGlobal",
  157. "members": [
  158. {
  159. "name": "cc_time",
  160. "typename": "vec4",
  161. "type": 16,
  162. "count": 1,
  163. "precision": "highp "
  164. },
  165. {
  166. "name": "cc_screenSize",
  167. "typename": "vec4",
  168. "type": 16,
  169. "count": 1,
  170. "precision": "mediump "
  171. },
  172. {
  173. "name": "cc_nativeSize",
  174. "typename": "vec4",
  175. "type": 16,
  176. "count": 1,
  177. "precision": "mediump "
  178. },
  179. {
  180. "name": "cc_probeInfo",
  181. "typename": "vec4",
  182. "type": 16,
  183. "count": 1,
  184. "precision": "mediump "
  185. },
  186. {
  187. "name": "cc_debug_view_mode",
  188. "typename": "vec4",
  189. "type": 16,
  190. "count": 1,
  191. "precision": "mediump "
  192. }
  193. ],
  194. "defines": [],
  195. "stageFlags": 17
  196. },
  197. {
  198. "tags": {
  199. "builtin": "global"
  200. },
  201. "name": "CCCamera",
  202. "members": [
  203. {
  204. "name": "cc_matView",
  205. "typename": "mat4",
  206. "type": 25,
  207. "count": 1,
  208. "precision": "highp "
  209. },
  210. {
  211. "name": "cc_matViewInv",
  212. "typename": "mat4",
  213. "type": 25,
  214. "count": 1,
  215. "precision": "highp "
  216. },
  217. {
  218. "name": "cc_matProj",
  219. "typename": "mat4",
  220. "type": 25,
  221. "count": 1,
  222. "precision": "highp "
  223. },
  224. {
  225. "name": "cc_matProjInv",
  226. "typename": "mat4",
  227. "type": 25,
  228. "count": 1,
  229. "precision": "highp "
  230. },
  231. {
  232. "name": "cc_matViewProj",
  233. "typename": "mat4",
  234. "type": 25,
  235. "count": 1,
  236. "precision": "highp "
  237. },
  238. {
  239. "name": "cc_matViewProjInv",
  240. "typename": "mat4",
  241. "type": 25,
  242. "count": 1,
  243. "precision": "highp "
  244. },
  245. {
  246. "name": "cc_cameraPos",
  247. "typename": "vec4",
  248. "type": 16,
  249. "count": 1,
  250. "precision": "highp "
  251. },
  252. {
  253. "name": "cc_surfaceTransform",
  254. "typename": "vec4",
  255. "type": 16,
  256. "count": 1,
  257. "precision": "mediump "
  258. },
  259. {
  260. "name": "cc_screenScale",
  261. "typename": "vec4",
  262. "type": 16,
  263. "count": 1,
  264. "precision": "mediump "
  265. },
  266. {
  267. "name": "cc_exposure",
  268. "typename": "vec4",
  269. "type": 16,
  270. "count": 1,
  271. "precision": "mediump "
  272. },
  273. {
  274. "name": "cc_mainLitDir",
  275. "typename": "vec4",
  276. "type": 16,
  277. "count": 1,
  278. "precision": "mediump "
  279. },
  280. {
  281. "name": "cc_mainLitColor",
  282. "typename": "vec4",
  283. "type": 16,
  284. "count": 1,
  285. "precision": "mediump "
  286. },
  287. {
  288. "name": "cc_ambientSky",
  289. "typename": "vec4",
  290. "type": 16,
  291. "count": 1,
  292. "precision": "mediump "
  293. },
  294. {
  295. "name": "cc_ambientGround",
  296. "typename": "vec4",
  297. "type": 16,
  298. "count": 1,
  299. "precision": "mediump "
  300. },
  301. {
  302. "name": "cc_fogColor",
  303. "typename": "vec4",
  304. "type": 16,
  305. "count": 1,
  306. "precision": "mediump "
  307. },
  308. {
  309. "name": "cc_fogBase",
  310. "typename": "vec4",
  311. "type": 16,
  312. "count": 1,
  313. "precision": "mediump "
  314. },
  315. {
  316. "name": "cc_fogAdd",
  317. "typename": "vec4",
  318. "type": 16,
  319. "count": 1,
  320. "precision": "mediump "
  321. },
  322. {
  323. "name": "cc_nearFar",
  324. "typename": "vec4",
  325. "type": 16,
  326. "count": 1,
  327. "precision": "mediump "
  328. },
  329. {
  330. "name": "cc_viewPort",
  331. "typename": "vec4",
  332. "type": 16,
  333. "count": 1,
  334. "precision": "mediump "
  335. }
  336. ],
  337. "defines": [],
  338. "stageFlags": 17
  339. }
  340. ],
  341. "samplerTextures": [],
  342. "samplers": [],
  343. "textures": [],
  344. "buffers": [],
  345. "images": [],
  346. "subpassInputs": []
  347. }
  348. ],
  349. "hash": 2940525674,
  350. "glsl4": {
  351. "vert": "\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 a_position;\nlayout(location = 1) in vec2 a_texCoord;\nlayout(location = 0) out vec2 v_uv;\nlayout(location = 1) out vec4 v_offsets[3];\nvec4 vert () {\n vec4 pos = vec4(a_position, 0.0, 1.0);\n v_uv = a_texCoord * cc_screenScale.xy;\n v_offsets[0] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-1.0, 0.0, 0.0, 1.0);\n v_offsets[1] = v_uv.xyxy + cc_nativeSize.zwzw * vec4( 1.0, 0.0, 0.0, -1.0);\n v_offsets[2] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-2.0, 0.0, 0.0, 2.0);\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  352. "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};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nlayout(location = 0) in vec2 v_uv;\nlayout(location = 1) in vec4 v_offsets[3];\nlayout(set = 1, binding = 0) uniform sampler2D u_texSampler;\nvec3 ToLDR(vec3 color) {\n#if CC_USE_HDR\n color *= cc_exposure.x * FP_SCALE_INV;\n color = ACESToneMap(color);\n color = LinearToSRGB(color);\n#endif\n return color;\n}\nvec4 frag () {\n vec2 threshold = vec2(0.1, 0.1);\n vec4 delta;\n vec3 C = ToLDR(texture(u_texSampler, v_uv).rgb);\n vec3 Cleft = ToLDR(texture(u_texSampler, v_offsets[0].xy).rgb);\n vec3 t = abs(C - Cleft);\n delta.x = max(max(t.r, t.g), t.b);\n vec3 Ctop = ToLDR(texture(u_texSampler, v_offsets[0].zw).rgb);\n t = abs(C - Ctop);\n delta.y = max(max(t.r, t.g), t.b);\n vec2 edges = step(threshold, delta.xy);\n if (dot(edges, vec2(1.0, 1.0)) == 0.0)\n discard;\n vec3 Cright = ToLDR(texture(u_texSampler, v_offsets[1].xy).rgb);\n t = abs(C - Cright);\n delta.z = max(max(t.r, t.g), t.b);\n vec3 Cbottom = ToLDR(texture(u_texSampler, v_offsets[1].zw).rgb);\n t = abs(C - Cbottom);\n delta.w = max(max(t.r, t.g), t.b);\n float maxDelta = max(max(max(delta.x, delta.y), delta.z), delta.w);\n vec3 Cleftleft = ToLDR(texture(u_texSampler, v_offsets[2].xy).rgb);\n t = abs(C - Cleftleft);\n delta.z = max(max(t.r, t.g), t.b);\n vec3 Ctoptop = ToLDR(texture(u_texSampler, v_offsets[2].zw).rgb);\n t = abs(C - Ctoptop);\n delta.w = max(max(t.r, t.g), t.b);\n maxDelta = max(max(maxDelta, delta.z), delta.w);\n edges.xy *= step(0.5 * maxDelta, delta.xy);\n vec4 o = vec4(edges, 0.0, 0.0);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  353. },
  354. "glsl3": {
  355. "vert": "\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 a_position;\nin vec2 a_texCoord;\nout vec2 v_uv;\nout vec4 v_offsets[3];\nvec4 vert () {\n vec4 pos = vec4(a_position, 0.0, 1.0);\n v_uv = a_texCoord * cc_screenScale.xy;\n v_offsets[0] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-1.0, 0.0, 0.0, 1.0);\n v_offsets[1] = v_uv.xyxy + cc_nativeSize.zwzw * vec4( 1.0, 0.0, 0.0, -1.0);\n v_offsets[2] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-2.0, 0.0, 0.0, 2.0);\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  356. "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};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nin vec2 v_uv;\nin vec4 v_offsets[3];\nuniform sampler2D u_texSampler;\nvec3 ToLDR(vec3 color) {\n#if CC_USE_HDR\n color *= cc_exposure.x * FP_SCALE_INV;\n color = ACESToneMap(color);\n color = LinearToSRGB(color);\n#endif\n return color;\n}\nvec4 frag () {\n vec2 threshold = vec2(0.1, 0.1);\n vec4 delta;\n vec3 C = ToLDR(texture(u_texSampler, v_uv).rgb);\n vec3 Cleft = ToLDR(texture(u_texSampler, v_offsets[0].xy).rgb);\n vec3 t = abs(C - Cleft);\n delta.x = max(max(t.r, t.g), t.b);\n vec3 Ctop = ToLDR(texture(u_texSampler, v_offsets[0].zw).rgb);\n t = abs(C - Ctop);\n delta.y = max(max(t.r, t.g), t.b);\n vec2 edges = step(threshold, delta.xy);\n if (dot(edges, vec2(1.0, 1.0)) == 0.0)\n discard;\n vec3 Cright = ToLDR(texture(u_texSampler, v_offsets[1].xy).rgb);\n t = abs(C - Cright);\n delta.z = max(max(t.r, t.g), t.b);\n vec3 Cbottom = ToLDR(texture(u_texSampler, v_offsets[1].zw).rgb);\n t = abs(C - Cbottom);\n delta.w = max(max(t.r, t.g), t.b);\n float maxDelta = max(max(max(delta.x, delta.y), delta.z), delta.w);\n vec3 Cleftleft = ToLDR(texture(u_texSampler, v_offsets[2].xy).rgb);\n t = abs(C - Cleftleft);\n delta.z = max(max(t.r, t.g), t.b);\n vec3 Ctoptop = ToLDR(texture(u_texSampler, v_offsets[2].zw).rgb);\n t = abs(C - Ctoptop);\n delta.w = max(max(t.r, t.g), t.b);\n maxDelta = max(max(maxDelta, delta.z), delta.w);\n edges.xy *= step(0.5 * maxDelta, delta.xy);\n vec4 o = vec4(edges, 0.0, 0.0);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  357. },
  358. "glsl1": {
  359. "vert": "\nprecision highp float;\nuniform mediump vec4 cc_nativeSize;\nuniform mediump vec4 cc_screenScale;\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nvarying vec2 v_uv;\nvarying vec4 v_offsets[3];\nvec4 vert () {\n vec4 pos = vec4(a_position, 0.0, 1.0);\n v_uv = a_texCoord * cc_screenScale.xy;\n v_offsets[0] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-1.0, 0.0, 0.0, 1.0);\n v_offsets[1] = v_uv.xyxy + cc_nativeSize.zwzw * vec4( 1.0, 0.0, 0.0, -1.0);\n v_offsets[2] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-2.0, 0.0, 0.0, 2.0);\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  360. "frag": "\nprecision highp float;\nuniform mediump vec4 cc_exposure;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvarying vec2 v_uv;\nvarying vec4 v_offsets[3];\nuniform sampler2D u_texSampler;\nvec3 ToLDR(vec3 color) {\n#if CC_USE_HDR\n color *= cc_exposure.x * FP_SCALE_INV;\n color = ACESToneMap(color);\n color = LinearToSRGB(color);\n#endif\n return color;\n}\nvec4 frag () {\n vec2 threshold = vec2(0.1, 0.1);\n vec4 delta;\n vec3 C = ToLDR(texture2D(u_texSampler, v_uv).rgb);\n vec3 Cleft = ToLDR(texture2D(u_texSampler, v_offsets[0].xy).rgb);\n vec3 t = abs(C - Cleft);\n delta.x = max(max(t.r, t.g), t.b);\n vec3 Ctop = ToLDR(texture2D(u_texSampler, v_offsets[0].zw).rgb);\n t = abs(C - Ctop);\n delta.y = max(max(t.r, t.g), t.b);\n vec2 edges = step(threshold, delta.xy);\n if (dot(edges, vec2(1.0, 1.0)) == 0.0)\n discard;\n vec3 Cright = ToLDR(texture2D(u_texSampler, v_offsets[1].xy).rgb);\n t = abs(C - Cright);\n delta.z = max(max(t.r, t.g), t.b);\n vec3 Cbottom = ToLDR(texture2D(u_texSampler, v_offsets[1].zw).rgb);\n t = abs(C - Cbottom);\n delta.w = max(max(t.r, t.g), t.b);\n float maxDelta = max(max(max(delta.x, delta.y), delta.z), delta.w);\n vec3 Cleftleft = ToLDR(texture2D(u_texSampler, v_offsets[2].xy).rgb);\n t = abs(C - Cleftleft);\n delta.z = max(max(t.r, t.g), t.b);\n vec3 Ctoptop = ToLDR(texture2D(u_texSampler, v_offsets[2].zw).rgb);\n t = abs(C - Ctoptop);\n delta.w = max(max(t.r, t.g), t.b);\n maxDelta = max(max(maxDelta, delta.z), delta.w);\n edges.xy *= step(0.5 * maxDelta, delta.xy);\n vec4 o = vec4(edges, 0.0, 0.0);\n return o;\n}\nvoid main() { gl_FragColor = frag(); }"
  361. },
  362. "builtins": {
  363. "globals": {
  364. "blocks": [
  365. {
  366. "name": "CCGlobal",
  367. "defines": []
  368. },
  369. {
  370. "name": "CCCamera",
  371. "defines": []
  372. }
  373. ],
  374. "samplerTextures": [],
  375. "buffers": [],
  376. "images": []
  377. },
  378. "locals": {
  379. "blocks": [],
  380. "samplerTextures": [],
  381. "buffers": [],
  382. "images": []
  383. },
  384. "statistics": {
  385. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 42,
  386. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 42
  387. }
  388. },
  389. "defines": [
  390. {
  391. "name": "CC_USE_DEBUG_VIEW",
  392. "type": "number",
  393. "defines": [],
  394. "range": [
  395. 0,
  396. 3
  397. ]
  398. },
  399. {
  400. "name": "CC_SURFACES_ENABLE_DEBUG_VIEW",
  401. "type": "boolean",
  402. "defines": [
  403. "CC_USE_DEBUG_VIEW",
  404. "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC"
  405. ]
  406. },
  407. {
  408. "name": "CC_USE_HDR",
  409. "type": "boolean",
  410. "defines": []
  411. }
  412. ],
  413. "name": "pipeline/smaa|smaa-edge-vs:vert|smaa-edge-fs:frag"
  414. },
  415. {
  416. "blocks": [],
  417. "samplerTextures": [
  418. {
  419. "name": "u_edgeTexSampler",
  420. "type": 28,
  421. "count": 1,
  422. "defines": [],
  423. "stageFlags": 16,
  424. "binding": 0
  425. },
  426. {
  427. "name": "u_areaTexSampler",
  428. "type": 28,
  429. "count": 1,
  430. "defines": [],
  431. "stageFlags": 16,
  432. "binding": 1
  433. },
  434. {
  435. "name": "u_searchTexSampler",
  436. "type": 28,
  437. "count": 1,
  438. "defines": [],
  439. "stageFlags": 16,
  440. "binding": 2
  441. }
  442. ],
  443. "samplers": [],
  444. "textures": [],
  445. "buffers": [],
  446. "images": [],
  447. "subpassInputs": [],
  448. "attributes": [
  449. {
  450. "name": "a_position",
  451. "defines": [],
  452. "format": 21,
  453. "location": 0
  454. },
  455. {
  456. "name": "a_texCoord",
  457. "defines": [],
  458. "format": 21,
  459. "location": 1
  460. }
  461. ],
  462. "varyings": [
  463. {
  464. "name": "v_uv",
  465. "type": 14,
  466. "count": 1,
  467. "defines": [],
  468. "stageFlags": 17,
  469. "location": 0
  470. },
  471. {
  472. "name": "v_offsets",
  473. "type": 16,
  474. "count": 3,
  475. "defines": [],
  476. "stageFlags": 17,
  477. "location": 1
  478. },
  479. {
  480. "name": "v_pixCoord",
  481. "type": 14,
  482. "count": 1,
  483. "defines": [],
  484. "stageFlags": 17,
  485. "location": 2
  486. }
  487. ],
  488. "fragColors": [
  489. {
  490. "name": "cc_FragColor",
  491. "typename": "vec4",
  492. "type": 16,
  493. "count": 1,
  494. "defines": [],
  495. "stageFlags": 16,
  496. "location": 0
  497. }
  498. ],
  499. "descriptors": [
  500. {
  501. "rate": 0,
  502. "blocks": [],
  503. "samplerTextures": [],
  504. "samplers": [],
  505. "textures": [],
  506. "buffers": [],
  507. "images": [],
  508. "subpassInputs": []
  509. },
  510. {
  511. "rate": 1,
  512. "blocks": [],
  513. "samplerTextures": [
  514. {
  515. "name": "u_edgeTexSampler",
  516. "type": 28,
  517. "count": 1,
  518. "defines": [],
  519. "stageFlags": 16,
  520. "binding": 0
  521. },
  522. {
  523. "name": "u_areaTexSampler",
  524. "type": 28,
  525. "count": 1,
  526. "defines": [],
  527. "stageFlags": 16,
  528. "binding": 1
  529. },
  530. {
  531. "name": "u_searchTexSampler",
  532. "type": 28,
  533. "count": 1,
  534. "defines": [],
  535. "stageFlags": 16,
  536. "binding": 2
  537. }
  538. ],
  539. "samplers": [],
  540. "textures": [],
  541. "buffers": [],
  542. "images": [],
  543. "subpassInputs": []
  544. },
  545. {
  546. "rate": 2,
  547. "blocks": [],
  548. "samplerTextures": [],
  549. "samplers": [],
  550. "textures": [],
  551. "buffers": [],
  552. "images": [],
  553. "subpassInputs": []
  554. },
  555. {
  556. "rate": 3,
  557. "blocks": [
  558. {
  559. "tags": {
  560. "builtin": "global"
  561. },
  562. "name": "CCGlobal",
  563. "members": [
  564. {
  565. "name": "cc_time",
  566. "typename": "vec4",
  567. "type": 16,
  568. "count": 1,
  569. "precision": "highp "
  570. },
  571. {
  572. "name": "cc_screenSize",
  573. "typename": "vec4",
  574. "type": 16,
  575. "count": 1,
  576. "precision": "mediump "
  577. },
  578. {
  579. "name": "cc_nativeSize",
  580. "typename": "vec4",
  581. "type": 16,
  582. "count": 1,
  583. "precision": "mediump "
  584. },
  585. {
  586. "name": "cc_probeInfo",
  587. "typename": "vec4",
  588. "type": 16,
  589. "count": 1,
  590. "precision": "mediump "
  591. },
  592. {
  593. "name": "cc_debug_view_mode",
  594. "typename": "vec4",
  595. "type": 16,
  596. "count": 1,
  597. "precision": "mediump "
  598. }
  599. ],
  600. "defines": [],
  601. "stageFlags": 17
  602. },
  603. {
  604. "tags": {
  605. "builtin": "global"
  606. },
  607. "name": "CCCamera",
  608. "members": [
  609. {
  610. "name": "cc_matView",
  611. "typename": "mat4",
  612. "type": 25,
  613. "count": 1,
  614. "precision": "highp "
  615. },
  616. {
  617. "name": "cc_matViewInv",
  618. "typename": "mat4",
  619. "type": 25,
  620. "count": 1,
  621. "precision": "highp "
  622. },
  623. {
  624. "name": "cc_matProj",
  625. "typename": "mat4",
  626. "type": 25,
  627. "count": 1,
  628. "precision": "highp "
  629. },
  630. {
  631. "name": "cc_matProjInv",
  632. "typename": "mat4",
  633. "type": 25,
  634. "count": 1,
  635. "precision": "highp "
  636. },
  637. {
  638. "name": "cc_matViewProj",
  639. "typename": "mat4",
  640. "type": 25,
  641. "count": 1,
  642. "precision": "highp "
  643. },
  644. {
  645. "name": "cc_matViewProjInv",
  646. "typename": "mat4",
  647. "type": 25,
  648. "count": 1,
  649. "precision": "highp "
  650. },
  651. {
  652. "name": "cc_cameraPos",
  653. "typename": "vec4",
  654. "type": 16,
  655. "count": 1,
  656. "precision": "highp "
  657. },
  658. {
  659. "name": "cc_surfaceTransform",
  660. "typename": "vec4",
  661. "type": 16,
  662. "count": 1,
  663. "precision": "mediump "
  664. },
  665. {
  666. "name": "cc_screenScale",
  667. "typename": "vec4",
  668. "type": 16,
  669. "count": 1,
  670. "precision": "mediump "
  671. },
  672. {
  673. "name": "cc_exposure",
  674. "typename": "vec4",
  675. "type": 16,
  676. "count": 1,
  677. "precision": "mediump "
  678. },
  679. {
  680. "name": "cc_mainLitDir",
  681. "typename": "vec4",
  682. "type": 16,
  683. "count": 1,
  684. "precision": "mediump "
  685. },
  686. {
  687. "name": "cc_mainLitColor",
  688. "typename": "vec4",
  689. "type": 16,
  690. "count": 1,
  691. "precision": "mediump "
  692. },
  693. {
  694. "name": "cc_ambientSky",
  695. "typename": "vec4",
  696. "type": 16,
  697. "count": 1,
  698. "precision": "mediump "
  699. },
  700. {
  701. "name": "cc_ambientGround",
  702. "typename": "vec4",
  703. "type": 16,
  704. "count": 1,
  705. "precision": "mediump "
  706. },
  707. {
  708. "name": "cc_fogColor",
  709. "typename": "vec4",
  710. "type": 16,
  711. "count": 1,
  712. "precision": "mediump "
  713. },
  714. {
  715. "name": "cc_fogBase",
  716. "typename": "vec4",
  717. "type": 16,
  718. "count": 1,
  719. "precision": "mediump "
  720. },
  721. {
  722. "name": "cc_fogAdd",
  723. "typename": "vec4",
  724. "type": 16,
  725. "count": 1,
  726. "precision": "mediump "
  727. },
  728. {
  729. "name": "cc_nearFar",
  730. "typename": "vec4",
  731. "type": 16,
  732. "count": 1,
  733. "precision": "mediump "
  734. },
  735. {
  736. "name": "cc_viewPort",
  737. "typename": "vec4",
  738. "type": 16,
  739. "count": 1,
  740. "precision": "mediump "
  741. }
  742. ],
  743. "defines": [],
  744. "stageFlags": 17
  745. }
  746. ],
  747. "samplerTextures": [],
  748. "samplers": [],
  749. "textures": [],
  750. "buffers": [],
  751. "images": [],
  752. "subpassInputs": []
  753. }
  754. ],
  755. "hash": 2216517393,
  756. "glsl4": {
  757. "vert": "\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 a_position;\nlayout(location = 1) in vec2 a_texCoord;\nlayout(location = 0) out vec2 v_uv;\nlayout(location = 1) out vec4 v_offsets[3];\nlayout(location = 2) out vec2 v_pixCoord;\nvec4 vert () {\n vec4 pos = vec4(a_position, 0.0, 1.0);\n v_uv = a_texCoord * cc_screenScale.xy;\n v_pixCoord = v_uv * cc_nativeSize.xy;\n v_offsets[0] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-0.25, 0.125, 1.25, 0.125);\n v_offsets[1] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-0.125, 0.25, -0.125, -1.25);\n v_offsets[2] = vec4(v_offsets[0].xz, v_offsets[1].yw) + vec4(-2.0, 2.0, -2.0, 2.0) * cc_nativeSize.zzww * float(8);\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  758. "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(location = 1) in vec4 v_offsets[3];\nlayout(location = 2) in vec2 v_pixCoord;\nlayout(set = 1, binding = 0) uniform sampler2D u_edgeTexSampler;\nlayout(set = 1, binding = 1) uniform sampler2D u_areaTexSampler;\nlayout(set = 1, binding = 2) uniform sampler2D u_searchTexSampler;\nfloat SMAASearchLength(vec2 e, float bias, float scale) {\n e.r = bias + e.r * scale;\n return 255.0 * texture(u_searchTexSampler, e).r;\n}\nfloat SMAASearchXLeft(vec2 texcoord, float end) {\n vec2 e = vec2(0.0, 1.0);\n for (int i = 0; i < 8; ++i) {\n e = texture(u_edgeTexSampler, texcoord).rg;\n texcoord -= vec2( 2.0, 0.0 ) * cc_nativeSize.zw;\n if (!(texcoord.x > end && e.g > 0.8281 && e.r == 0.0))\n break;\n }\n texcoord.x += 0.25 * cc_nativeSize.z;\n texcoord.x += cc_nativeSize.z;\n texcoord.x += 2.0 * cc_nativeSize.z;\n texcoord.x -= cc_nativeSize.z * SMAASearchLength(e, 0.0, 0.5);\n return texcoord.x;\n}\nfloat SMAASearchXRight(vec2 texcoord, float end) {\n vec2 e = vec2(0.0, 1.0);\n for (int i = 0; i < 8; ++i) {\n e = texture(u_edgeTexSampler, texcoord).rg;\n texcoord += vec2( 2.0, 0.0 ) * cc_nativeSize.zw;\n if (!(texcoord.x < end && e.g > 0.8281 && e.r == 0.0))\n break;\n }\n texcoord.x -= 0.25 * cc_nativeSize.z;\n texcoord.x -= cc_nativeSize.z;\n texcoord.x -= 2.0 * cc_nativeSize.z;\n texcoord.x += cc_nativeSize.z * SMAASearchLength(e, 0.5, 0.5);\n return texcoord.x;\n}\nfloat SMAASearchYUp(vec2 texcoord, float end) {\n vec2 e = vec2(1.0, 0.0);\n for (int i = 0; i < 8; ++i) {\n e = texture(u_edgeTexSampler, texcoord).rg;\n texcoord += vec2( 0.0, 2.0 ) * cc_nativeSize.zw;\n if (!(texcoord.y > end && e.r > 0.8281 && e.g == 0.0))\n break;\n }\n texcoord.y -= 0.25 * cc_nativeSize.w;\n texcoord.y -= cc_nativeSize.w;\n texcoord.y -= 2.0 * cc_nativeSize.w;\n texcoord.y += cc_nativeSize.w * SMAASearchLength(e.gr, 0.0, 0.5);\n return texcoord.y;\n}\nfloat SMAASearchYDown(vec2 texcoord, float end) {\n vec2 e = vec2(1.0, 0.0);\n for (int i = 0; i < 8; ++i) {\n e = texture(u_edgeTexSampler, texcoord).rg;\n texcoord -= vec2( 0.0, 2.0 ) * cc_nativeSize.zw;\n if (!(texcoord.y < end && e.r > 0.8281 && e.g == 0.0))\n break;\n }\n texcoord.y += 0.25 * cc_nativeSize.w;\n texcoord.y += cc_nativeSize.w;\n texcoord.y += 2.0 * cc_nativeSize.w;\n texcoord.y -= cc_nativeSize.w * SMAASearchLength(e.gr, 0.5, 0.5);\n return texcoord.y;\n}\nvec2 Round(vec2 x) {\n return sign(x) * floor(abs(x) + 0.5);\n}\nvec2 SMAAArea(vec2 dist, float e1, float e2) {\n vec2 texcoord = float(16) * Round(4.0 * vec2(e1, e2)) + dist;\n texcoord = (1.0 / vec2(160.0, 560.0)) * texcoord + 0.5 * (1.0 / vec2(160.0, 560.0));\n return texture(u_areaTexSampler, texcoord).rg;\n}\nvec4 frag () {\n vec4 weights = vec4(0.0);\n vec2 e = texture(u_edgeTexSampler, v_uv).rg;\n vec2 d;\n vec2 coords;\n if ( e.g > 0.0 ) {\n coords.x = SMAASearchXLeft(v_offsets[0].xy, v_offsets[2].x);\n coords.y = v_offsets[1].y;\n d.x = coords.x;\n float e1 = texture(u_edgeTexSampler, coords).r;\n coords.x = SMAASearchXRight(v_offsets[0].zw, v_offsets[2].y);\n d.y = coords.x;\n d = d / cc_nativeSize.z - v_pixCoord.x;\n vec2 sqrt_d = sqrt(abs(d));\n coords.y -= 1.0 * cc_nativeSize.w;\n float e2 = texture(u_edgeTexSampler, coords + vec2(cc_nativeSize.z, 0.0)).r;\n weights.rg = SMAAArea(sqrt_d, e1, e2);\n }\n if ( e.r > 0.0 ) {\n coords.y = SMAASearchYUp(v_offsets[1].xy, v_offsets[2].z);\n coords.x = v_offsets[0].x;\n d.x = coords.y;\n float e1 = texture(u_edgeTexSampler, coords).g;\n coords.y = SMAASearchYDown(v_offsets[1].zw, v_offsets[2].w);\n d.y = coords.y;\n d = d / cc_nativeSize.w - v_pixCoord.y;\n vec2 sqrt_d = sqrt(abs(d));\n coords.y -= 1.0 * cc_nativeSize.w;\n float e2 = texture(u_edgeTexSampler, coords + vec2(0.0, cc_nativeSize.w)).g;\n weights.ba = SMAAArea(sqrt_d, e1, e2);\n }\n return weights;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  759. },
  760. "glsl3": {
  761. "vert": "\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 a_position;\nin vec2 a_texCoord;\nout vec2 v_uv;\nout vec4 v_offsets[3];\nout vec2 v_pixCoord;\nvec4 vert () {\n vec4 pos = vec4(a_position, 0.0, 1.0);\n v_uv = a_texCoord * cc_screenScale.xy;\n v_pixCoord = v_uv * cc_nativeSize.xy;\n v_offsets[0] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-0.25, 0.125, 1.25, 0.125);\n v_offsets[1] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-0.125, 0.25, -0.125, -1.25);\n v_offsets[2] = vec4(v_offsets[0].xz, v_offsets[1].yw) + vec4(-2.0, 2.0, -2.0, 2.0) * cc_nativeSize.zzww * float(8);\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  762. "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;\nin vec4 v_offsets[3];\nin vec2 v_pixCoord;\nuniform sampler2D u_edgeTexSampler;\nuniform sampler2D u_areaTexSampler;\nuniform sampler2D u_searchTexSampler;\nfloat SMAASearchLength(vec2 e, float bias, float scale) {\n e.r = bias + e.r * scale;\n return 255.0 * texture(u_searchTexSampler, e).r;\n}\nfloat SMAASearchXLeft(vec2 texcoord, float end) {\n vec2 e = vec2(0.0, 1.0);\n for (int i = 0; i < 8; ++i) {\n e = texture(u_edgeTexSampler, texcoord).rg;\n texcoord -= vec2( 2.0, 0.0 ) * cc_nativeSize.zw;\n if (!(texcoord.x > end && e.g > 0.8281 && e.r == 0.0))\n break;\n }\n texcoord.x += 0.25 * cc_nativeSize.z;\n texcoord.x += cc_nativeSize.z;\n texcoord.x += 2.0 * cc_nativeSize.z;\n texcoord.x -= cc_nativeSize.z * SMAASearchLength(e, 0.0, 0.5);\n return texcoord.x;\n}\nfloat SMAASearchXRight(vec2 texcoord, float end) {\n vec2 e = vec2(0.0, 1.0);\n for (int i = 0; i < 8; ++i) {\n e = texture(u_edgeTexSampler, texcoord).rg;\n texcoord += vec2( 2.0, 0.0 ) * cc_nativeSize.zw;\n if (!(texcoord.x < end && e.g > 0.8281 && e.r == 0.0))\n break;\n }\n texcoord.x -= 0.25 * cc_nativeSize.z;\n texcoord.x -= cc_nativeSize.z;\n texcoord.x -= 2.0 * cc_nativeSize.z;\n texcoord.x += cc_nativeSize.z * SMAASearchLength(e, 0.5, 0.5);\n return texcoord.x;\n}\nfloat SMAASearchYUp(vec2 texcoord, float end) {\n vec2 e = vec2(1.0, 0.0);\n for (int i = 0; i < 8; ++i) {\n e = texture(u_edgeTexSampler, texcoord).rg;\n texcoord += vec2( 0.0, 2.0 ) * cc_nativeSize.zw;\n if (!(texcoord.y > end && e.r > 0.8281 && e.g == 0.0))\n break;\n }\n texcoord.y -= 0.25 * cc_nativeSize.w;\n texcoord.y -= cc_nativeSize.w;\n texcoord.y -= 2.0 * cc_nativeSize.w;\n texcoord.y += cc_nativeSize.w * SMAASearchLength(e.gr, 0.0, 0.5);\n return texcoord.y;\n}\nfloat SMAASearchYDown(vec2 texcoord, float end) {\n vec2 e = vec2(1.0, 0.0);\n for (int i = 0; i < 8; ++i) {\n e = texture(u_edgeTexSampler, texcoord).rg;\n texcoord -= vec2( 0.0, 2.0 ) * cc_nativeSize.zw;\n if (!(texcoord.y < end && e.r > 0.8281 && e.g == 0.0))\n break;\n }\n texcoord.y += 0.25 * cc_nativeSize.w;\n texcoord.y += cc_nativeSize.w;\n texcoord.y += 2.0 * cc_nativeSize.w;\n texcoord.y -= cc_nativeSize.w * SMAASearchLength(e.gr, 0.5, 0.5);\n return texcoord.y;\n}\nvec2 Round(vec2 x) {\n return sign(x) * floor(abs(x) + 0.5);\n}\nvec2 SMAAArea(vec2 dist, float e1, float e2) {\n vec2 texcoord = float(16) * Round(4.0 * vec2(e1, e2)) + dist;\n texcoord = (1.0 / vec2(160.0, 560.0)) * texcoord + 0.5 * (1.0 / vec2(160.0, 560.0));\n return texture(u_areaTexSampler, texcoord).rg;\n}\nvec4 frag () {\n vec4 weights = vec4(0.0);\n vec2 e = texture(u_edgeTexSampler, v_uv).rg;\n vec2 d;\n vec2 coords;\n if ( e.g > 0.0 ) {\n coords.x = SMAASearchXLeft(v_offsets[0].xy, v_offsets[2].x);\n coords.y = v_offsets[1].y;\n d.x = coords.x;\n float e1 = texture(u_edgeTexSampler, coords).r;\n coords.x = SMAASearchXRight(v_offsets[0].zw, v_offsets[2].y);\n d.y = coords.x;\n d = d / cc_nativeSize.z - v_pixCoord.x;\n vec2 sqrt_d = sqrt(abs(d));\n coords.y -= 1.0 * cc_nativeSize.w;\n float e2 = texture(u_edgeTexSampler, coords + vec2(cc_nativeSize.z, 0.0)).r;\n weights.rg = SMAAArea(sqrt_d, e1, e2);\n }\n if ( e.r > 0.0 ) {\n coords.y = SMAASearchYUp(v_offsets[1].xy, v_offsets[2].z);\n coords.x = v_offsets[0].x;\n d.x = coords.y;\n float e1 = texture(u_edgeTexSampler, coords).g;\n coords.y = SMAASearchYDown(v_offsets[1].zw, v_offsets[2].w);\n d.y = coords.y;\n d = d / cc_nativeSize.w - v_pixCoord.y;\n vec2 sqrt_d = sqrt(abs(d));\n coords.y -= 1.0 * cc_nativeSize.w;\n float e2 = texture(u_edgeTexSampler, coords + vec2(0.0, cc_nativeSize.w)).g;\n weights.ba = SMAAArea(sqrt_d, e1, e2);\n }\n return weights;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  763. },
  764. "glsl1": {
  765. "vert": "\nprecision highp float;\nuniform mediump vec4 cc_nativeSize;\nuniform mediump vec4 cc_screenScale;\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nvarying vec2 v_uv;\nvarying vec4 v_offsets[3];\nvarying vec2 v_pixCoord;\nvec4 vert () {\n vec4 pos = vec4(a_position, 0.0, 1.0);\n v_uv = a_texCoord * cc_screenScale.xy;\n v_pixCoord = v_uv * cc_nativeSize.xy;\n v_offsets[0] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-0.25, 0.125, 1.25, 0.125);\n v_offsets[1] = v_uv.xyxy + cc_nativeSize.zwzw * vec4(-0.125, 0.25, -0.125, -1.25);\n v_offsets[2] = vec4(v_offsets[0].xz, v_offsets[1].yw) + vec4(-2.0, 2.0, -2.0, 2.0) * cc_nativeSize.zzww * float(8);\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  766. "frag": "\nprecision highp float;\nuniform mediump vec4 cc_nativeSize;\nvarying vec2 v_uv;\nvarying vec4 v_offsets[3];\nvarying vec2 v_pixCoord;\nuniform sampler2D u_edgeTexSampler;\nuniform sampler2D u_areaTexSampler;\nuniform sampler2D u_searchTexSampler;\nfloat SMAASearchLength(vec2 e, float bias, float scale) {\n e.r = bias + e.r * scale;\n return 255.0 * texture2D(u_searchTexSampler, e).r;\n}\nfloat SMAASearchXLeft(vec2 texcoord, float end) {\n vec2 e = vec2(0.0, 1.0);\n for (int i = 0; i < 8; ++i) {\n e = texture2D(u_edgeTexSampler, texcoord).rg;\n texcoord -= vec2( 2.0, 0.0 ) * cc_nativeSize.zw;\n if (!(texcoord.x > end && e.g > 0.8281 && e.r == 0.0))\n break;\n }\n texcoord.x += 0.25 * cc_nativeSize.z;\n texcoord.x += cc_nativeSize.z;\n texcoord.x += 2.0 * cc_nativeSize.z;\n texcoord.x -= cc_nativeSize.z * SMAASearchLength(e, 0.0, 0.5);\n return texcoord.x;\n}\nfloat SMAASearchXRight(vec2 texcoord, float end) {\n vec2 e = vec2(0.0, 1.0);\n for (int i = 0; i < 8; ++i) {\n e = texture2D(u_edgeTexSampler, texcoord).rg;\n texcoord += vec2( 2.0, 0.0 ) * cc_nativeSize.zw;\n if (!(texcoord.x < end && e.g > 0.8281 && e.r == 0.0))\n break;\n }\n texcoord.x -= 0.25 * cc_nativeSize.z;\n texcoord.x -= cc_nativeSize.z;\n texcoord.x -= 2.0 * cc_nativeSize.z;\n texcoord.x += cc_nativeSize.z * SMAASearchLength(e, 0.5, 0.5);\n return texcoord.x;\n}\nfloat SMAASearchYUp(vec2 texcoord, float end) {\n vec2 e = vec2(1.0, 0.0);\n for (int i = 0; i < 8; ++i) {\n e = texture2D(u_edgeTexSampler, texcoord).rg;\n texcoord += vec2( 0.0, 2.0 ) * cc_nativeSize.zw;\n if (!(texcoord.y > end && e.r > 0.8281 && e.g == 0.0))\n break;\n }\n texcoord.y -= 0.25 * cc_nativeSize.w;\n texcoord.y -= cc_nativeSize.w;\n texcoord.y -= 2.0 * cc_nativeSize.w;\n texcoord.y += cc_nativeSize.w * SMAASearchLength(e.gr, 0.0, 0.5);\n return texcoord.y;\n}\nfloat SMAASearchYDown(vec2 texcoord, float end) {\n vec2 e = vec2(1.0, 0.0);\n for (int i = 0; i < 8; ++i) {\n e = texture2D(u_edgeTexSampler, texcoord).rg;\n texcoord -= vec2( 0.0, 2.0 ) * cc_nativeSize.zw;\n if (!(texcoord.y < end && e.r > 0.8281 && e.g == 0.0))\n break;\n }\n texcoord.y += 0.25 * cc_nativeSize.w;\n texcoord.y += cc_nativeSize.w;\n texcoord.y += 2.0 * cc_nativeSize.w;\n texcoord.y -= cc_nativeSize.w * SMAASearchLength(e.gr, 0.5, 0.5);\n return texcoord.y;\n}\nvec2 Round(vec2 x) {\n return sign(x) * floor(abs(x) + 0.5);\n}\nvec2 SMAAArea(vec2 dist, float e1, float e2) {\n vec2 texcoord = float(16) * Round(4.0 * vec2(e1, e2)) + dist;\n texcoord = (1.0 / vec2(160.0, 560.0)) * texcoord + 0.5 * (1.0 / vec2(160.0, 560.0));\n return texture2D(u_areaTexSampler, texcoord).rg;\n}\nvec4 frag () {\n vec4 weights = vec4(0.0);\n vec2 e = texture2D(u_edgeTexSampler, v_uv).rg;\n vec2 d;\n vec2 coords;\n if ( e.g > 0.0 ) {\n coords.x = SMAASearchXLeft(v_offsets[0].xy, v_offsets[2].x);\n coords.y = v_offsets[1].y;\n d.x = coords.x;\n float e1 = texture2D(u_edgeTexSampler, coords).r;\n coords.x = SMAASearchXRight(v_offsets[0].zw, v_offsets[2].y);\n d.y = coords.x;\n d = d / cc_nativeSize.z - v_pixCoord.x;\n vec2 sqrt_d = sqrt(abs(d));\n coords.y -= 1.0 * cc_nativeSize.w;\n float e2 = texture2D(u_edgeTexSampler, coords + vec2(cc_nativeSize.z, 0.0)).r;\n weights.rg = SMAAArea(sqrt_d, e1, e2);\n }\n if ( e.r > 0.0 ) {\n coords.y = SMAASearchYUp(v_offsets[1].xy, v_offsets[2].z);\n coords.x = v_offsets[0].x;\n d.x = coords.y;\n float e1 = texture2D(u_edgeTexSampler, coords).g;\n coords.y = SMAASearchYDown(v_offsets[1].zw, v_offsets[2].w);\n d.y = coords.y;\n d = d / cc_nativeSize.w - v_pixCoord.y;\n vec2 sqrt_d = sqrt(abs(d));\n coords.y -= 1.0 * cc_nativeSize.w;\n float e2 = texture2D(u_edgeTexSampler, coords + vec2(0.0, cc_nativeSize.w)).g;\n weights.ba = SMAAArea(sqrt_d, e1, e2);\n }\n return weights;\n}\nvoid main() { gl_FragColor = frag(); }"
  767. },
  768. "builtins": {
  769. "globals": {
  770. "blocks": [
  771. {
  772. "name": "CCGlobal",
  773. "defines": []
  774. },
  775. {
  776. "name": "CCCamera",
  777. "defines": []
  778. }
  779. ],
  780. "samplerTextures": [],
  781. "buffers": [],
  782. "images": []
  783. },
  784. "locals": {
  785. "blocks": [],
  786. "samplerTextures": [],
  787. "buffers": [],
  788. "images": []
  789. },
  790. "statistics": {
  791. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 42,
  792. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 42
  793. }
  794. },
  795. "defines": [],
  796. "name": "pipeline/smaa|smaa-blend-vs:vert|smaa-blend-fs:frag"
  797. }
  798. ],
  799. "combinations": [],
  800. "hideInEditor": false
  801. }