31b152ff-f689-4082-a292-3eb5a0b33014.json 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "pipeline/tonemap",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "name": "tonemap",
  10. "passes": [
  11. {
  12. "program": "pipeline/tonemap|tonemap-vs:vert|tonemap-fs:frag",
  13. "depthStencilState": {
  14. "depthTest": false,
  15. "depthWrite": false
  16. },
  17. "properties": {
  18. "u_texSampler": {
  19. "type": 28,
  20. "samplerHash": 650
  21. },
  22. "u_blendTexSampler": {
  23. "type": 28,
  24. "samplerHash": 650
  25. }
  26. }
  27. }
  28. ]
  29. }
  30. ],
  31. "shaders": [
  32. {
  33. "blocks": [],
  34. "samplerTextures": [
  35. {
  36. "name": "u_texSampler",
  37. "type": 28,
  38. "count": 1,
  39. "defines": [],
  40. "stageFlags": 16,
  41. "binding": 0
  42. },
  43. {
  44. "name": "u_blendTexSampler",
  45. "type": 28,
  46. "count": 1,
  47. "defines": [],
  48. "stageFlags": 16,
  49. "binding": 1
  50. }
  51. ],
  52. "samplers": [],
  53. "textures": [],
  54. "buffers": [],
  55. "images": [],
  56. "subpassInputs": [],
  57. "attributes": [
  58. {
  59. "name": "a_position",
  60. "defines": [],
  61. "format": 21,
  62. "location": 0
  63. },
  64. {
  65. "name": "a_texCoord",
  66. "defines": [],
  67. "format": 21,
  68. "location": 1
  69. }
  70. ],
  71. "varyings": [
  72. {
  73. "name": "v_uv",
  74. "type": 14,
  75. "count": 1,
  76. "defines": [],
  77. "stageFlags": 17,
  78. "location": 0
  79. },
  80. {
  81. "name": "v_offset",
  82. "type": 16,
  83. "count": 1,
  84. "defines": [],
  85. "stageFlags": 17,
  86. "location": 1
  87. }
  88. ],
  89. "fragColors": [
  90. {
  91. "name": "cc_FragColor",
  92. "typename": "vec4",
  93. "type": 16,
  94. "count": 1,
  95. "defines": [],
  96. "stageFlags": 16,
  97. "location": 0
  98. }
  99. ],
  100. "descriptors": [
  101. {
  102. "rate": 0,
  103. "blocks": [],
  104. "samplerTextures": [],
  105. "samplers": [],
  106. "textures": [],
  107. "buffers": [],
  108. "images": [],
  109. "subpassInputs": []
  110. },
  111. {
  112. "rate": 1,
  113. "blocks": [],
  114. "samplerTextures": [
  115. {
  116. "name": "u_texSampler",
  117. "type": 28,
  118. "count": 1,
  119. "defines": [],
  120. "stageFlags": 16,
  121. "binding": 0
  122. },
  123. {
  124. "name": "u_blendTexSampler",
  125. "type": 28,
  126. "count": 1,
  127. "defines": [],
  128. "stageFlags": 16,
  129. "binding": 1
  130. }
  131. ],
  132. "samplers": [],
  133. "textures": [],
  134. "buffers": [],
  135. "images": [],
  136. "subpassInputs": []
  137. },
  138. {
  139. "rate": 2,
  140. "blocks": [],
  141. "samplerTextures": [],
  142. "samplers": [],
  143. "textures": [],
  144. "buffers": [],
  145. "images": [],
  146. "subpassInputs": []
  147. },
  148. {
  149. "rate": 3,
  150. "blocks": [
  151. {
  152. "tags": {
  153. "builtin": "global"
  154. },
  155. "name": "CCGlobal",
  156. "members": [
  157. {
  158. "name": "cc_time",
  159. "typename": "vec4",
  160. "type": 16,
  161. "count": 1,
  162. "precision": "highp "
  163. },
  164. {
  165. "name": "cc_screenSize",
  166. "typename": "vec4",
  167. "type": 16,
  168. "count": 1,
  169. "precision": "mediump "
  170. },
  171. {
  172. "name": "cc_nativeSize",
  173. "typename": "vec4",
  174. "type": 16,
  175. "count": 1,
  176. "precision": "mediump "
  177. },
  178. {
  179. "name": "cc_probeInfo",
  180. "typename": "vec4",
  181. "type": 16,
  182. "count": 1,
  183. "precision": "mediump "
  184. },
  185. {
  186. "name": "cc_debug_view_mode",
  187. "typename": "vec4",
  188. "type": 16,
  189. "count": 1,
  190. "precision": "mediump "
  191. }
  192. ],
  193. "defines": [],
  194. "stageFlags": 17
  195. },
  196. {
  197. "tags": {
  198. "builtin": "global"
  199. },
  200. "name": "CCCamera",
  201. "members": [
  202. {
  203. "name": "cc_matView",
  204. "typename": "mat4",
  205. "type": 25,
  206. "count": 1,
  207. "precision": "highp "
  208. },
  209. {
  210. "name": "cc_matViewInv",
  211. "typename": "mat4",
  212. "type": 25,
  213. "count": 1,
  214. "precision": "highp "
  215. },
  216. {
  217. "name": "cc_matProj",
  218. "typename": "mat4",
  219. "type": 25,
  220. "count": 1,
  221. "precision": "highp "
  222. },
  223. {
  224. "name": "cc_matProjInv",
  225. "typename": "mat4",
  226. "type": 25,
  227. "count": 1,
  228. "precision": "highp "
  229. },
  230. {
  231. "name": "cc_matViewProj",
  232. "typename": "mat4",
  233. "type": 25,
  234. "count": 1,
  235. "precision": "highp "
  236. },
  237. {
  238. "name": "cc_matViewProjInv",
  239. "typename": "mat4",
  240. "type": 25,
  241. "count": 1,
  242. "precision": "highp "
  243. },
  244. {
  245. "name": "cc_cameraPos",
  246. "typename": "vec4",
  247. "type": 16,
  248. "count": 1,
  249. "precision": "highp "
  250. },
  251. {
  252. "name": "cc_surfaceTransform",
  253. "typename": "vec4",
  254. "type": 16,
  255. "count": 1,
  256. "precision": "mediump "
  257. },
  258. {
  259. "name": "cc_screenScale",
  260. "typename": "vec4",
  261. "type": 16,
  262. "count": 1,
  263. "precision": "mediump "
  264. },
  265. {
  266. "name": "cc_exposure",
  267. "typename": "vec4",
  268. "type": 16,
  269. "count": 1,
  270. "precision": "mediump "
  271. },
  272. {
  273. "name": "cc_mainLitDir",
  274. "typename": "vec4",
  275. "type": 16,
  276. "count": 1,
  277. "precision": "mediump "
  278. },
  279. {
  280. "name": "cc_mainLitColor",
  281. "typename": "vec4",
  282. "type": 16,
  283. "count": 1,
  284. "precision": "mediump "
  285. },
  286. {
  287. "name": "cc_ambientSky",
  288. "typename": "vec4",
  289. "type": 16,
  290. "count": 1,
  291. "precision": "mediump "
  292. },
  293. {
  294. "name": "cc_ambientGround",
  295. "typename": "vec4",
  296. "type": 16,
  297. "count": 1,
  298. "precision": "mediump "
  299. },
  300. {
  301. "name": "cc_fogColor",
  302. "typename": "vec4",
  303. "type": 16,
  304. "count": 1,
  305. "precision": "mediump "
  306. },
  307. {
  308. "name": "cc_fogBase",
  309. "typename": "vec4",
  310. "type": 16,
  311. "count": 1,
  312. "precision": "mediump "
  313. },
  314. {
  315. "name": "cc_fogAdd",
  316. "typename": "vec4",
  317. "type": 16,
  318. "count": 1,
  319. "precision": "mediump "
  320. },
  321. {
  322. "name": "cc_nearFar",
  323. "typename": "vec4",
  324. "type": 16,
  325. "count": 1,
  326. "precision": "mediump "
  327. },
  328. {
  329. "name": "cc_viewPort",
  330. "typename": "vec4",
  331. "type": 16,
  332. "count": 1,
  333. "precision": "mediump "
  334. }
  335. ],
  336. "defines": [],
  337. "stageFlags": 17
  338. }
  339. ],
  340. "samplerTextures": [],
  341. "samplers": [],
  342. "textures": [],
  343. "buffers": [],
  344. "images": [],
  345. "subpassInputs": []
  346. }
  347. ],
  348. "hash": 293145928,
  349. "glsl4": {
  350. "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\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_offset;\nvec4 vert () {\n vec4 pos = vec4(a_position, 0, 1);\n v_uv = a_texCoord * cc_screenScale.xy;\n v_offset = v_uv.xyxy + cc_nativeSize.zwzw * vec4(1.0, 0.0, 0.0, -1.0);\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  351. "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_offset;\nlayout(set = 1, binding = 0) uniform sampler2D u_texSampler;\nlayout(set = 1, binding = 1) uniform sampler2D u_blendTexSampler;\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 #if CC_USE_SMAA\n vec4 a;\n a.rb = texture(u_blendTexSampler, v_uv).rb;\n a.g = texture(u_blendTexSampler, v_offset.zw).g;\n a.a = texture(u_blendTexSampler, v_offset.xy).a;\n if (dot(a, vec4(1.0)) < 1e-5) {\n vec4 o = texture(u_texSampler, v_uv);\n o.rgb = ToLDR(o.rgb);\n return o;\n } else {\n vec2 offset;\n offset.x = a.a > a.b ? a.a : -a.b;\n offset.y = a.g > a.r ? -a.g : a.r;\n if (abs(offset.x) > abs(offset.y)) {\n offset.y = 0.0;\n } else {\n offset.x = 0.0;\n }\n vec4 C = texture(u_texSampler, v_uv);\n C.rgb = ToLDR(C.rgb);\n vec2 uv = v_uv + sign(offset) * cc_nativeSize.zw;\n vec4 Cop = texture(u_texSampler, uv);\n Cop.rgb = ToLDR(Cop.rgb);\n float s = abs(offset.x) > abs(offset.y) ? abs(offset.x) : abs(offset.y);\n C.rgb = pow(C.rgb, vec3(2.2));\n Cop.rgb = pow(Cop.rgb, vec3(2.2));\n vec4 mixed = mix(C, Cop, s);\n mixed.rgb = pow(mixed.rgb, vec3(1.0 / 2.2));\n return mixed;\n }\n #else\n vec4 o = texture(u_texSampler, v_uv);\n o.rgb = ToLDR(o.rgb);\n return o;\n #endif\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  352. },
  353. "glsl3": {
  354. "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\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_offset;\nvec4 vert () {\n vec4 pos = vec4(a_position, 0, 1);\n v_uv = a_texCoord * cc_screenScale.xy;\n v_offset = v_uv.xyxy + cc_nativeSize.zwzw * vec4(1.0, 0.0, 0.0, -1.0);\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  355. "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_offset;\nuniform sampler2D u_texSampler;\nuniform sampler2D u_blendTexSampler;\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 #if CC_USE_SMAA\n vec4 a;\n a.rb = texture(u_blendTexSampler, v_uv).rb;\n a.g = texture(u_blendTexSampler, v_offset.zw).g;\n a.a = texture(u_blendTexSampler, v_offset.xy).a;\n if (dot(a, vec4(1.0)) < 1e-5) {\n vec4 o = texture(u_texSampler, v_uv);\n o.rgb = ToLDR(o.rgb);\n return o;\n } else {\n vec2 offset;\n offset.x = a.a > a.b ? a.a : -a.b;\n offset.y = a.g > a.r ? -a.g : a.r;\n if (abs(offset.x) > abs(offset.y)) {\n offset.y = 0.0;\n } else {\n offset.x = 0.0;\n }\n vec4 C = texture(u_texSampler, v_uv);\n C.rgb = ToLDR(C.rgb);\n vec2 uv = v_uv + sign(offset) * cc_nativeSize.zw;\n vec4 Cop = texture(u_texSampler, uv);\n Cop.rgb = ToLDR(Cop.rgb);\n float s = abs(offset.x) > abs(offset.y) ? abs(offset.x) : abs(offset.y);\n C.rgb = pow(C.rgb, vec3(2.2));\n Cop.rgb = pow(Cop.rgb, vec3(2.2));\n vec4 mixed = mix(C, Cop, s);\n mixed.rgb = pow(mixed.rgb, vec3(1.0 / 2.2));\n return mixed;\n }\n #else\n vec4 o = texture(u_texSampler, v_uv);\n o.rgb = ToLDR(o.rgb);\n return o;\n #endif\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  356. },
  357. "glsl1": {
  358. "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\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_offset;\nvec4 vert () {\n vec4 pos = vec4(a_position, 0, 1);\n v_uv = a_texCoord * cc_screenScale.xy;\n v_offset = v_uv.xyxy + cc_nativeSize.zwzw * vec4(1.0, 0.0, 0.0, -1.0);\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  359. "frag": "\nprecision highp float;\nuniform mediump vec4 cc_nativeSize;\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_offset;\nuniform sampler2D u_texSampler;\nuniform sampler2D u_blendTexSampler;\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 #if CC_USE_SMAA\n vec4 a;\n a.rb = texture2D(u_blendTexSampler, v_uv).rb;\n a.g = texture2D(u_blendTexSampler, v_offset.zw).g;\n a.a = texture2D(u_blendTexSampler, v_offset.xy).a;\n if (dot(a, vec4(1.0)) < 1e-5) {\n vec4 o = texture2D(u_texSampler, v_uv);\n o.rgb = ToLDR(o.rgb);\n return o;\n } else {\n vec2 offset;\n offset.x = a.a > a.b ? a.a : -a.b;\n offset.y = a.g > a.r ? -a.g : a.r;\n if (abs(offset.x) > abs(offset.y)) {\n offset.y = 0.0;\n } else {\n offset.x = 0.0;\n }\n vec4 C = texture2D(u_texSampler, v_uv);\n C.rgb = ToLDR(C.rgb);\n vec2 uv = v_uv + sign(offset) * cc_nativeSize.zw;\n vec4 Cop = texture2D(u_texSampler, uv);\n Cop.rgb = ToLDR(Cop.rgb);\n float s = abs(offset.x) > abs(offset.y) ? abs(offset.x) : abs(offset.y);\n C.rgb = pow(C.rgb, vec3(2.2));\n Cop.rgb = pow(Cop.rgb, vec3(2.2));\n vec4 mixed = mix(C, Cop, s);\n mixed.rgb = pow(mixed.rgb, vec3(1.0 / 2.2));\n return mixed;\n }\n #else\n vec4 o = texture2D(u_texSampler, v_uv);\n o.rgb = ToLDR(o.rgb);\n return o;\n #endif\n}\nvoid main() { gl_FragColor = frag(); }"
  360. },
  361. "builtins": {
  362. "globals": {
  363. "blocks": [
  364. {
  365. "name": "CCGlobal",
  366. "defines": []
  367. },
  368. {
  369. "name": "CCCamera",
  370. "defines": []
  371. }
  372. ],
  373. "samplerTextures": [],
  374. "buffers": [],
  375. "images": []
  376. },
  377. "locals": {
  378. "blocks": [],
  379. "samplerTextures": [],
  380. "buffers": [],
  381. "images": []
  382. },
  383. "statistics": {
  384. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 42,
  385. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 42
  386. }
  387. },
  388. "defines": [
  389. {
  390. "name": "CC_USE_DEBUG_VIEW",
  391. "type": "number",
  392. "defines": [],
  393. "range": [
  394. 0,
  395. 3
  396. ]
  397. },
  398. {
  399. "name": "CC_SURFACES_ENABLE_DEBUG_VIEW",
  400. "type": "boolean",
  401. "defines": [
  402. "CC_USE_DEBUG_VIEW",
  403. "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC"
  404. ]
  405. },
  406. {
  407. "name": "CC_USE_HDR",
  408. "type": "boolean",
  409. "defines": []
  410. },
  411. {
  412. "name": "CC_USE_SMAA",
  413. "type": "boolean",
  414. "defines": []
  415. }
  416. ],
  417. "name": "pipeline/tonemap|tonemap-vs:vert|tonemap-fs:frag"
  418. }
  419. ],
  420. "combinations": [],
  421. "hideInEditor": false
  422. }