uix-kit
Version:
A free web kits for fast web design and development, compatible with Bootstrap v5.
17 lines (16 loc) • 4.26 kB
JSON
{
"id": 3183,
"name": "New Composed Shader",
"fragment": "precision highp float;\nprecision highp int;\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform float time;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec2 vUv2;\nfloat Perlin3D(vec3 P) \n {\n vec3 Pi = floor(P);\n vec3 Pf = P - Pi;\n vec3 Pf_min1 = Pf - 1.0;\n Pi.xyz = Pi.xyz - floor(Pi.xyz * (1.0 / 69.0)) * 69.0;\n vec3 Pi_inc1 = step(Pi, vec3(69.0 - 1.5)) * (Pi + 1.0);\n vec4 Pt = vec4(Pi.xy, Pi_inc1.xy) + vec2(50.0, 161.0).xyxy;\n Pt *= Pt;\n Pt = Pt.xzxz * Pt.yyww;\n const vec3 SOMELARGEFLOATS = vec3(635.298681, 682.357502, 668.926525);\n const vec3 ZINC = vec3(48.500388, 65.294118, 63.934599);\n vec3 lowz_mod = vec3(1.0 / (SOMELARGEFLOATS + Pi.zzz * ZINC));\n vec3 highz_mod = vec3(1.0 / (SOMELARGEFLOATS + Pi_inc1.zzz * ZINC));\n vec4 hashx0 = fract(Pt * lowz_mod.xxxx);\n vec4 hashx1 = fract(Pt * highz_mod.xxxx);\n vec4 hashy0 = fract(Pt * lowz_mod.yyyy);\n vec4 hashy1 = fract(Pt * highz_mod.yyyy);\n vec4 hashz0 = fract(Pt * lowz_mod.zzzz);\n vec4 hashz1 = fract(Pt * highz_mod.zzzz);\n vec4 grad_x0 = hashx0 - 0.49999;\n vec4 grad_y0 = hashy0 - 0.49999;\n vec4 grad_z0 = hashz0 - 0.49999;\n vec4 grad_x1 = hashx1 - 0.49999;\n vec4 grad_y1 = hashy1 - 0.49999;\n vec4 grad_z1 = hashz1 - 0.49999;\n vec4 grad_results_0 = inversesqrt(grad_x0 * grad_x0 + grad_y0 * grad_y0 + grad_z0 * grad_z0) * (vec2(Pf.x, Pf_min1.x).xyxy * grad_x0 + vec2(Pf.y, Pf_min1.y).xxyy * grad_y0 + Pf.zzzz * grad_z0);\n vec4 grad_results_1 = inversesqrt(grad_x1 * grad_x1 + grad_y1 * grad_y1 + grad_z1 * grad_z1) * (vec2(Pf.x, Pf_min1.x).xyxy * grad_x1 + vec2(Pf.y, Pf_min1.y).xxyy * grad_y1 + Pf_min1.zzzz * grad_z1);\n vec3 blend = Pf * Pf * Pf * (Pf * (Pf * 6.0 - 15.0) + 10.0);\n vec4 res0 = mix(grad_results_0, grad_results_1, blend.z);\n vec4 blend2 = vec4(blend.xy, vec2(1.0 - blend.xy));\n float final = dot(res0, blend2.zxzx * blend2.wwyy);\n return (final * 1.1547005383792515290182975610039);\n }\nfloat fbm(vec3 p) \n {\n float v = 0.0;\n v += Perlin3D(p * 1.) * 2.200;\n v += Perlin3D(p * 2.) * 0.00025;\n v -= Perlin3D(p * 4.) * 3.125;\n return v;\n }\nvec4 Magic_orb1553261988733_490_main() \n {\n vec4 Magic_orb1553261988733_490_gl_FragColor = vec4(0.0);\n vec3 noiseVec = vPosition;\n vec3 color = vec3(0.0);\n for (int i = 1;\n i < 2; ++i) \n {\n float t = abs(2.0 / ((noiseVec.y + fbm(noiseVec + 0.5 * time / float(i))) * 75.0));\n color += t * vec3(float(i) * 6.2 + 0.2, 1.2, 13.0);\n }\n Magic_orb1553261988733_490_gl_FragColor = vec4(color, 1.0);\n return Magic_orb1553261988733_490_gl_FragColor *= 1.0;\n }\nvoid main() \n {\n gl_FragColor = (Magic_orb1553261988733_490_main()); }\n",
"vertex": "precision highp float;\nprecision highp int;\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform float time;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec2 vUv2;\nvec4 Magic_orb1553261988733_490_main() \n {\n vec4 Magic_orb1553261988733_490_gl_Position = vec4(0.0);\n vNormal = normal;\n vUv = uv;\n vUv2 = uv2;\n vPosition = position;\n Magic_orb1553261988733_490_gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n return Magic_orb1553261988733_490_gl_Position *= 1.0;\n }\nvoid main() \n {\n gl_Position = Magic_orb1553261988733_490_main(); }\n",
"uniforms": {
"cameraPosition": {
"type": "v3",
"glslType": "vec3"
},
"time": {
"type": "f",
"glslType": "float"
}
}
}