{"__type__":"cc.EffectAsset","_name":"builtin-unlit-transparent","techniques":[{"stages":["transparent"],"passes":[{"blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"program":"builtin-unlit-transparent|unlit-vs|unlit-fs","depthStencilState":{"depthTest":true,"depthWrite":true},"properties":{"diffuseTexture":{"value":"white","type":29},"diffuseColor":{"value":[1,1,1,1],"inspector":{"type":"color"},"type":16},"alphaThreshold":{"value":[0.5],"type":13},"mainTiling":{"value":[1,1],"type":14},"mainOffset":{"value":[0,0],"type":14}}}]}],"shaders":[{"hash":4105696851,"glsl3":{"vert":"\nprecision highp float;\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\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\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\n\n#if CC_USE_SKINNING\n\n in vec4 a_weights;\n in vec4 a_joints;\n\n #if CC_USE_JOINTS_TEXTRUE\n uniform SKINNING {\n vec2 cc_jointsTextureSize;\n }\n uniform sampler2D cc_jointsTexture;\n\n #if CC_JOINTS_TEXTURE_FLOAT32\n mat4 getBoneMatrix(const in float i) {\n float width = cc_jointsTextureSize.x;\n float height = cc_jointsTextureSize.y;\n float j = i * 4.0;\n float x = mod(j, width);\n float y = floor(j / width);\n\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n\n y = dy * (y + 0.5);\n\n vec4 v1 = texture2D(cc_jointsTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(cc_jointsTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(cc_jointsTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(cc_jointsTexture, vec2(dx * (x + 3.5), y));\n\n return mat4(v1, v2, v3, v4);\n }\n #else\n float decode32(vec4 rgba) {\n float Sign = 1.0 - step(128.0, rgba[0]) * 2.0;\n float Exponent = 2.0 * mod(rgba[0], 128.0) + step(128.0, rgba[1]) - 127.0;\n float Mantissa = mod(rgba[1], 128.0) * 65536.0 + rgba[2] * 256.0 + rgba[3] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n }\n vec4 decodevec4 (vec4 x, vec4 y, vec4 z, vec4 w) {\n\n return vec4(\n decode32(x.wzyx * 255.0),\n decode32(y.wzyx * 255.0),\n decode32(z.wzyx * 255.0),\n decode32(w.wzyx * 255.0)\n );\n }\n\n vec4 decodevec4 (float dx, float x, float y) {\n return decodevec4(\n texture2D(cc_jointsTexture, vec2(dx * (x + 0.5), y)),\n texture2D(cc_jointsTexture, vec2(dx * (x + 1.5), y)),\n texture2D(cc_jointsTexture, vec2(dx * (x + 2.5), y)),\n texture2D(cc_jointsTexture, vec2(dx * (x + 3.5), y))\n );\n }\n\n mat4 getBoneMatrix(const in float i) {\n float width = cc_jointsTextureSize.x;\n float height = cc_jointsTextureSize.y;\n float j = i * 16.0;\n float x = mod(j, width);\n float y = floor(j / width);\n\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n\n y = dy * (y + 0.5);\n\n vec4 v1 = decodevec4(dx, x, y);\n vec4 v2 = decodevec4(dx, x+4.0, y);\n vec4 v3 = decodevec4(dx, x+8.0, y);\n vec4 v4 = decodevec4(dx, x+12.0, y);\n\n return mat4(v1, v2, v3, v4);\n }\n #endif\n #else\n uniform CC_JOINT_MATRIX {\n mat4 cc_jointMatrices[50];\n }\n\n mat4 getBoneMatrix(const in float i) {\n return cc_jointMatrices[int(i)];\n }\n #endif\n\n mat4 skinMatrix() {\n return\n getBoneMatrix(a_joints.x) * a_weights.x +\n getBoneMatrix(a_joints.y) * a_weights.y +\n getBoneMatrix(a_joints.z) * a_weights.z +\n getBoneMatrix(a_joints.w) * a_weights.w\n ;\n }\n#endif\n\nvoid SKIN_VERTEX(inout vec4 a1) {\n #if CC_USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n #endif\n}\n\nvoid SKIN_VERTEX(inout vec4 a1, inout vec4 a2) {\n #if CC_USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n a2 = m * a2;\n #endif\n}\n\nvoid SKIN_VERTEX(inout vec4 a1, inout vec4 a2, inout vec4 a3) {\n #if CC_USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n a2 = m * a2;\n a3 = m * a3;\n #endif\n}\n\nuniform MAIN_TILING {\n vec2 mainTiling;\n vec2 mainOffset;\n}\n\nin vec3 a_position;\n\n#if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n in mediump vec2 a_uv0;\n out mediump vec2 v_uv0;\n#endif\n\n#if CC_USE_ATTRIBUTE_COLOR\n in lowp vec4 a_color;\n out lowp vec4 v_color;\n#endif\n\nvoid main () {\n vec4 position = vec4(a_position, 1);\n\n SKIN_VERTEX(position);\n \n #if CC_USE_ATTRIBUTE_COLOR\n v_color = a_color;\n #endif\n\n #if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n v_uv0 = a_uv0 * mainTiling + mainOffset;\n #endif\n\n gl_Position = cc_matViewProj * cc_matWorld * position;\n}\n","frag":"\nprecision highp float;\n\nvec3 SRGBToLinear(vec3 gamma)\n{\n\treturn pow(gamma, vec3(2.2));\n\n}\n\nvec3 LinearToSRGB(vec3 linear)\n{\n\treturn pow(linear, vec3(0.454545));\n\n}\n\nvec4 TEXEL_TO_LINEAR (in vec4 color) {\n #if INPUT_IS_GAMMA\n return vec4(SRGBToLinear(color.rgb), color.a);\n #else\n return color;\n #endif\n}\n\nvec4 LINEAR_TO_OUTPUT_TEXEL (in vec4 color) {\n #if OUTPUT_TO_GAMMA\n return vec4(LinearToSRGB(color.rgb), color.a);\n #else\n return color;\n #endif\n}\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nuniform DIFFUSE {\n lowp vec4 diffuseColor;\n};\n\n#if USE_DIFFUSE_TEXTURE\n uniform sampler2D diffuseTexture;\n#endif\n\nvoid MULTIPLY_DIFFUSE_TEXTRUE_COLOR (inout vec4 color, in vec2 uv) {\n #if USE_DIFFUSE_TEXTURE && CC_USE_ATTRIBUTE_UV0\n vec4 diffuseTextureColor = texture2D(diffuseTexture, uv);\n #if CC_USE_ALPHA_ATLAS_DIFFUSETEXTURE\n diffuseTextureColor.a *= texture2D(diffuseTexture, uv + vec2(0, 0.5)).r;\n #endif\n color *= TEXEL_TO_LINEAR(diffuseTextureColor);\n #endif\n}\n\nvoid CALC_DIFFUSE (inout vec4 color, in vec2 uv) {\n color *= diffuseColor;\n MULTIPLY_DIFFUSE_TEXTRUE_COLOR(color, uv);\n}\n\nvoid CALC_DIFFUSE (inout vec4 color) {\n color *= diffuseColor;\n}\n\n#if CC_USE_ATTRIBUTE_COLOR\n in lowp vec4 v_color;\n#endif\n\n#if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n in mediump vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 color = vec4(1, 1, 1, 1);\n\n #if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n CALC_DIFFUSE(color, v_uv0);\n #else \n CALC_DIFFUSE(color);\n #endif\n\n #if CC_USE_ATTRIBUTE_COLOR\n color *= v_color;\n #endif\n\n ALPHA_TEST(color);\n\n gl_FragColor = LINEAR_TO_OUTPUT_TEXEL( color );\n}\n"},"glsl1":{"vert":"\nprecision highp float;\nuniform mat4 cc_matWorld;\nuniform mat4 cc_matViewProj;\n\n#if CC_USE_SKINNING\n\n attribute vec4 a_weights;\n attribute vec4 a_joints;\n\n #if CC_USE_JOINTS_TEXTRUE\n uniform vec2 cc_jointsTextureSize;\n uniform sampler2D cc_jointsTexture;\n\n #if CC_JOINTS_TEXTURE_FLOAT32\n mat4 getBoneMatrix(const in float i) {\n float width = cc_jointsTextureSize.x;\n float height = cc_jointsTextureSize.y;\n float j = i * 4.0;\n float x = mod(j, width);\n float y = floor(j / width);\n\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n\n y = dy * (y + 0.5);\n\n vec4 v1 = texture2D(cc_jointsTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(cc_jointsTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(cc_jointsTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(cc_jointsTexture, vec2(dx * (x + 3.5), y));\n\n return mat4(v1, v2, v3, v4);\n }\n #else\n float decode32(vec4 rgba) {\n float Sign = 1.0 - step(128.0, rgba[0]) * 2.0;\n float Exponent = 2.0 * mod(rgba[0], 128.0) + step(128.0, rgba[1]) - 127.0;\n float Mantissa = mod(rgba[1], 128.0) * 65536.0 + rgba[2] * 256.0 + rgba[3] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n }\n vec4 decodevec4 (vec4 x, vec4 y, vec4 z, vec4 w) {\n\n return vec4(\n decode32(x.wzyx * 255.0),\n decode32(y.wzyx * 255.0),\n decode32(z.wzyx * 255.0),\n decode32(w.wzyx * 255.0)\n );\n }\n\n vec4 decodevec4 (float dx, float x, float y) {\n return decodevec4(\n texture2D(cc_jointsTexture, vec2(dx * (x + 0.5), y)),\n texture2D(cc_jointsTexture, vec2(dx * (x + 1.5), y)),\n texture2D(cc_jointsTexture, vec2(dx * (x + 2.5), y)),\n texture2D(cc_jointsTexture, vec2(dx * (x + 3.5), y))\n );\n }\n\n mat4 getBoneMatrix(const in float i) {\n float width = cc_jointsTextureSize.x;\n float height = cc_jointsTextureSize.y;\n float j = i * 16.0;\n float x = mod(j, width);\n float y = floor(j / width);\n\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n\n y = dy * (y + 0.5);\n\n vec4 v1 = decodevec4(dx, x, y);\n vec4 v2 = decodevec4(dx, x+4.0, y);\n vec4 v3 = decodevec4(dx, x+8.0, y);\n vec4 v4 = decodevec4(dx, x+12.0, y);\n\n return mat4(v1, v2, v3, v4);\n }\n #endif\n #else\n uniform mat4 cc_jointMatrices[50];\nmat4 getBoneMatrix(const in float i) {\n return cc_jointMatrices[int(i)];\n }\n #endif\n\n mat4 skinMatrix() {\n return\n getBoneMatrix(a_joints.x) * a_weights.x +\n getBoneMatrix(a_joints.y) * a_weights.y +\n getBoneMatrix(a_joints.z) * a_weights.z +\n getBoneMatrix(a_joints.w) * a_weights.w\n ;\n }\n#endif\n\nvoid SKIN_VERTEX(inout vec4 a1) {\n #if CC_USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n #endif\n}\n\nvoid SKIN_VERTEX(inout vec4 a1, inout vec4 a2) {\n #if CC_USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n a2 = m * a2;\n #endif\n}\n\nvoid SKIN_VERTEX(inout vec4 a1, inout vec4 a2, inout vec4 a3) {\n #if CC_USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n a2 = m * a2;\n a3 = m * a3;\n #endif\n}\n\nuniform vec2 mainTiling;\nuniform vec2 mainOffset;\nattribute vec3 a_position;\n\n#if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n attribute mediump vec2 a_uv0;\n varying mediump vec2 v_uv0;\n#endif\n\n#if CC_USE_ATTRIBUTE_COLOR\n attribute lowp vec4 a_color;\n varying lowp vec4 v_color;\n#endif\n\nvoid main () {\n vec4 position = vec4(a_position, 1);\n\n SKIN_VERTEX(position);\n \n #if CC_USE_ATTRIBUTE_COLOR\n v_color = a_color;\n #endif\n\n #if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n v_uv0 = a_uv0 * mainTiling + mainOffset;\n #endif\n\n gl_Position = cc_matViewProj * cc_matWorld * position;\n}\n","frag":"\nprecision highp float;\n\nvec3 SRGBToLinear(vec3 gamma)\n{\n\treturn pow(gamma, vec3(2.2));\n\n}\n\nvec3 LinearToSRGB(vec3 linear)\n{\n\treturn pow(linear, vec3(0.454545));\n\n}\n\nvec4 TEXEL_TO_LINEAR (in vec4 color) {\n #if INPUT_IS_GAMMA\n return vec4(SRGBToLinear(color.rgb), color.a);\n #else\n return color;\n #endif\n}\n\nvec4 LINEAR_TO_OUTPUT_TEXEL (in vec4 color) {\n #if OUTPUT_TO_GAMMA\n return vec4(LinearToSRGB(color.rgb), color.a);\n #else\n return color;\n #endif\n}\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nuniform lowp vec4 diffuseColor;\n\n#if USE_DIFFUSE_TEXTURE\n uniform sampler2D diffuseTexture;\n#endif\n\nvoid MULTIPLY_DIFFUSE_TEXTRUE_COLOR (inout vec4 color, in vec2 uv) {\n #if USE_DIFFUSE_TEXTURE && CC_USE_ATTRIBUTE_UV0\n vec4 diffuseTextureColor = texture2D(diffuseTexture, uv);\n #if CC_USE_ALPHA_ATLAS_DIFFUSETEXTURE\n diffuseTextureColor.a *= texture2D(diffuseTexture, uv + vec2(0, 0.5)).r;\n #endif\n color *= TEXEL_TO_LINEAR(diffuseTextureColor);\n #endif\n}\n\nvoid CALC_DIFFUSE (inout vec4 color, in vec2 uv) {\n color *= diffuseColor;\n MULTIPLY_DIFFUSE_TEXTRUE_COLOR(color, uv);\n}\n\nvoid CALC_DIFFUSE (inout vec4 color) {\n color *= diffuseColor;\n}\n\n#if CC_USE_ATTRIBUTE_COLOR\n varying lowp vec4 v_color;\n#endif\n\n#if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n varying mediump vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 color = vec4(1, 1, 1, 1);\n\n #if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n CALC_DIFFUSE(color, v_uv0);\n #else \n CALC_DIFFUSE(color);\n #endif\n\n #if CC_USE_ATTRIBUTE_COLOR\n color *= v_color;\n #endif\n\n ALPHA_TEST(color);\n\n gl_FragColor = LINEAR_TO_OUTPUT_TEXEL( color );\n}\n"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]},{"name":"CC_JOINT_MATRIX","defines":["CC_USE_SKINNING"]}],"samplers":[{"name":"cc_jointsTexture","defines":["CC_USE_SKINNING","CC_USE_JOINTS_TEXTRUE"]}]}},"defines":[{"name":"CC_USE_SKINNING","type":"boolean","defines":[]},{"name":"CC_USE_JOINTS_TEXTRUE","type":"boolean","defines":["CC_USE_SKINNING"]},{"name":"CC_JOINTS_TEXTURE_FLOAT32","type":"boolean","defines":["CC_USE_SKINNING","CC_USE_JOINTS_TEXTRUE"]},{"name":"CC_USE_ATTRIBUTE_UV0","type":"boolean","defines":[]},{"name":"USE_DIFFUSE_TEXTURE","type":"boolean","defines":[]},{"name":"CC_USE_ATTRIBUTE_COLOR","type":"boolean","defines":[]},{"name":"INPUT_IS_GAMMA","type":"boolean","defines":[]},{"name":"OUTPUT_TO_GAMMA","type":"boolean","defines":[]},{"name":"USE_ALPHA_TEST","type":"boolean","defines":[]},{"name":"CC_USE_ALPHA_ATLAS_DIFFUSETEXTURE","type":"boolean","defines":["USE_DIFFUSE_TEXTURE","CC_USE_ATTRIBUTE_UV0"]}],"blocks":[{"name":"SKINNING","members":[{"name":"cc_jointsTextureSize","type":14,"count":1}],"defines":["CC_USE_SKINNING","CC_USE_JOINTS_TEXTRUE"],"binding":0},{"name":"MAIN_TILING","members":[{"name":"mainTiling","type":14,"count":1},{"name":"mainOffset","type":14,"count":1}],"defines":[],"binding":1},{"name":"ALPHA_TEST","members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"],"binding":2},{"name":"DIFFUSE","members":[{"name":"diffuseColor","type":16,"count":1}],"defines":[],"binding":3}],"samplers":[{"name":"diffuseTexture","type":29,"count":1,"defines":["USE_DIFFUSE_TEXTURE"],"binding":30}],"dependencies":{},"name":"builtin-unlit-transparent|unlit-vs|unlit-fs"}]}