9d1cff46-e352-4b6d-b4ba-c3a0010c0c5d.json 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "pipeline/post-process/color-grading1",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "passes": [
  10. {
  11. "pass": "cc-color-grading-nx1",
  12. "rasterizerState": {
  13. "cullMode": 0
  14. },
  15. "program": "pipeline/post-process/color-grading1|color-grading-vs|color-grading-nx1-fs",
  16. "depthStencilState": {
  17. "depthTest": false,
  18. "depthWrite": false
  19. }
  20. },
  21. {
  22. "pass": "cc-color-grading-8x8",
  23. "rasterizerState": {
  24. "cullMode": 0
  25. },
  26. "program": "pipeline/post-process/color-grading1|color-grading-vs|color-grading-8x8-fs",
  27. "depthStencilState": {
  28. "depthTest": false,
  29. "depthWrite": false
  30. }
  31. }
  32. ]
  33. }
  34. ],
  35. "shaders": [
  36. {
  37. "blocks": [],
  38. "samplerTextures": [
  39. {
  40. "name": "colorGradingMap",
  41. "type": 28,
  42. "count": 1,
  43. "defines": [],
  44. "stageFlags": 16,
  45. "binding": 3
  46. }
  47. ],
  48. "samplers": [],
  49. "textures": [],
  50. "buffers": [],
  51. "images": [],
  52. "subpassInputs": [],
  53. "attributes": [
  54. {
  55. "name": "a_position",
  56. "defines": [],
  57. "format": 32,
  58. "location": 0
  59. },
  60. {
  61. "name": "a_normal",
  62. "defines": [],
  63. "format": 32,
  64. "location": 1
  65. },
  66. {
  67. "name": "a_texCoord",
  68. "defines": [],
  69. "format": 21,
  70. "location": 2
  71. },
  72. {
  73. "name": "a_tangent",
  74. "defines": [],
  75. "format": 44,
  76. "location": 3
  77. },
  78. {
  79. "name": "a_joints",
  80. "defines": [
  81. "CC_USE_SKINNING"
  82. ],
  83. "location": 4
  84. },
  85. {
  86. "name": "a_weights",
  87. "defines": [
  88. "CC_USE_SKINNING"
  89. ],
  90. "format": 44,
  91. "location": 5
  92. },
  93. {
  94. "name": "a_jointAnimInfo",
  95. "defines": [
  96. "USE_INSTANCING",
  97. "CC_USE_BAKED_ANIMATION"
  98. ],
  99. "format": 44,
  100. "isInstanced": true,
  101. "location": 6
  102. },
  103. {
  104. "name": "a_matWorld0",
  105. "defines": [
  106. "USE_INSTANCING"
  107. ],
  108. "format": 44,
  109. "isInstanced": true,
  110. "location": 7
  111. },
  112. {
  113. "name": "a_matWorld1",
  114. "defines": [
  115. "USE_INSTANCING"
  116. ],
  117. "format": 44,
  118. "isInstanced": true,
  119. "location": 8
  120. },
  121. {
  122. "name": "a_matWorld2",
  123. "defines": [
  124. "USE_INSTANCING"
  125. ],
  126. "format": 44,
  127. "isInstanced": true,
  128. "location": 9
  129. },
  130. {
  131. "name": "a_lightingMapUVParam",
  132. "defines": [
  133. "USE_INSTANCING",
  134. "CC_USE_LIGHTMAP"
  135. ],
  136. "format": 44,
  137. "isInstanced": true,
  138. "location": 10
  139. },
  140. {
  141. "name": "a_localShadowBiasAndProbeId",
  142. "defines": [
  143. "USE_INSTANCING"
  144. ],
  145. "format": 44,
  146. "isInstanced": true,
  147. "location": 11
  148. },
  149. {
  150. "name": "a_reflectionProbeData",
  151. "defines": [
  152. "USE_INSTANCING",
  153. "CC_USE_REFLECTION_PROBE"
  154. ],
  155. "format": 44,
  156. "isInstanced": true,
  157. "location": 12
  158. },
  159. {
  160. "name": "a_sh_linear_const_r",
  161. "defines": [
  162. "USE_INSTANCING",
  163. "CC_USE_LIGHT_PROBE"
  164. ],
  165. "format": 44,
  166. "isInstanced": true,
  167. "location": 13
  168. },
  169. {
  170. "name": "a_sh_linear_const_g",
  171. "defines": [
  172. "USE_INSTANCING",
  173. "CC_USE_LIGHT_PROBE"
  174. ],
  175. "format": 44,
  176. "isInstanced": true,
  177. "location": 14
  178. },
  179. {
  180. "name": "a_sh_linear_const_b",
  181. "defines": [
  182. "USE_INSTANCING",
  183. "CC_USE_LIGHT_PROBE"
  184. ],
  185. "format": 44,
  186. "isInstanced": true,
  187. "location": 15
  188. },
  189. {
  190. "name": "a_vertexId",
  191. "defines": [
  192. "CC_USE_MORPH"
  193. ],
  194. "format": 11,
  195. "location": 16
  196. }
  197. ],
  198. "varyings": [
  199. {
  200. "name": "v_uv",
  201. "type": 14,
  202. "count": 1,
  203. "defines": [],
  204. "stageFlags": 17,
  205. "location": 0
  206. }
  207. ],
  208. "fragColors": [
  209. {
  210. "name": "fragColor",
  211. "typename": "vec4",
  212. "type": 16,
  213. "count": 1,
  214. "defines": [],
  215. "stageFlags": 16,
  216. "location": 0
  217. }
  218. ],
  219. "descriptors": [
  220. {
  221. "rate": 0,
  222. "blocks": [],
  223. "samplerTextures": [],
  224. "samplers": [],
  225. "textures": [],
  226. "buffers": [],
  227. "images": [],
  228. "subpassInputs": []
  229. },
  230. {
  231. "rate": 1,
  232. "blocks": [],
  233. "samplerTextures": [
  234. {
  235. "name": "colorGradingMap",
  236. "type": 28,
  237. "count": 1,
  238. "defines": [],
  239. "stageFlags": 16,
  240. "binding": 3
  241. }
  242. ],
  243. "samplers": [],
  244. "textures": [],
  245. "buffers": [],
  246. "images": [],
  247. "subpassInputs": []
  248. },
  249. {
  250. "rate": 2,
  251. "blocks": [],
  252. "samplerTextures": [],
  253. "samplers": [],
  254. "textures": [],
  255. "buffers": [],
  256. "images": [],
  257. "subpassInputs": []
  258. },
  259. {
  260. "rate": 3,
  261. "blocks": [
  262. {
  263. "name": "Pipeline",
  264. "members": [
  265. {
  266. "name": "g_platform",
  267. "type": 16,
  268. "count": 1
  269. }
  270. ],
  271. "defines": [],
  272. "stageFlags": 1,
  273. "binding": 0
  274. },
  275. {
  276. "name": "ColorGradingUBO",
  277. "members": [
  278. {
  279. "name": "lutTextureSize",
  280. "type": 14,
  281. "count": 1
  282. },
  283. {
  284. "name": "contribute",
  285. "type": 13,
  286. "count": 1
  287. }
  288. ],
  289. "defines": [],
  290. "stageFlags": 16,
  291. "binding": 1
  292. }
  293. ],
  294. "samplerTextures": [
  295. {
  296. "name": "sceneColorMap",
  297. "type": 28,
  298. "count": 1,
  299. "defines": [],
  300. "stageFlags": 16,
  301. "binding": 2
  302. }
  303. ],
  304. "samplers": [],
  305. "textures": [],
  306. "buffers": [],
  307. "images": [],
  308. "subpassInputs": []
  309. }
  310. ],
  311. "hash": 4082068070,
  312. "glsl4": {
  313. "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}",
  314. "frag": "\nprecision highp float;\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}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\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_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nlayout(set = 1, binding = 1) uniform ColorGradingUBO {\n vec2 lutTextureSize;\n float contribute;\n};\nlayout(set = 1, binding = 2) uniform sampler2D sceneColorMap;\nlayout(set = 1, binding = 3) uniform sampler2D colorGradingMap;\nlayout(location = 0) in vec2 v_uv;\nvec3 ColorGrading(sampler2D lutTexture, vec3 color) {\n float colors = lutTextureSize.x / lutTextureSize.y;\n vec3 colorGradingScale = vec3((colors - 1.0) / (colors * colors), (colors - 1.0) / colors, 1.0 / colors);\n vec2 colorGradingOffset = vec2(1.0 / (2.0 * colors * colors), 1.0 / (2.0 * colors));\n vec2 uv = vec2(color.r, 1.0 - color.g) * colorGradingScale.xy + colorGradingOffset;\n float b = color.b * (colors - 1.0);\n vec2 lr = floor(vec2(b, b + 1.0));\n float lerp = b - lr.x;\n lr *= colorGradingScale.z;\n vec3 left = texture(lutTexture, uv + vec2(lr.x, 0.0)).rgb;\n vec3 right = texture(lutTexture, uv + vec2(lr.y, 0.0)).rgb;\n return mix(left, right, lerp);\n}\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n vec4 sceneColor = texture(sceneColorMap, v_uv);\n #if CC_USE_FLOAT_OUTPUT\n sceneColor.rgb = HDRToLDR(sceneColor.rgb);\n sceneColor.rgb = LinearToSRGB(sceneColor.rgb);\n #endif\n vec3 gradeColor = ColorGrading(colorGradingMap, sceneColor.rgb);\n fragColor = mix(sceneColor, vec4(gradeColor, sceneColor.a), contribute);\n}"
  315. },
  316. "glsl3": {
  317. "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}",
  318. "frag": "\nprecision highp float;\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}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\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_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nlayout(std140) uniform ColorGradingUBO {\n vec2 lutTextureSize;\n float contribute;\n};\nuniform sampler2D sceneColorMap;\nuniform sampler2D colorGradingMap;\nin vec2 v_uv;\nvec3 ColorGrading(sampler2D lutTexture, vec3 color) {\n float colors = lutTextureSize.x / lutTextureSize.y;\n vec3 colorGradingScale = vec3((colors - 1.0) / (colors * colors), (colors - 1.0) / colors, 1.0 / colors);\n vec2 colorGradingOffset = vec2(1.0 / (2.0 * colors * colors), 1.0 / (2.0 * colors));\n vec2 uv = vec2(color.r, 1.0 - color.g) * colorGradingScale.xy + colorGradingOffset;\n float b = color.b * (colors - 1.0);\n vec2 lr = floor(vec2(b, b + 1.0));\n float lerp = b - lr.x;\n lr *= colorGradingScale.z;\n vec3 left = texture(lutTexture, uv + vec2(lr.x, 0.0)).rgb;\n vec3 right = texture(lutTexture, uv + vec2(lr.y, 0.0)).rgb;\n return mix(left, right, lerp);\n}\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n vec4 sceneColor = texture(sceneColorMap, v_uv);\n #if CC_USE_FLOAT_OUTPUT\n sceneColor.rgb = HDRToLDR(sceneColor.rgb);\n sceneColor.rgb = LinearToSRGB(sceneColor.rgb);\n #endif\n vec3 gradeColor = ColorGrading(colorGradingMap, sceneColor.rgb);\n fragColor = mix(sceneColor, vec4(gradeColor, sceneColor.a), contribute);\n}"
  319. },
  320. "glsl1": {
  321. "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}",
  322. "frag": "\nprecision highp float;\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}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\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_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\n uniform vec2 lutTextureSize;\n uniform float contribute;\nuniform sampler2D sceneColorMap;\nuniform sampler2D colorGradingMap;\nvarying vec2 v_uv;\nvec3 ColorGrading(sampler2D lutTexture, vec3 color) {\n float colors = lutTextureSize.x / lutTextureSize.y;\n vec3 colorGradingScale = vec3((colors - 1.0) / (colors * colors), (colors - 1.0) / colors, 1.0 / colors);\n vec2 colorGradingOffset = vec2(1.0 / (2.0 * colors * colors), 1.0 / (2.0 * colors));\n vec2 uv = vec2(color.r, 1.0 - color.g) * colorGradingScale.xy + colorGradingOffset;\n float b = color.b * (colors - 1.0);\n vec2 lr = floor(vec2(b, b + 1.0));\n float lerp = b - lr.x;\n lr *= colorGradingScale.z;\n vec3 left = texture2D(lutTexture, uv + vec2(lr.x, 0.0)).rgb;\n vec3 right = texture2D(lutTexture, uv + vec2(lr.y, 0.0)).rgb;\n return mix(left, right, lerp);\n}\nvoid main () {\n vec4 sceneColor = texture2D(sceneColorMap, v_uv);\n #if CC_USE_FLOAT_OUTPUT\n sceneColor.rgb = HDRToLDR(sceneColor.rgb);\n sceneColor.rgb = LinearToSRGB(sceneColor.rgb);\n #endif\n vec3 gradeColor = ColorGrading(colorGradingMap, sceneColor.rgb);\n gl_FragColor = mix(sceneColor, vec4(gradeColor, sceneColor.a), contribute);\n}"
  323. },
  324. "builtins": {
  325. "globals": {
  326. "blocks": [],
  327. "samplerTextures": [],
  328. "buffers": [],
  329. "images": []
  330. },
  331. "locals": {
  332. "blocks": [],
  333. "samplerTextures": [],
  334. "buffers": [],
  335. "images": []
  336. },
  337. "statistics": {
  338. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 1,
  339. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 2
  340. }
  341. },
  342. "defines": [
  343. {
  344. "name": "USE_INSTANCING",
  345. "type": "boolean",
  346. "defines": [],
  347. "editor": {
  348. "elevated": true
  349. }
  350. },
  351. {
  352. "name": "CC_USE_SKINNING",
  353. "type": "boolean",
  354. "defines": []
  355. },
  356. {
  357. "name": "CC_USE_BAKED_ANIMATION",
  358. "type": "boolean",
  359. "defines": [
  360. "USE_INSTANCING"
  361. ]
  362. },
  363. {
  364. "name": "CC_USE_LIGHTMAP",
  365. "type": "boolean",
  366. "defines": [
  367. "USE_INSTANCING"
  368. ]
  369. },
  370. {
  371. "name": "CC_USE_REFLECTION_PROBE",
  372. "type": "boolean",
  373. "defines": [
  374. "USE_INSTANCING"
  375. ]
  376. },
  377. {
  378. "name": "CC_RECEIVE_SHADOW",
  379. "type": "boolean",
  380. "defines": [
  381. "USE_INSTANCING"
  382. ]
  383. },
  384. {
  385. "name": "CC_USE_LIGHT_PROBE",
  386. "type": "boolean",
  387. "defines": [
  388. "USE_INSTANCING"
  389. ]
  390. },
  391. {
  392. "name": "CC_USE_MORPH",
  393. "type": "boolean",
  394. "defines": []
  395. },
  396. {
  397. "name": "CC_USE_DEBUG_VIEW",
  398. "type": "number",
  399. "defines": [],
  400. "range": [
  401. 0,
  402. 3
  403. ]
  404. },
  405. {
  406. "name": "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC",
  407. "type": "boolean",
  408. "defines": [
  409. "CC_USE_DEBUG_VIEW"
  410. ]
  411. },
  412. {
  413. "name": "CC_SURFACES_ENABLE_DEBUG_VIEW",
  414. "type": "boolean",
  415. "defines": [
  416. "CC_USE_DEBUG_VIEW",
  417. "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC"
  418. ]
  419. },
  420. {
  421. "name": "CC_USE_HDR",
  422. "type": "boolean",
  423. "defines": []
  424. },
  425. {
  426. "name": "CC_TONE_MAPPING_TYPE",
  427. "type": "number",
  428. "defines": [
  429. "CC_USE_HDR"
  430. ],
  431. "range": [
  432. 0,
  433. 3
  434. ]
  435. },
  436. {
  437. "name": "HDR_TONE_MAPPING_ACES",
  438. "type": "boolean",
  439. "defines": [
  440. "CC_TONE_MAPPING_TYPE",
  441. "CC_USE_HDR"
  442. ]
  443. },
  444. {
  445. "name": "CC_USE_FLOAT_OUTPUT",
  446. "type": "boolean",
  447. "defines": []
  448. }
  449. ],
  450. "name": "pipeline/post-process/color-grading1|color-grading-vs|color-grading-nx1-fs"
  451. },
  452. {
  453. "blocks": [],
  454. "samplerTextures": [
  455. {
  456. "name": "colorGradingMap",
  457. "type": 28,
  458. "count": 1,
  459. "defines": [],
  460. "stageFlags": 16,
  461. "binding": 3
  462. }
  463. ],
  464. "samplers": [],
  465. "textures": [],
  466. "buffers": [],
  467. "images": [],
  468. "subpassInputs": [],
  469. "attributes": [
  470. {
  471. "name": "a_position",
  472. "defines": [],
  473. "format": 32,
  474. "location": 0
  475. },
  476. {
  477. "name": "a_normal",
  478. "defines": [],
  479. "format": 32,
  480. "location": 1
  481. },
  482. {
  483. "name": "a_texCoord",
  484. "defines": [],
  485. "format": 21,
  486. "location": 2
  487. },
  488. {
  489. "name": "a_tangent",
  490. "defines": [],
  491. "format": 44,
  492. "location": 3
  493. },
  494. {
  495. "name": "a_joints",
  496. "defines": [
  497. "CC_USE_SKINNING"
  498. ],
  499. "location": 4
  500. },
  501. {
  502. "name": "a_weights",
  503. "defines": [
  504. "CC_USE_SKINNING"
  505. ],
  506. "format": 44,
  507. "location": 5
  508. },
  509. {
  510. "name": "a_jointAnimInfo",
  511. "defines": [
  512. "USE_INSTANCING",
  513. "CC_USE_BAKED_ANIMATION"
  514. ],
  515. "format": 44,
  516. "isInstanced": true,
  517. "location": 6
  518. },
  519. {
  520. "name": "a_matWorld0",
  521. "defines": [
  522. "USE_INSTANCING"
  523. ],
  524. "format": 44,
  525. "isInstanced": true,
  526. "location": 7
  527. },
  528. {
  529. "name": "a_matWorld1",
  530. "defines": [
  531. "USE_INSTANCING"
  532. ],
  533. "format": 44,
  534. "isInstanced": true,
  535. "location": 8
  536. },
  537. {
  538. "name": "a_matWorld2",
  539. "defines": [
  540. "USE_INSTANCING"
  541. ],
  542. "format": 44,
  543. "isInstanced": true,
  544. "location": 9
  545. },
  546. {
  547. "name": "a_lightingMapUVParam",
  548. "defines": [
  549. "USE_INSTANCING",
  550. "CC_USE_LIGHTMAP"
  551. ],
  552. "format": 44,
  553. "isInstanced": true,
  554. "location": 10
  555. },
  556. {
  557. "name": "a_localShadowBiasAndProbeId",
  558. "defines": [
  559. "USE_INSTANCING"
  560. ],
  561. "format": 44,
  562. "isInstanced": true,
  563. "location": 11
  564. },
  565. {
  566. "name": "a_reflectionProbeData",
  567. "defines": [
  568. "USE_INSTANCING",
  569. "CC_USE_REFLECTION_PROBE"
  570. ],
  571. "format": 44,
  572. "isInstanced": true,
  573. "location": 12
  574. },
  575. {
  576. "name": "a_sh_linear_const_r",
  577. "defines": [
  578. "USE_INSTANCING",
  579. "CC_USE_LIGHT_PROBE"
  580. ],
  581. "format": 44,
  582. "isInstanced": true,
  583. "location": 13
  584. },
  585. {
  586. "name": "a_sh_linear_const_g",
  587. "defines": [
  588. "USE_INSTANCING",
  589. "CC_USE_LIGHT_PROBE"
  590. ],
  591. "format": 44,
  592. "isInstanced": true,
  593. "location": 14
  594. },
  595. {
  596. "name": "a_sh_linear_const_b",
  597. "defines": [
  598. "USE_INSTANCING",
  599. "CC_USE_LIGHT_PROBE"
  600. ],
  601. "format": 44,
  602. "isInstanced": true,
  603. "location": 15
  604. },
  605. {
  606. "name": "a_vertexId",
  607. "defines": [
  608. "CC_USE_MORPH"
  609. ],
  610. "format": 11,
  611. "location": 16
  612. }
  613. ],
  614. "varyings": [
  615. {
  616. "name": "v_uv",
  617. "type": 14,
  618. "count": 1,
  619. "defines": [],
  620. "stageFlags": 17,
  621. "location": 0
  622. }
  623. ],
  624. "fragColors": [
  625. {
  626. "name": "fragColor",
  627. "typename": "vec4",
  628. "type": 16,
  629. "count": 1,
  630. "defines": [],
  631. "stageFlags": 16,
  632. "location": 0
  633. }
  634. ],
  635. "descriptors": [
  636. {
  637. "rate": 0,
  638. "blocks": [],
  639. "samplerTextures": [],
  640. "samplers": [],
  641. "textures": [],
  642. "buffers": [],
  643. "images": [],
  644. "subpassInputs": []
  645. },
  646. {
  647. "rate": 1,
  648. "blocks": [],
  649. "samplerTextures": [
  650. {
  651. "name": "colorGradingMap",
  652. "type": 28,
  653. "count": 1,
  654. "defines": [],
  655. "stageFlags": 16,
  656. "binding": 3
  657. }
  658. ],
  659. "samplers": [],
  660. "textures": [],
  661. "buffers": [],
  662. "images": [],
  663. "subpassInputs": []
  664. },
  665. {
  666. "rate": 2,
  667. "blocks": [],
  668. "samplerTextures": [],
  669. "samplers": [],
  670. "textures": [],
  671. "buffers": [],
  672. "images": [],
  673. "subpassInputs": []
  674. },
  675. {
  676. "rate": 3,
  677. "blocks": [
  678. {
  679. "name": "Pipeline",
  680. "members": [
  681. {
  682. "name": "g_platform",
  683. "type": 16,
  684. "count": 1
  685. }
  686. ],
  687. "defines": [],
  688. "stageFlags": 1,
  689. "binding": 0
  690. },
  691. {
  692. "name": "ColorGradingUBO",
  693. "members": [
  694. {
  695. "name": "lutTextureSize",
  696. "type": 14,
  697. "count": 1
  698. },
  699. {
  700. "name": "contribute",
  701. "type": 13,
  702. "count": 1
  703. }
  704. ],
  705. "defines": [],
  706. "stageFlags": 16,
  707. "binding": 1
  708. }
  709. ],
  710. "samplerTextures": [
  711. {
  712. "name": "sceneColorMap",
  713. "type": 28,
  714. "count": 1,
  715. "defines": [],
  716. "stageFlags": 16,
  717. "binding": 2
  718. }
  719. ],
  720. "samplers": [],
  721. "textures": [],
  722. "buffers": [],
  723. "images": [],
  724. "subpassInputs": []
  725. }
  726. ],
  727. "hash": 3532589371,
  728. "glsl4": {
  729. "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}",
  730. "frag": "\nprecision highp float;\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}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\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_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nlayout(set = 1, binding = 1) uniform ColorGradingUBO {\n vec2 lutTextureSize;\n float contribute;\n};\nlayout(set = 1, binding = 2) uniform sampler2D sceneColorMap;\nlayout(set = 1, binding = 3) uniform sampler2D colorGradingMap;\nlayout(location = 0) in vec2 v_uv;\n#define EPS 0.000001\n#define TOTAL 64.0\n#define SIZE 512.0\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n vec4 origColor = texture(sceneColorMap, v_uv);\n #if CC_USE_FLOAT_OUTPUT\n origColor.rgb = HDRToLDR(origColor.rgb);\n origColor.rgb = LinearToSRGB(origColor.rgb);\n #endif\n float bValue = (origColor.b * 255.0) / 4.0;\n vec2 mulB = clamp(floor(bValue) + vec2(0.0, 1.0), 0.0, 63.0);\n vec2 row = floor(mulB / 8.0 + EPS);\n vec4 row_col = vec4(row, mulB - row * 8.0);\n vec4 lookup = origColor.ggrr * (63.0 / SIZE) + row_col * (TOTAL / SIZE) + (0.5 / SIZE);\n float b1w = bValue - mulB.x;\n vec3 sampled1 = texture(colorGradingMap, lookup.zx).rgb;\n vec3 sampled2 = texture(colorGradingMap, lookup.wy).rgb;\n fragColor = vec4(mix(origColor.rgb, mix(sampled1, sampled2, b1w), contribute), origColor.a);\n}"
  731. },
  732. "glsl3": {
  733. "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}",
  734. "frag": "\nprecision highp float;\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}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\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_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nlayout(std140) uniform ColorGradingUBO {\n vec2 lutTextureSize;\n float contribute;\n};\nuniform sampler2D sceneColorMap;\nuniform sampler2D colorGradingMap;\nin vec2 v_uv;\n#define EPS 0.000001\n#define TOTAL 64.0\n#define SIZE 512.0\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n vec4 origColor = texture(sceneColorMap, v_uv);\n #if CC_USE_FLOAT_OUTPUT\n origColor.rgb = HDRToLDR(origColor.rgb);\n origColor.rgb = LinearToSRGB(origColor.rgb);\n #endif\n float bValue = (origColor.b * 255.0) / 4.0;\n vec2 mulB = clamp(floor(bValue) + vec2(0.0, 1.0), 0.0, 63.0);\n vec2 row = floor(mulB / 8.0 + EPS);\n vec4 row_col = vec4(row, mulB - row * 8.0);\n vec4 lookup = origColor.ggrr * (63.0 / SIZE) + row_col * (TOTAL / SIZE) + (0.5 / SIZE);\n float b1w = bValue - mulB.x;\n vec3 sampled1 = texture(colorGradingMap, lookup.zx).rgb;\n vec3 sampled2 = texture(colorGradingMap, lookup.wy).rgb;\n fragColor = vec4(mix(origColor.rgb, mix(sampled1, sampled2, b1w), contribute), origColor.a);\n}"
  735. },
  736. "glsl1": {
  737. "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}",
  738. "frag": "\nprecision highp float;\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}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\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_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\n uniform float contribute;\nuniform sampler2D sceneColorMap;\nuniform sampler2D colorGradingMap;\nvarying vec2 v_uv;\n#define EPS 0.000001\n#define TOTAL 64.0\n#define SIZE 512.0\nvoid main () {\n vec4 origColor = texture2D(sceneColorMap, v_uv);\n #if CC_USE_FLOAT_OUTPUT\n origColor.rgb = HDRToLDR(origColor.rgb);\n origColor.rgb = LinearToSRGB(origColor.rgb);\n #endif\n float bValue = (origColor.b * 255.0) / 4.0;\n vec2 mulB = clamp(floor(bValue) + vec2(0.0, 1.0), 0.0, 63.0);\n vec2 row = floor(mulB / 8.0 + EPS);\n vec4 row_col = vec4(row, mulB - row * 8.0);\n vec4 lookup = origColor.ggrr * (63.0 / SIZE) + row_col * (TOTAL / SIZE) + (0.5 / SIZE);\n float b1w = bValue - mulB.x;\n vec3 sampled1 = texture2D(colorGradingMap, lookup.zx).rgb;\n vec3 sampled2 = texture2D(colorGradingMap, lookup.wy).rgb;\n gl_FragColor = vec4(mix(origColor.rgb, mix(sampled1, sampled2, b1w), contribute), origColor.a);\n}"
  739. },
  740. "builtins": {
  741. "globals": {
  742. "blocks": [],
  743. "samplerTextures": [],
  744. "buffers": [],
  745. "images": []
  746. },
  747. "locals": {
  748. "blocks": [],
  749. "samplerTextures": [],
  750. "buffers": [],
  751. "images": []
  752. },
  753. "statistics": {
  754. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 1,
  755. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 2
  756. }
  757. },
  758. "defines": [
  759. {
  760. "name": "USE_INSTANCING",
  761. "type": "boolean",
  762. "defines": [],
  763. "editor": {
  764. "elevated": true
  765. }
  766. },
  767. {
  768. "name": "CC_USE_SKINNING",
  769. "type": "boolean",
  770. "defines": []
  771. },
  772. {
  773. "name": "CC_USE_BAKED_ANIMATION",
  774. "type": "boolean",
  775. "defines": [
  776. "USE_INSTANCING"
  777. ]
  778. },
  779. {
  780. "name": "CC_USE_LIGHTMAP",
  781. "type": "boolean",
  782. "defines": [
  783. "USE_INSTANCING"
  784. ]
  785. },
  786. {
  787. "name": "CC_USE_REFLECTION_PROBE",
  788. "type": "boolean",
  789. "defines": [
  790. "USE_INSTANCING"
  791. ]
  792. },
  793. {
  794. "name": "CC_RECEIVE_SHADOW",
  795. "type": "boolean",
  796. "defines": [
  797. "USE_INSTANCING"
  798. ]
  799. },
  800. {
  801. "name": "CC_USE_LIGHT_PROBE",
  802. "type": "boolean",
  803. "defines": [
  804. "USE_INSTANCING"
  805. ]
  806. },
  807. {
  808. "name": "CC_USE_MORPH",
  809. "type": "boolean",
  810. "defines": []
  811. },
  812. {
  813. "name": "CC_USE_DEBUG_VIEW",
  814. "type": "number",
  815. "defines": [],
  816. "range": [
  817. 0,
  818. 3
  819. ]
  820. },
  821. {
  822. "name": "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC",
  823. "type": "boolean",
  824. "defines": [
  825. "CC_USE_DEBUG_VIEW"
  826. ]
  827. },
  828. {
  829. "name": "CC_SURFACES_ENABLE_DEBUG_VIEW",
  830. "type": "boolean",
  831. "defines": [
  832. "CC_USE_DEBUG_VIEW",
  833. "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC"
  834. ]
  835. },
  836. {
  837. "name": "CC_USE_HDR",
  838. "type": "boolean",
  839. "defines": []
  840. },
  841. {
  842. "name": "CC_TONE_MAPPING_TYPE",
  843. "type": "number",
  844. "defines": [
  845. "CC_USE_HDR"
  846. ],
  847. "range": [
  848. 0,
  849. 3
  850. ]
  851. },
  852. {
  853. "name": "HDR_TONE_MAPPING_ACES",
  854. "type": "boolean",
  855. "defines": [
  856. "CC_TONE_MAPPING_TYPE",
  857. "CC_USE_HDR"
  858. ]
  859. },
  860. {
  861. "name": "CC_USE_FLOAT_OUTPUT",
  862. "type": "boolean",
  863. "defines": []
  864. }
  865. ],
  866. "name": "pipeline/post-process/color-grading1|color-grading-vs|color-grading-8x8-fs"
  867. }
  868. ],
  869. "combinations": [],
  870. "hideInEditor": false
  871. }