flowLightEffect.effect.meta 3.4 KB

1234567891011121314151617
  1. {
  2. "ver": "1.0.25",
  3. "uuid": "82f6c553-ce77-4cf0-a5e2-e367ea10be46",
  4. "compiledShaders": [
  5. {
  6. "glsl1": {
  7. "vert": "uniform mat4 cc_matViewProj;\nprecision highp float;\nattribute vec3 a_position;\nattribute vec2 a_uv0;\nvarying vec2 uv0;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}",
  8. "frag": "\n#if USE_ALPHA_TEST\n#endif\nprecision highp float;\nvarying vec2 uv0;\nuniform sampler2D texture;\nuniform vec4 UVoffset;\nuniform float u_time;\nuniform float rotated;\nvoid main()\n{\n float u_time = u_time * .5+5.;\n vec2 UVnormalize;\n UVnormalize.x = (uv0.x-UVoffset.x)/(UVoffset.z-UVoffset.x);\n UVnormalize.y = (uv0.y-UVoffset.y)/(UVoffset.w-UVoffset.y);\n if(rotated > 0.5)\n {\n float temp = UVnormalize.x;\n UVnormalize.x = UVnormalize.y;\n UVnormalize.y = 1.0 - temp;\n }\n #if USE_TEXTURE\n #endif\n vec2 uv = uv0.xy;\n vec2 p = mod(uv*6.12, 6.12)-250.0;\n vec2 i = vec2(p);\n float c = 1.0;\n float inten = .0065;\n for (int n = 0; n < 5; n++)\n {\n float t = u_time * (1.0 - (3.5 / float(n+1)));\n i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(1.5*t + i.x));\n c += 1.0/length(vec2(p.x / (cos(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));\n }\n c /= float(5);\n c = 1.17-pow(c, 1.4);\n vec4 tex = texture2D(texture,uv0);\n vec3 colour = vec3(pow(abs(c), 20.0));\n colour = clamp(colour + vec3(0.0, 0.0, .0), 0.0, tex.a);\n float alpha = c*tex[3];\n tex[0] = tex[0] + colour[0]*alpha;\n tex[1] = tex[1] + colour[1]*alpha;\n tex[2] = tex[2] + colour[2]*alpha;\n gl_FragColor = vec4(1,1,1,1) * tex;\n}"
  9. },
  10. "glsl3": {
  11. "vert": "uniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nprecision highp float;\nin vec3 a_position;\nin vec2 a_uv0;\nout vec2 uv0;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}",
  12. "frag": "\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nprecision highp float;\nin vec2 uv0;\nuniform sampler2D texture;\nuniform ARGS {\n vec4 UVoffset;\n float u_time;\n float rotated;\n};\nvoid main()\n{\n float u_time = u_time * .5+5.;\n vec2 UVnormalize;\n UVnormalize.x = (uv0.x-UVoffset.x)/(UVoffset.z-UVoffset.x);\n UVnormalize.y = (uv0.y-UVoffset.y)/(UVoffset.w-UVoffset.y);\n if(rotated > 0.5)\n {\n float temp = UVnormalize.x;\n UVnormalize.x = UVnormalize.y;\n UVnormalize.y = 1.0 - temp;\n }\n #if USE_TEXTURE\n #endif\n vec2 uv = uv0.xy;\n vec2 p = mod(uv*6.12, 6.12)-250.0;\n vec2 i = vec2(p);\n float c = 1.0;\n float inten = .0065;\n for (int n = 0; n < 5; n++)\n {\n float t = u_time * (1.0 - (3.5 / float(n+1)));\n i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(1.5*t + i.x));\n c += 1.0/length(vec2(p.x / (cos(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));\n }\n c /= float(5);\n c = 1.17-pow(c, 1.4);\n vec4 tex = texture2D(texture,uv0);\n vec3 colour = vec3(pow(abs(c), 20.0));\n colour = clamp(colour + vec3(0.0, 0.0, .0), 0.0, tex.a);\n float alpha = c*tex[3];\n tex[0] = tex[0] + colour[0]*alpha;\n tex[1] = tex[1] + colour[1]*alpha;\n tex[2] = tex[2] + colour[2]*alpha;\n gl_FragColor = vec4(1,1,1,1) * tex;\n}"
  13. }
  14. }
  15. ],
  16. "subMetas": {}
  17. }