From 198d8534ad817b2ed45f451b1d6499d26d0ca58c Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 2 Apr 2026 10:00:57 +0800 Subject: [PATCH] fix:bug --- admin.js | 4 +- data/shaders.json | 402 ++++++++++++++++++++++++++++++----- display.js | 517 ++++++++++++++++++++++++++++++++++++++++------ index.html | 13 ++ server.js | 119 ++++++++++- 5 files changed, 921 insertions(+), 134 deletions(-) diff --git a/admin.js b/admin.js index bfc0baa..e0774be 100644 --- a/admin.js +++ b/admin.js @@ -15,7 +15,9 @@ const EXAMPLE = `void mainImage(out vec4 fragColor, in vec2 fragCoord) { }`; function validateClientCode(code) { - if (!code.includes("mainImage")) return "代码需包含 mainImage。"; + const hasMainImage = code.includes("mainImage"); + const hasAngleMain = code.includes("_umainImage"); + if (!hasMainImage && !hasAngleMain) return "代码需包含 mainImage 或 _umainImage。"; return ""; } diff --git a/data/shaders.json b/data/shaders.json index 985edb6..f27126f 100644 --- a/data/shaders.json +++ b/data/shaders.json @@ -1,80 +1,368 @@ [ { - "id": "40ff4b15-9fd8-4c24-a1eb-43f9ab796590", - "name": "玄粒子", + "id": "347c3c57-1b24-49bb-9c1c-37b6a4aff0de", + "name": "跃迁", "author": "unknown", - "code": "void ANGLE_loopForwardProgress() {}\n\n\n\nvec2 ANGLE_sc11(float ANGLE_sc12, float ANGLE_sc13)\n{\n vec2 ANGLE_sc14 = vec2(ANGLE_sc12, ANGLE_sc13);\n return ANGLE_sc14;\n}\n\n\n\nvec2 ANGLE_sc0e(float ANGLE_sc0, float ANGLE_sc10)\n{\n vec2 ANGLE_sc15 = vec2(ANGLE_sc0, ANGLE_sc10);\n return ANGLE_sc15;\n}\n\n\n\nvec4 ANGLE_sc0b(vec3 ANGLE_sc0c, float ANGLE_sc0d)\n{\n vec4 ANGLE_sc16 = vec4(ANGLE_sc0c.x, ANGLE_sc0c.y, ANGLE_sc0c.z, ANGLE_sc0d);\n return ANGLE_sc16;\n}\n\n\n\nvoid _umainImage(out vec4 _ufragColor, vec2 _ufragCoord)\n{\n _uO = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 _uv = iResolution.xy;\n vec2 ANGLE_sc17 = (_uI + _uI);\n vec2 ANGLE_sc18 = (ANGLE_sc17 - _uv);\n vec2 ANGLE_sc19 = (ANGLE_sc18 / _uv.y);\n vec2 _up = (ANGLE_sc19 / 0.300000012);\n float _ui = 0.0;\n float _uf = 0.0;\n {\n _uO *= _ui;\n float ANGLE_sc1b = (_ui++);\n bool ANGLE_sbe6 = (ANGLE_sc1b < 9.0);\n while (ANGLE_sbe6)\n {\n {\n ANGLE_loopForwardProgress();\n {\n {\n vec2 ANGLE_sc1d = _uv = _up;\n float ANGLE_sc1e = _uf = 0.0;\n float ANGLE_sc1 = (_uf++);\n bool ANGLE_sbe7 = (ANGLE_sc1 < 9.0);\n while (ANGLE_sbe7)\n {\n {\n ANGLE_loopForwardProgress();\n {\n }\n }\n vec2 ANGLE_sc21 = (_uv.yx * _uf);\n vec2 ANGLE_sc22 = (ANGLE_sc21 + _ui);\n vec2 ANGLE_sc23 = (ANGLE_sc22 + iTime);\n vec2 ANGLE_sc24 = sin(ANGLE_sc23);\n vec2 ANGLE_sc25 = (ANGLE_sc24 / _uf);\n _uv += ANGLE_sc25;\n float ANGLE_sc26 = (_uf++);\n ANGLE_sbe7 = (ANGLE_sc26 < 9.0);\n }\n }\n }\n }\n vec4 ANGLE_sc28 = (_ui + vec4(0.0, 1.0, 2.0, 3.0));\n vec4 ANGLE_sc29 = cos(ANGLE_sc28);\n vec4 ANGLE_sc2a = (ANGLE_sc29 + 1.0);\n vec4 ANGLE_sc2b = (ANGLE_sc2a / 6.0);\n float ANGLE_sc2c = length(_uv);\n vec4 ANGLE_sc2d = (ANGLE_sc2b / ANGLE_sc2c);\n _uO += ANGLE_sc2d;\n float ANGLE_sc2e = (_ui++);\n ANGLE_sbe6 = (ANGLE_sc2e < 9.0);\n }\n }\n vec4 ANGLE_sc30 = (_uO * _uO);\n _uO = tanh(ANGLE_sc30);\n}\n\n\n\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) { _umainImage(fragColor, fragCoord); }", - "views": 13403, - "likes": 395, - "createdAt": "2026-04-01T12:26:22.129Z", - "sourceFormat": "angle-metal-auto-converted", - "updatedAt": "2026-04-01T13:31:34.471Z" + "code": "// Interstellar\n// Hazel Quantock\n// This code is licensed under the CC0 license http://creativecommons.org/publicdomain/zero/1.0/\n\nconst float tau = 6.28318530717958647692;\n\n// Gamma correction\n#define GAMMA (2.2)\n\nvec3 ToLinear( in vec3 col )\n{\n\t// simulate a monitor, converting colour values into light values\n\treturn pow( col, vec3(GAMMA) );\n}\n\nvec3 ToGamma( in vec3 col )\n{\n\t// convert back into colour values, so the correct light will come out of the monitor\n\treturn pow( col, vec3(1.0/GAMMA) );\n}\n\nvec4 Noise( in ivec2 x )\n{\n\treturn texture( iChannel0, (vec2(x)+0.5)/256.0, -100.0 );\n}\n\nvec4 Rand( in int x )\n{\n\tvec2 uv;\n\tuv.x = (float(x)+0.5)/256.0;\n\tuv.y = (floor(uv.x)+0.5)/256.0;\n\treturn texture( iChannel0, uv, -100.0 );\n}\n\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n\tvec3 ray;\n\tray.xy = 2.0*(fragCoord.xy-iResolution.xy*.5)/iResolution.x;\n\tray.z = 1.0;\n\n\tfloat offset = iTime*.5;\t\n\tfloat speed2 = (cos(offset)+1.0)*2.0;\n\tfloat speed = speed2+.1;\n\toffset += sin(offset)*.96;\n\toffset *= 2.0;\n\t\n\t\n\tvec3 col = vec3(0);\n\t\n\tvec3 stp = ray/max(abs(ray.x),abs(ray.y));\n\t\n\tvec3 pos = 2.0*stp+.5;\n\tfor ( int i=0; i < 20; i++ )\n\t{\n\t\tfloat z = Noise(ivec2(pos.xy)).x;\n\t\tz = fract(z-offset);\n\t\tfloat d = 50.0*z-pos.z;\n\t\tfloat w = pow(max(0.0,1.0-8.0*length(fract(pos.xy)-.5)),2.0);\n\t\tvec3 c = max(vec3(0),vec3(1.0-abs(d+speed2*.5)/speed,1.0-abs(d)/speed,1.0-abs(d-speed2*.5)/speed));\n\t\tcol += 1.5*(1.0-z)*c*w;\n\t\tpos += stp;\n\t}\n\t\n\tfragColor = vec4(ToGamma(col),1.0);\n}", + "views": 11032, + "likes": 192, + "createdAt": "2026-04-02T01:57:49.494Z", + "sourceFormat": "glsl" }, { - "id": "f0cd7ab2-51a2-499e-b034-0c6b8235cbbc", + "id": "b08237ae-6fc0-4b06-bfb8-ae0f6a8e1354", + "name": "科技", + "author": "unknown", + "code": "#define O(Z,c) ( length( /* orb */ \\\n p - vec3( sin( T*c*6. ) * 6., \\\n sin( T*c*4. ) * 1. + 1e1, \\\n T+Z+2e1+1e1*cos(T*.6) ) ) - c )\n// MENGERLAYER\n#define m(f, h)\\\n s /= (f), \\\n p = abs(fract(q/s)*s - s*.5), \\\n \tm = min(m, min(max(p.x, p.y), \\\n min(max(p.y, p.z), \\\n max(p.x, p.z))) - s/(h))\n\nvoid mainImage(out vec4 o, vec2 u) {\n \n float i, e, T = iTime * 2.,m,d,s = 1.5,l,\n j = 0.;\n vec3 c,r = iResolution;\n mat2 rot = mat2(cos(cos(T*.05)*.6+vec4(0,33,11,0)));\n \n u = (u+u - r.xy) / r.y;\n\n vec3 q,p = vec3(0,1e1,T),\n D = vec3(rot*u, 1);\n \n for(;i++ < 1e2;\n c += 1./s + 2e1*vec3(1,2,5)/max(e, .001)\n )\n q = p += j + D * s,\n e = max( .6* min( O( 3., .1),\n min( O( 5., .2),\n O( 9., .3) )), .001),\n m=1e1,\n s = 64.,\n m(2., 6.),\n s = 26.,\n m(2., 4.),\n m(2., 4.),\n m(2., 4.),\n s = 32.,\n m(2., 4.),\n d += s = min(e,\n max(.01+.7*abs(m), .01+.7*abs(.6+dot(sin(.3*T+q/6.), cos(q.yzx/16.))))),\n p = q;\n o.rgb = tanh(c*c/5e5);\n\n}", + "views": 3849, + "likes": 532, + "createdAt": "2026-04-02T01:56:37.273Z", + "sourceFormat": "glsl" + }, + { + "id": "50d1783d-35ec-4cc1-8d0a-0167bbf3c1e0", + "name": "甲板", + "author": "unknown", + "code": "/*\n\tNeon Lit Hexagons\n\t-----------------\n\n\tI needed a break from a few technical shaders I've beem hacking away at, so I finished an old \n\tgeometric example that'd been sitting on the blocks for a while.\n\t\n\t3D hexagon tech imagery is a bit of a cliche, but I've always been a fan. Most tend to be high \n\tquality pathtraced renderings, but since this is a realtime raymarched example, I had to make \n\ta lot of concessions. The glowing neon lights were inspired by some of Shau's examples, some\n\tonline imagery, and practically half the demos out there. :)\n\n\tI tried to create the glowing effect without the use of a volumetric pass, but my eyes weren't\n\taccepting the results, which meant the observant people on here -- pretty much everyone -- would \n\tnotice immediately, so I put a relatively cheap one in. The improvements were immediate, but it\n\twas at the cost of rendering speed... I'm just hoping no one notices the lack of reflections from \n\tthe neon lights. :) I have a pretty quick laptop, but ever since the WebGL 2 update, it hasn't \n\tenjoyed compiling extra passes, so reflections had to go. At a later stage, I might attempt to \n\tfake them in some way.\n\n\tThere are a couple of surface detail defines below that I had to leave out. I also came pretty \n\tclose to greebling the surfaces, but figured that might be overkill. In the end, I took the \n\t\"less is more\" approach. However, I intend to put together a greebled surface pretty soon.\n\n\n // Other neon-looking examples:\n\n\t// Shau has a heap of bright glowing examples, but here's a few.\n\tOTT - shau\n\thttps://www.shadertoy.com/view/4sVyDd\n\n\t43% Burnt - shau\n\thttps://www.shadertoy.com/view/XljBWW\n\n\tAngle Grinder - shau\n\thttps://www.shadertoy.com/view/XtsfWX\n\n\n // Great example.\n\tNeon World - zguerrero\n https://www.shadertoy.com/view/MlscDj\n\n*/\n\n\n\n// Hexagon: 0, Dodecahedron: 1, Circle: 2.\n// Squares, stars, etc, are possible too, but I didn't include those.\n#define SHAPE 0\n\n\n// Details usually make a scene more interesting. In this case, however, they seemed a\n// little expensive, so I left them out.\n//\n// I wanted to include the grooves, at least, but I figured speed on slower machines was\n// more important.\n//#define ADD_DETAIL_GROOVE \n//#define ADD_DETAIL_BOLT\n\n// Animating the neon lights, or not. I find them a little too distracting, \n// so the default is \"off.\"\n//#define ANIMATE_LIGHTS\n\n// If Borg green is more your thing. :)\n//#define GREEN_GLOW\n\n// Maximum ray distance.\n#define FAR 50.\n\n// Standard 2D rotation formula.\nmat2 r2(in float a){ float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n\n// vec2 to float hash.\nfloat hash21(vec2 p){\n \n float n = dot(p, vec2(7.163, 157.247)); \n return fract(sin(n)*43758.5453);\n}\n\n// vec3 to float hash.\nfloat hash31(vec3 p){\n \n float n = dot(p, vec3(13.163, 157.247, 7.951)); \n return fract(sin(n)*43758.5453); \n}\n\n\n// Commutative smooth maximum function. Provided by Tomkh, and taken \n// from Alex Evans's (aka Statix) talk: \n// http://media.lolrus.mediamolecule.com/AlexEvans_SIGGRAPH-2015.pdf\n// Credited to Dave Smith @media molecule.\nfloat smax(float a, float b, float k){\n \n float f = max(0., 1. - abs(b - a)/k);\n return max(a, b) + k*.25*f*f;\n}\n\n/*\n// Commutative smooth minimum function. Provided by Tomkh, and taken \n// from Alex Evans's (aka Statix) talk: \n// http://media.lolrus.mediamolecule.com/AlexEvans_SIGGRAPH-2015.pdf\n// Credited to Dave Smith @media molecule.\nfloat smin(float a, float b, float k){\n\n float f = max(0., 1. - abs(b - a)/k);\n return min(a, b) - k*.25*f*f;\n}\n\n*/\n\n/*\n// Tri-Planar blending function. Based on an old Nvidia tutorial.\nvec3 tex3D( sampler2D tex, in vec3 p, in vec3 n ){\n \n n = max((abs(n) - .2)*7., .001); // n = max(abs(n), .001), etc.\n n /= (n.x + n.y + n.z ); \n \n\tvec3 tx = (texture(tex, p.yz)*n.x + texture(tex, p.zx)*n.y + texture(tex, p.xy)*n.z).xyz;\n \n return tx*tx;\n}\n*/\n\n// Tri-Planar blending function. Based on an old Nvidia writeup:\n// GPU Gems 3 - Ryan Geiss: https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch01.html\nvec3 tex3D(sampler2D t, in vec3 p, in vec3 n){\n \n // We only want positive normal weightings. The normal is manipulated to suit\n // your needs.\n n = max(abs(n) - .2, .001); // n = max(n*n - .1, .001), etc.\n //n /= dot(n, vec3(1)); // Rough renormalization approximation.\n n /= length(n); // Renormalizing.\n \n\tvec3 tx = texture(t, p.yz).xyz; // Left and right sides.\n vec3 ty = texture(t, p.zx).xyz; // Top and bottom.\n vec3 tz = texture(t, p.xy).xyz; // Front and back.\n \n // Blending the surrounding textures with the normal weightings. If the surface is facing\n // more up or down, then a larger \"n.y\" weighting would make sense, etc.\n //\n // Textures are stored in sRGB (I think), so you have to convert them to linear space \n // (squaring is a rough approximation) prior to working with them... or something like that. :)\n // Once the final color value is gamma corrected, you should see correct looking colors.\n return (tx*tx*n.x + ty*ty*n.y + tz*tz*n.z);\n \n}\n\n// More concise, self contained version of IQ's original 3D noise function.\nfloat noise3D(in vec3 p){\n \n // Just some random figures, analogous to stride. You can change this, if you want.\n\tconst vec3 s = vec3(113, 157, 1);\n\t\n\tvec3 ip = floor(p); // Unique unit cell ID.\n \n // Setting up the stride vector for randomization and interpolation, kind of. \n // All kinds of shortcuts are taken here. Refer to IQ's original formula.\n vec4 h = vec4(0., s.yz, s.y + s.z) + dot(ip, s);\n \n\tp -= ip; // Cell's fractional component.\n\t\n // A bit of cubic smoothing, to give the noise that rounded look.\n p = p*p*(3. - 2.*p);\n \n // Standard 3D noise stuff. Retrieving 8 random scalar values for each cube corner,\n // then interpolating along X. There are countless ways to randomize, but this is\n // the way most are familar with: fract(sin(x)*largeNumber).\n h = mix(fract(sin(h)*43758.5453), fract(sin(h + s.x)*43758.5453), p.x);\n\t\n // Interpolating along Y.\n h.xy = mix(h.xz, h.yw, p.y);\n \n // Interpolating along Z, and returning the 3D noise value.\n float n = mix(h.x, h.y, p.z); // Range: [0, 1].\n\t\n return n;//abs(n - .5)*2.;\n}\n\n// Simple fBm to produce some clouds.\nfloat fbm(in vec3 p){\n \n // Four layers of 3D noise.\n //p /= 1.5;\n //p -= vec3(0, 0, iTime*1.);\n return 0.5333*noise3D( p ) + 0.2667*noise3D( p*2.02 ) + 0.1333*noise3D( p*4.03 ) + 0.0667*noise3D( p*8.03 );\n\n}\n\n\n\n// The path is a 2D sinusoid that varies over time, depending upon the frequencies, and amplitudes.\nvec2 path(in float z){ \n\n //return vec2(0);\n \n //return vec2(sin(z * 0.15)*2.4, cos(z * 0.075)*.15); \n \n return vec2(sin(z * 0.15)*2.4, 0);\n}\n\n\n\n\n//////\n//float objID, svObjID;\n\n// Helper vector. If you're doing anything that involves regular triangles or hexagons, the\n// 30-60-90 triangle will be involved in some way, which has sides of 1, sqrt(3) and 2.\nconst vec2 s = vec2(.866025, 1);//const vec2 s = vec2(1, 1.7320508); //\n\n\n// The 2D hexagonal isosuface function: If you were to render a horizontal line and one that\n// slopes at 60 degrees, mirror, then combine them, you'd arrive at the following.\nfloat hex(in vec2 p){\n \n //return length(p);\n p = abs(p);\n \n // Below is equivalent to:\n return max(p.x*.866025 + p.y*.5, p.y); \n\n //return max(dot(p, s*.5), p.x); // Hexagon.\n \n}\n\n/*\n// More accurate formula, but involves more operations and didn't improve quality by any\n// significant amount, so I've used the estimation below.\nfloat hexPylon(vec2 p2, float pz, float r, float ht){\n\n vec3 p = vec3(p2.x, pz, p2.y);\n \n // Note the \"*1.5\" You need to take the minimum of\n // long-sided rectangles, not squares. Squares will give\n // you a dodecahedron.\n vec3 b = vec3(r*1.5, ht, r); \n \n //p.xz = abs(p.xz);\n //p.xz = vec2(p.x*.866025 + p.z*.5, p.z);\n \n b -= .015;\n //p.xz = r2(-3.14159/3.)*q.xz;\n \tfloat d1 = length(max(abs(p) - b, 0.));\n p.xz = r2(6.2831/3.)*p.xz;\n float d2 = length(max(abs(p) - b, 0.));\n\n p.xz = r2(6.2831/3.)*p.xz;\n float d3 = length(max(abs(p) - b, 0.)); \n return max(max(d1, d2), d3) - .015;\n}\n*/\n\n/*\n// Signed distance to a regular hexagon -- using IQ's more exact method.\nfloat sdHexagon(in vec2 p, in float r){\n \n const vec3 k = vec3(-.8660254, .5, .57735); // pi/6: cos, sin, tan.\n\n // X and Y reflection.\n p = abs(p);\n p -= 2.*min(dot(k.xy, p), 0.)*k.xy;\n \n // Polygon side.\n return length(p - vec2(clamp(p.x, -k.z*r, k.z*r), r))*sign(p.y - r);\n \n}\n\n// IQ's extrusion formula, with a bit of rounding (the .015 bit) thrown in.\nfloat opExtrusion(in float sdf, in float pz, in float h)\n{\n vec2 w = vec2( sdf, abs(pz) - h );\n \treturn min(max(w.x,w.y), 0.) + length(max(w + .015, 0.)) - .015;\n}\n\n// A technically correct hexagonal pylon formual.\nfloat hexPylon(vec2 p2, float pz, float r, float ht){\n \n float hex = sdHexagon(p2, r);\n return opExtrusion(hex, pz, ht);\n}\n*/\n\n// Normally, I'd say this is the hexagonal pylon distance function. However, I should \n// probably make the distinction between a fully bonafide distance function and something\n// that estimates it. This is a bound of sorts. There's not a great deal between it and \n// the real thing, but it does exhibit different behaviour away from the surface, which \n// can affect things like shadows, etc. However, as you can see, in this situation, you\n// can't really tell. I figured I'd mention this, because myself and others use a lot of\n// these kind of functions.\n//\n// By the way, a more exact formula is commented out above.\n//\n// Hexagonal pylon field. There's also defines for a dodecahedron and a cylinder.\nfloat hexPylon(vec2 p2, float pz, float r, float ht){\n\n vec3 p = vec3(p2.x, pz, p2.y);\n vec3 b = vec3(r, ht, r);\n \n \n #if SHAPE == 0\n // Hexagon.\n p.xz = abs(p.xz);\n p.xz = vec2(p.x*.866025 + p.z*.5, p.z);\n // The \".015\" is a subtle rounding factor. Zero gives sharp edges,\n // and larger numbers give a more rounded look.\n \treturn length(max(abs(p) - b + .015, 0.)) - .015;\n #elif SHAPE == 1\n // Dodecahedron.\n p.xz = abs(p.xz);\n p2 = p.xz*.8660254 + p.zx*.5;\n p.xz = vec2(max(p2.x, p2.y), max(p.z, p.x));\n // The \".015\" is a subtle rounding factor. Zero gives sharp edges,\n // and larger numbers give a more rounded look.\n \treturn length(max(abs(p) - b + .015, 0.)) - .015;\n #else\n // Cylinder -- IQ's cylinder function, to be precise, so I think this particular\n // function is a proper distance field.\n p.xy = abs(vec2(length(p.xz), p.y)) - b.xy + .015;\n return min(max(p.x, p.y), 0.) + length(max(p.xy, 0.)) - .015;\n #endif\n \n \n}\n \n\n\n// IDs for the neon lights. Added at the last minute. Identifying things can be tiresome. Individual \n// objects need to be identified, and sometimes, objects within objects need identification too.\n// In this case, there are four pylon groupings. Each pylon object contains a neon light object that \n// is either on or off.\n// \n// If you're seting IDs withing the distance function, they can be lost when calling things like the \n// \"normal\" function, etc. Therefore, you need extra variables to save the IDs directly after calling \n// the trace function. Then there's the matter of ID sorting, which should be done outside the loop... \n// Even with a \"struct,\" or something to that effect, it can still be messy. Having said that, I might \n// start trying to streamline and formalize the process.\nvec4 litID;\nfloat svLitID;\n\n// The pylon and light distance field.\n// Variables in order: p.xz, p.y, radius, height, ID, direction (unused).\nfloat objDist(vec2 p, float pH, float r, float ht, inout float id, float dir){\n \n // Neon light height: Four levels, plus the height is divided by two.\n const float s = 1./16.; //1./4./2.*.5; \n\n // Main hexagon pylon.\n float h1 = hexPylon(p, pH, r, ht);\n \n #ifdef ADD_DETAIL_GROOVE\n // I like this extra detail, but it was a little too expensive.\n\th1 = max(h1, -hexPylon(p, pH + ht, r - .06, s/4.)); // Extra detail.\n #endif\n \n #ifdef ADD_DETAIL_BOLT\n // An alternative extra detail. Also a little on the expensive side.\n h1 = min(h1, hexPylon(p, pH, .1, ht + s/4.)); // Extra detail.\n #endif\n\n \n \n // Thin hexagon slab -- sitting just below the top of the main hexagon. It's\n // lit differently to represent the neon portion.\n float h2 = hexPylon(p, pH + ht - s, r + .01, s/3.);\n \n \n // Opens a space around the neon lit hexagon. Used, if the radius of \"h2\" is\n // less that \"h1,\" which isn't the case here.\n //h1 = smax(h1, -(abs(pH + ht - s) - s/3.), .015);\n \n // Identifying the main hexagon pylon or the neon lit portion.\n id = h1FAR) break;\n \n // Applying some glow. There are probably better ways to go about it, but this\n // will suffice. If the ray passes within \"gd\" units of the neon object, add some\n // distance-based glow.\n const float gd = .1;\n float rnd = getRndID(v2Rnd);\n if(rnd>0. && gLitID == 1. && adFAR) break;\n\n const float gd = .1;\n float rnd = getRndID(vRnd);\n if(rnd>0. && gLitID == 1. && adFAR) break;\n \n t += d;\n }\n \n return min(t, FAR);\n}\n*/\n\n\n// Cheap shadows are hard. In fact, I'd almost say, shadowing repeat objects - in a setting like this - with limited \n// iterations is impossible... However, I'd be very grateful if someone could prove me wrong. :)\nfloat softShadow(vec3 ro, vec3 lp, float k){\n\n // More would be nicer. More is always nicer, but not really affordable.\n const int maxIterationsShad = 32; \n \n vec3 rd = (lp-ro); // Unnormalized direction ray.\n\n float shade = 1.0;\n float dist = 0.01; \n float end = max(length(rd), 0.001);\n float stepDist = end/float(maxIterationsShad);\n \n rd /= end;\n\n // Max shadow iterations - More iterations make nicer shadows, but slow things down. Obviously, the lowest \n // number to give a decent shadow is the best one to choose. \n for (int i=0; i end) break; \n }\n\n // I've added 0.5 to the final shade value, which lightens the shadow a bit. It's a preference thing. \n // Really dark shadows look too brutal to me.\n return min(max(shade, 0.) + .05, 1.); \n}\n\n\n\n// Standard normal function. It's not as fast as the tetrahedral calculation, but more symmetrical. Due to \n// the intricacies of this particular scene, it's kind of needed to reduce jagged effects.\nvec3 getNormal(in vec3 p) {\n\tconst vec2 e = vec2(0.0025, 0);\n\treturn normalize(vec3(map(p + e.xyy) - map(p - e.xyy), map(p + e.yxy) - map(p - e.yxy),\tmap(p + e.yyx) - map(p - e.yyx)));\n}\n\n\n\n/*\n// Tetrahedral normal, to save a couple of \"map\" calls. Courtesy of IQ.\nvec3 getNormal( in vec3 p ){\n\n // Note the slightly increased sampling distance, to alleviate\n // artifacts due to hit point inaccuracies.\n vec2 e = vec2(0.0025, -0.0025); \n return normalize(\n e.xyy * map(p + e.xyy) + \n e.yyx * map(p + e.yyx) + \n e.yxy * map(p + e.yxy) + \n e.xxx * map(p + e.xxx));\n}\n*/\n\n/*\n// Normal calculation, with some edging and curvature bundled in.\nvec3 getNormal(vec3 p, inout float edge, inout float crv, float ef) { \n\t\n // Roughly two pixel edge spread, but increased slightly with larger resolution.\n vec2 e = vec2(ef/mix(450., iResolution.y, .5), 0);\n\n\tfloat d1 = map(p + e.xyy), d2 = map(p - e.xyy);\n\tfloat d3 = map(p + e.yxy), d4 = map(p - e.yxy);\n\tfloat d5 = map(p + e.yyx), d6 = map(p - e.yyx);\n\tfloat d = map(p)*2.;\n\n edge = abs(d1 + d2 - d) + abs(d3 + d4 - d) + abs(d5 + d6 - d);\n //edge = abs(d1 + d2 + d3 + d4 + d5 + d6 - d*3.);\n edge = smoothstep(0., 1., sqrt(edge/e.x*2.));\n\n \n // Wider sample spread for the curvature.\n //e = vec2(12./450., 0);\n\t//d1 = map(p + e.xyy), d2 = map(p - e.xyy);\n\t//d3 = map(p + e.yxy), d4 = map(p - e.yxy);\n\t//d5 = map(p + e.yyx), d6 = map(p - e.yyx);\n //crv = clamp((d1 + d2 + d3 + d4 + d5 + d6 - d*3.)*32. + .5, 0., 1.);\n \t \n \n e = vec2(.0025, 0); //iResolution.y - Depending how you want different resolutions to look.\n\td1 = map(p + e.xyy), d2 = map(p - e.xyy);\n\td3 = map(p + e.yxy), d4 = map(p - e.yxy);\n\td5 = map(p + e.yyx), d6 = map(p - e.yyx);\n\t\n return normalize(vec3(d1 - d2, d3 - d4, d5 - d6));\n}\n*/\n\n// Ambient occlusion, for that self shadowed look.\n// Based on the original by IQ.\nfloat calcAO(in vec3 p, in vec3 n)\n{\n\tfloat sca = 4., occ = 0.0;\n for( int i=1; i<6; i++ ){\n \n float hr = float(i)*.125/5.; \n float dd = map(p + hr*n);\n occ += (hr - dd)*sca;\n sca *= .75;\n }\n return clamp(1. - occ, 0., 1.); \n \n}\n\n\n// Texture bump mapping. Four tri-planar lookups, or 12 texture lookups in total. I tried to\n// make it as concise as possible. Whether that translates to speed, or not, I couldn't say.\nvec3 texBump( sampler2D tx, in vec3 p, in vec3 n, float bf){\n \n const vec2 e = vec2(.001, 0);\n \n // Three gradient vectors rolled into a matrix, constructed with offset greyscale texture values. \n mat3 m = mat3(tex3D(tx, p - e.xyy, n), tex3D(tx, p - e.yxy, n), tex3D(tx, p - e.yyx, n));\n \n vec3 g = vec3(.299, .587, .114)*m; // Converting to greyscale.\n g = (g - dot(tex3D(tx, p , n), vec3(.299, .587, .114)))/e.x; \n \n // Adjusting the tangent vector so that it's perpendicular to the normal -- Thanks to\n // EvilRyu for reminding me why we perform this step. It's been a while, but I vaguely\n // recall that it's some kind of orthogonal space fix using the Gram-Schmidt process. \n // However, all you need to know is that it works. :)\n g -= n*dot(n, g);\n \n return normalize( n + g*bf ); // Bumped normal. \"bf\" - bump factor.\n\t\n}\n\n\n// Very basic pseudo environment mapping... and by that, I mean it's fake. :) However, it \n// does give the impression that the surface is reflecting the surrounds in some way.\n//\n// More sophisticated environment mapping:\n// UI easy to integrate - XT95 \n// https://www.shadertoy.com/view/ldKSDm\nvec3 envMap(vec3 p){\n \n p *= 3.;\n //p.xz += iTime*.5;\n \n float n3D2 = noise3D(p*3.);\n \n // A bit of fBm.\n float c = noise3D(p)*.57 + noise3D(p*2.)*.28 + noise3D(p*4.)*.15;\n c = smoothstep(.25, 1., c); // Putting in some dark space.\n \n p = vec3(c, c*c, c*c*c); // Bluish tinge.\n \n return mix(p, p.zyx, n3D2*.25 + .75); // Mixing in a bit of purple.\n\n}\n\n\nvec3 getObjectColor(vec3 p, vec3 n){\n \n \n //p.xy -= path(p.z);\n float sz0 = 1./2.;\n \n // Texel retrieval.\n vec3 txP = p;\n //txP.xz *= r2(getRndID(svVRnd)*6.2831);\n vec3 col = tex3D(iChannel0, txP*sz0, n );\n col = smoothstep(-.0, .5, col);//*vec3(.5, .8, 1.5);\n col = mix(col, vec3(1)*dot(col, vec3(.299, .587, .114)), .5);\n // Darken the surfaces to bring more attention to the neon lights.\n col /= 16.;\n \n \n // Unique random ID for the hexagon pylon.\n float rnd = getRndID(svV2Rnd);\n \n // Subtly coloring the unlit hexagons... I wasn't feeling it. :)\n //if(svLitID==1. && rnd<=.0) col *= vec3(1, .85, .75)*4.;\n\n // Applying the glow.\n //\n // It's took a while to hit upon the right combination. You can create a cheap lit object \n // effect by simply ramping up the object's color intensity. However, your eyes can tell that\n // it's lacking that volumetric haze. Volumetric haze is achievable via a volumetric appoach.\n // However, it's prone to patchiness. The solutionm, of course, is to combine the smoothness\n // of direct object coloring with a portion of the glow. That's what is happining here.\n\n // Object glow.\n float oGlow = 0.;\n \n // Color every lit object with a gradient based on its vertical positioning.\n if(rnd>0. && svLitID==1.) {\n \n float ht = hexHeight(svV2Rnd);\n \tht = floor(ht*4.99)/4./2. + .02;\n const float s = 1./4./2.*.5; // Four levels, plus the height is divided by two.\n \n oGlow = mix(1., 0., clamp((abs(p.y - (ht - s)))/s*3.*1., 0., 1.));\n oGlow = smoothstep(0., 1., oGlow*1.);\n }\n \n // Mix the object glow in with a small potion of the volumetric glow.\n glow = mix(glow, vec3(oGlow), .75);\n \n // Colorizing the glow, depending on your requirements. I've used a colorful orangey palette,\n // then have modified the single color according to a made up 3D transcental function.\n //glow = pow(vec3(1, 1.05, 1.1)*glow.x, vec3(6, 3, 1));\n glow = pow(vec3(1.5, 1, 1)*glow, vec3(1, 3, 6)); // Mild firey orange.\n glow = mix(glow, glow.xzy, dot(sin(p*4. - cos(p.yzx*4.)), vec3(.166)) + .5); // Mixing in some pink.\n glow = mix(glow, glow.zyx, dot(cos(p*2. - sin(p.yzx*2.)), vec3(.166)) + .5); // Blue tones.\n //glow = mix(glow.zyx, glow, smoothstep(-.1, .1, dot(sin(p + cos(p.yzx)), vec3(.166))));\n \n #ifdef GREEN_GLOW \n glow = glow.yxz;\n #endif\n \n \n return col;\n \n}\n\n\n// Using the hit point, unit direction ray, etc, to color the \n// scene. Diffuse, specular, falloff, etc. It's all pretty \n// standard stuff.\nvec3 doColor(in vec3 sp, in vec3 rd, in vec3 sn, in vec3 lp, in float t){\n \n vec3 sceneCol = vec3(0);\n \n if(t 0.0031308 ? (1.055 * pow(linearColor, 1.0 / 2.4) - 0.055) : (12.92 * linearColor); \n}\n\nvec3 sRGBencode(vec3 linearColor) \n{ \n linearColor = clamp(linearColor, 0.0, 1.0); \n return vec3(sRGBencode(linearColor.x), sRGBencode(linearColor.y), sRGBencode(linearColor.z)); \n}\n\nfloat Star(vec2 uv, float flare)\n{\n float d = length(uv);\n float m = 0.02 / (d + 0.001); // Add tiny number for dividing zero\n float rays = max(0.0, 1.0 - abs(uv.x * uv.y * 200.0)); \n m += rays * flare;\n m *= smoothstep(0.8, 0.05, d); \n return m;\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord)\n{\n vec2 uv = (2.0 * fragCoord - iResolution.xy) / iResolution.y;\n vec3 finalColor = vec3(0.0);\n float currentTime = iTime;\n\n // Camera Setup\n float focalLength = 2.0;\n vec3 rayOrigin = vec3(0.5, 3.8, 0.5 - currentTime); \n vec3 rayDir = normalize(vec3(uv, -focalLength)); \n\n // Camera Rotation Angles\n float pitchAngle = -0.35;\n float cp = cos(pitchAngle), sp = sin(pitchAngle);\n float yawAngle = 0.25 * sin(currentTime * 0.3);\n float cy = cos(yawAngle), sy = sin(yawAngle);\n\n // Apply Rotation to Ray Direction\n rayDir.yz *= mat2(cp, sp, -sp, cp);\n rayDir.xz *= mat2(cy, sy, -sy, cy);\n\n // Calc Camera local axis(right, up) for 3D billboard\n vec3 camRight = vec3(1.0, 0.0, 0.0);\n camRight.yz *= mat2(cp, sp, -sp, cp);\n camRight.xz *= mat2(cy, sy, -sy, cy);\n\n vec3 camUp = vec3(0.0, 1.0, 0.0);\n camUp.yz *= mat2(cp, sp, -sp, cp);\n camUp.xz *= mat2(cy, sy, -sy, cy);\n\n // Raymarching Loop\n float rayDistance = 0.0; \n for(int i = 0; i < MAX_RAY_STEPS; i++)\n {\n vec3 rayPos = rayDir * rayDistance + rayOrigin;\n vec2 gridCell = round(rayPos.xz);\n \n // Change for texture image size\n //ivec2 texCoord = (ivec2(gridCell) % 1024 + 1024) % 1024;\n //vec4 noiseData = texelFetch(iChannel0, texCoord, 0); \n ivec2 texSize = textureSize(iChannel0, 0);\n ivec2 texCoord = (ivec2(gridCell) % texSize + texSize) % texSize;\n vec4 noiseData = texelFetch(iChannel0, texCoord, 0);\n\n float dropHeadY = mod(noiseData.a * 93.0 - currentTime * FALL_SPEED, 45.0);\n \n // Calc tail\n vec3 nearestPointOnLine = vec3(gridCell.x, clamp(rayPos.y, dropHeadY, dropHeadY + TAIL_LENGTH), gridCell.y);\n float distToLine = length(rayPos - nearestPointOnLine);\n \n float tailAttenuation = exp(-max(TAIL_DECAY * (rayPos.y - dropHeadY), 0.0)); \n float tailGlow = tailAttenuation / (abs(distToLine * distToLine) + 0.001); \n\n // Calc cross-flare-head position for billboard\n vec3 headPos = vec3(gridCell.x, dropHeadY, gridCell.y);\n vec3 deltaToHead = rayPos - headPos;\n\n // Project cross-shaped-head from 3d to 2d for billboard\n vec2 flareUV = vec2(dot(deltaToHead, camRight), dot(deltaToHead, camUp));\n \n // Rotate head through time\n float rotSpeed = currentTime * (3.0 + noiseData.b * 2.0);\n float cr = cos(rotSpeed), sr = sin(rotSpeed);\n flareUV *= mat2(cr, sr, -sr, cr);\n \n float headGlow = Star(flareUV * (1.0 / STAR_SIZE), STAR_BRIGHTNESS);\n float depthAttenuation = exp(-0.05 * rayDistance); \n finalColor += depthAttenuation * (tailGlow * 0.5 + headGlow * 15.0) * noiseData.rgb;\n \n rayDistance += min(0.5, distToLine) + 0.01;\n } \n\n finalColor = tanh(finalColor / GLOW_EXPOSURE);\n finalColor = sRGBencode(finalColor);\n fragColor = vec4(finalColor, 1.0);\n}", + "views": 14244, + "likes": 240, + "createdAt": "2026-04-02T01:43:43.091Z", + "sourceFormat": "glsl" + }, + { + "id": "02bd9517-38ba-4392-8fa2-e79abc18eded", + "name": "球体", + "author": "unknown", + "code": "// fur ball\n// (c) simon green 2013\n// @simesgreen\n// v1.1\n\nconst float uvScale = 1.0;\nconst float colorUvScale = 0.1;\nconst float furDepth = 0.2;\nconst int furLayers = 64;\nconst float rayStep = furDepth*2.0 / float(furLayers);\nconst float furThreshold = 0.4;\nconst float shininess = 50.0;\n\nbool intersectSphere(vec3 ro, vec3 rd, float r, out float t)\n{\n\tfloat b = dot(-ro, rd);\n\tfloat det = b*b - dot(ro, ro) + r*r;\n\tif (det < 0.0) return false;\n\tdet = sqrt(det);\n\tt = b - det;\n\treturn t > 0.0;\n}\n\nvec3 rotateX(vec3 p, float a)\n{\n float sa = sin(a);\n float ca = cos(a);\n return vec3(p.x, ca*p.y - sa*p.z, sa*p.y + ca*p.z);\n}\n\nvec3 rotateY(vec3 p, float a)\n{\n float sa = sin(a);\n float ca = cos(a);\n return vec3(ca*p.x + sa*p.z, p.y, -sa*p.x + ca*p.z);\n}\n\nvec2 cartesianToSpherical(vec3 p)\n{\t\t\n\tfloat r = length(p);\n\n\tfloat t = (r - (1.0 - furDepth)) / furDepth;\t\n\tp = rotateX(p.zyx, -cos(iTime*1.5)*t*t*0.4).zyx;\t// curl\n\n\tp /= r;\t\n\tvec2 uv = vec2(atan(p.y, p.x), acos(p.z));\n\n\t//uv.x += cos(iTime*1.5)*t*t*0.4;\t// curl\n\t//uv.y += sin(iTime*1.7)*t*t*0.2;\n\tuv.y -= t*t*0.1;\t// curl down\n\treturn uv;\n}\n\n// returns fur density at given position\nfloat furDensity(vec3 pos, out vec2 uv)\n{\n\tuv = cartesianToSpherical(pos.xzy);\t\n\tvec4 tex = textureLod(iChannel0, uv*uvScale, 0.0);\n\n\t// thin out hair\n\tfloat density = smoothstep(furThreshold, 1.0, tex.x);\n\t\n\tfloat r = length(pos);\n\tfloat t = (r - (1.0 - furDepth)) / furDepth;\n\t\n\t// fade out along length\n\tfloat len = tex.y;\n\tdensity *= smoothstep(len, len-0.2, t);\n\n\treturn density;\t\n}\n\n// calculate normal from density\nvec3 furNormal(vec3 pos, float density)\n{\n float eps = 0.01;\n vec3 n;\n\tvec2 uv;\n n.x = furDensity( vec3(pos.x+eps, pos.y, pos.z), uv ) - density;\n n.y = furDensity( vec3(pos.x, pos.y+eps, pos.z), uv ) - density;\n n.z = furDensity( vec3(pos.x, pos.y, pos.z+eps), uv ) - density;\n return normalize(n);\n}\n\nvec3 furShade(vec3 pos, vec2 uv, vec3 ro, float density)\n{\n\t// lighting\n\tconst vec3 L = vec3(0, 1, 0);\n\tvec3 V = normalize(ro - pos);\n\tvec3 H = normalize(V + L);\n\n\tvec3 N = -furNormal(pos, density);\n\t//float diff = max(0.0, dot(N, L));\n\tfloat diff = max(0.0, dot(N, L)*0.5+0.5);\n\tfloat spec = pow(max(0.0, dot(N, H)), shininess);\n\t\n\t// base color\n\tvec3 color = textureLod(iChannel1, uv*colorUvScale, 0.0).xyz;\n\n\t// darken with depth\n\tfloat r = length(pos);\n\tfloat t = (r - (1.0 - furDepth)) / furDepth;\n\tt = clamp(t, 0.0, 1.0);\n\tfloat i = t*0.5+0.5;\n\t\t\n\treturn color*diff*i + vec3(spec*i);\n}\t\t\n\nvec4 scene(vec3 ro,vec3 rd)\n{\n\tvec3 p = vec3(0.0);\n\tconst float r = 1.0;\n\tfloat t;\t\t\t\t \n\tbool hit = intersectSphere(ro - p, rd, r, t);\n\t\n\tvec4 c = vec4(0.0);\n\tif (hit) {\n\t\tvec3 pos = ro + rd*t;\n\n\t\t// ray-march into volume\n\t\tfor(int i=0; i 0.0) {\n\t\t\t\tsampleCol.rgb = furShade(pos, uv, ro, sampleCol.a);\n\n\t\t\t\t// pre-multiply alpha\n\t\t\t\tsampleCol.rgb *= sampleCol.a;\n\t\t\t\tc = c + sampleCol*(1.0 - c.a);\n\t\t\t\tif (c.a > 0.95) break;\n\t\t\t}\n\t\t\t\n\t\t\tpos += rd*rayStep;\n\t\t}\n\t}\n\t\n\treturn c;\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n\tvec2 uv = fragCoord.xy / iResolution.xy;\n\tuv = uv*2.0-1.0;\n\tuv.x *= iResolution.x / iResolution.y;\n\t\n\tvec3 ro = vec3(0.0, 0.0, 2.5);\n\tvec3 rd = normalize(vec3(uv, -2.0));\n\t\n\tvec2 mouse = iMouse.xy / iResolution.xy;\n\tfloat roty = 0.0;\n\tfloat rotx = 0.0;\n\tif (iMouse.z > 0.0) {\n\t\trotx = (mouse.y-0.5)*3.0;\n\t\troty = -(mouse.x-0.5)*6.0;\n\t} else {\n\t\troty = sin(iTime*1.5);\n\t}\n\t\n ro = rotateX(ro, rotx);\t\n ro = rotateY(ro, roty);\t\n rd = rotateX(rd, rotx);\n rd = rotateY(rd, roty);\n\t\n\tfragColor = scene(ro, rd);\n}", + "views": 19672, + "likes": 529, + "createdAt": "2026-04-02T01:40:46.648Z", + "sourceFormat": "glsl" + }, + { + "id": "29c5453f-5a8b-4995-a4a7-c8379e2d50e9", + "name": "齿轮", + "author": "unknown", + "code": "// Copyright Inigo Quilez, 2019 - https://iquilezles.org/\n// I am the sole copyright owner of this Work. You cannot\n// host, display, distribute or share this Work neither as\n// is or altered, in any form including physical and\n// digital. You cannot use this Work in any commercial or\n// non-commercial product, website or project. You cannot\n// sell this Work and you cannot mint an NFTs of it. You\n// cannot use this Work to train AI models. I share this\n// Work for educational purposes, you can link to it as\n// an URL, proper attribution and unmodified screenshot,\n// as part of your educational material. If these\n// conditions are too restrictive please contact me.\n\n// Basically the same as https://www.shadertoy.com/view/XlVcWz\n// but optimized through symmetry so it only needs to evaluate\n// four gears instead of 18. Also I made the gears with actual\n// boxes rather than displacements, which creates an exact SDF\n// allowing me to raymarch the scene at the speed of light, or\n// in other words, without reducing the raymarching step size.\n// Also I'm using a bounding volume to speed things up further\n// so I can affor some nice ligthing and motion blur.\n//\n// Live streamed tutorial on this shader:\n// PART 1: https://www.youtube.com/watch?v=sl9x19EnKng\n// PART 2: https://www.youtube.com/watch?v=bdICU2uvOdU\n//\n// Video capture here: https://www.youtube.com/watch?v=ydTVmDBSGYQ\n//\n#if HW_PERFORMANCE==0\n#define AA 1\n#else\n#define AA 2 // Set AA to 1 if your machine is too slow\n#endif\n\n\n// https://iquilezles.org/articles/smin\nfloat smax( float a, float b, float k )\n{\n float h = max(k-abs(a-b),0.0);\n return max(a, b) + h*h*0.25/k;\n}\n\n// https://iquilezles.org/articles/distfunctions\nfloat sdSphere( in vec3 p, in float r )\n{\n return length(p)-r;\n}\n\nfloat sdVerticalSemiCapsule( vec3 p, float h, float r )\n{\n p.y = max(p.y-h,0.0);\n return length( p ) - r;\n}\n\n// https://iquilezles.org/articles/distfunctions2d\nfloat sdCross( in vec2 p, in vec2 b, float r ) \n{\n p = abs(p); p = (p.y>p.x) ? p.yx : p.xy;\n \n\tvec2 q = p - b;\n float k = max(q.y,q.x);\n vec2 w = (k>0.0) ? q : vec2(b.y-p.x,-k);\n \n return sign(k)*length(max(w,0.0)) + r;\n}\n\n// https://www.shadertoy.com/view/MlycD3\nfloat dot2( in vec2 v ) { return dot(v,v); }\nfloat sdTrapezoid( in vec2 p, in float r1, float r2, float he )\n{\n vec2 k1 = vec2(r2,he);\n vec2 k2 = vec2(r2-r1,2.0*he);\n\n\tp.x = abs(p.x);\n vec2 ca = vec2(max(0.0,p.x-((p.y<0.0)?r1:r2)), abs(p.y)-he);\n vec2 cb = p - k1 + k2*clamp( dot(k1-p,k2)/dot2(k2), 0.0, 1.0 );\n \n float s = (cb.x < 0.0 && ca.y < 0.0) ? -1.0 : 1.0;\n \n return s*sqrt( min(dot2(ca),dot2(cb)) );\n}\n\n// https://iquilezles.org/articles/intersectors\nvec2 iSphere( in vec3 ro, in vec3 rd, in float rad )\n{\n\tfloat b = dot( ro, rd );\n\tfloat c = dot( ro, ro ) - rad*rad;\n\tfloat h = b*b - c;\n\tif( h<0.0 ) return vec2(-1.0);\n h = sqrt(h);\n\treturn vec2(-b-h, -b+h );\n}\n\n//----------------------------------\n\nfloat dents( in vec2 q, in float tr, in float y )\n{\n const float an = 6.283185/12.0;\n float fa = (atan(q.y,q.x)+an*0.5)/an;\n float sym = an*floor(fa);\n vec2 r = mat2(cos(sym),-sin(sym), sin(sym), cos(sym))*q;\n \n#if 1\n float d = length(max(abs(r-vec2(0.17,0))-tr*vec2(0.042,0.041*y),0.0));\n#else\n float d = sdTrapezoid( r.yx-vec2(0.0,0.17), 0.085*y, 0.028*y, tr*0.045 );\n#endif\n\n\treturn d - 0.005*tr;\n}\n\nvec4 gear(vec3 q, float off, float time)\n{\n {\n float an = 2.0*time*sign(q.y) + off*6.283185/24.0;\n float co = cos(an), si = sin(an);\n q.xz = mat2(co,-si,si,co)*q.xz;\n }\n \n q.y = abs(q.y);\n \n float an2 = 2.0*min(1.0-2.0*abs(fract(0.5+time/10.0)-0.5),1.0/2.0);\n vec3 tr = min( 10.0*an2 - vec3(4.0,6.0,8.0),1.0);\n \n // ring\n float d = abs(length(q.xz) - 0.155*tr.y) - 0.018;\n\n // add dents\n float r = length(q);\n d = min( d, dents(q.xz,tr.z, r) );\n\n \n // slice it\n float de = -0.0015*clamp(600.0*abs(dot(q.xz,q.xz)-0.155*0.155),0.0,1.0);\n d = smax( d, abs(r-0.5)-0.03+de, 0.005*tr.z );\n\n // add cross\n float d3 = sdCross( q.xz, vec2(0.15,0.022)*tr.y, 0.02*tr.y );\n vec2 w = vec2( d3, abs(q.y-0.485)-0.005*tr.y );\n d3 = min(max(w.x,w.y),0.0) + length(max(w,0.0))-0.003*tr.y;\n d = min( d, d3 ); \n \n // add pivot\n d = min( d, sdVerticalSemiCapsule( q, 0.5*tr.x, 0.01 ));\n\n // base\n d = min( d, sdSphere(q-vec3(0.0,0.12,0.0),0.025) );\n \n return vec4(d,q.xzy);\n}\n\nvec2 rot( vec2 v )\n{\n return vec2(v.x-v.y,v.y+v.x)*0.707107;\n}\n \nvec4 map( in vec3 p, float time )\n{\n // center sphere\n vec4 d = vec4( sdSphere(p,0.12), p );\n \n // gears. There are 18, but we only evaluate 4 \n vec3 qx = vec3(rot(p.zy),p.x); if(abs(qx.x)>abs(qx.y)) qx=qx.zxy;\n vec3 qy = vec3(rot(p.xz),p.y); if(abs(qy.x)>abs(qy.y)) qy=qy.zxy;\n vec3 qz = vec3(rot(p.yx),p.z); if(abs(qz.x)>abs(qz.y)) qz=qz.zxy;\n vec3 qa = abs(p); qa = (qa.x>qa.y && qa.x>qa.z) ? p.zxy : \n (qa.z>qa.y ) ? p.yzx :\n p.xyz;\n vec4 t;\n t = gear( qa,0.0,time ); if( t.x>1)&1),((i>>1)&1),(i&1))-1.0);\n n += e*map(pos+0.0005*e,time).x;\n }\n return normalize(n);\n#endif \n}\n\nfloat calcAO( in vec3 pos, in vec3 nor, in float time )\n{\n\tfloat occ = 0.0;\n float sca = 1.0;\n for( int i=ZERO; i<5; i++ )\n {\n float h = 0.01 + 0.12*float(i)/4.0;\n float d = map( pos+h*nor, time ).x;\n occ += (h-d)*sca;\n sca *= 0.95;\n }\n return clamp( 1.0 - 3.0*occ, 0.0, 1.0 );\n}\n\n// https://iquilezles.org/articles/rmshadows\nfloat calcSoftshadow( in vec3 ro, in vec3 rd, in float k, in float time )\n{\n float res = 1.0;\n \n // bounding sphere\n vec2 b = iSphere( ro, rd, 0.535 );\n\tif( b.y>0.0 )\n {\n // raymarch\n float tmax = b.y;\n float t = max(b.x,0.001);\n for( int i=0; i<64; i++ )\n {\n float h = map( ro + rd*t, time ).x;\n res = min( res, k*h/t );\n t += clamp( h, 0.012, 0.2 );\n if( res<0.001 || t>tmax ) break;\n }\n }\n \n return clamp( res, 0.0, 1.0 );\n}\n\nvec4 intersect( in vec3 ro, in vec3 rd, in float time )\n{\n vec4 res = vec4(-1.0);\n \n // bounding sphere\n vec2 tminmax = iSphere( ro, rd, 0.535 );\n\tif( tminmax.y>0.0 )\n {\n // raymarch\n float t = max(tminmax.x,0.001);\n for( int i=0; i<128 && t1\n for( int m=ZERO; m0.0 )\n {\n // shading/lighting\t\n vec3 pos = ro + tuvw.x*rd;\n vec3 nor = calcNormal(pos, time);\n \n vec3 te = 0.5*texture( iChannel0, tuvw.yz*2.0 ).xyz+\n 0.5*texture( iChannel0, tuvw.yw*1.0 ).xyz;\n \n vec3 mate = 0.22*te;\n float len = length(pos);\n \n mate *= 1.0 + vec3(2.0,0.5,0.0)*(1.0-smoothstep(0.121,0.122,len) ) ;\n \n float focc = 0.1+0.9*clamp(0.5+0.5*dot(nor,pos/len),0.0,1.0);\n focc *= 0.1+0.9*clamp(len*2.0,0.0,1.0);\n float ks = clamp(te.x*1.5,0.0,1.0);\n vec3 f0 = mate;\n float kd = (1.0-ks)*0.125;\n \n float occ = calcAO( pos, nor, time ) * focc;\n \n col = vec3(0.0);\n \n // side\n {\n vec3 lig = normalize(vec3(0.8,0.2,0.6));\n float dif = clamp( dot(nor,lig), 0.0, 1.0 );\n vec3 hal = normalize(lig-rd);\n float sha = 1.0; if( dif>0.001 ) sha = calcSoftshadow( pos+0.001*nor, lig, 20.0, time );\n vec3 spe = pow(clamp(dot(nor,hal),0.0,1.0),16.0)*(f0+(1.0-f0)*pow(clamp(1.0+dot(hal,rd),0.0,1.0),5.0));\n col += kd*mate*2.0*vec3(1.00,0.70,0.50)*dif*sha;\n col += ks* 2.0*vec3(1.00,0.80,0.70)*dif*sha*spe*3.14;\n }\n\n // top\n {\n vec3 ref = reflect(rd,nor);\n float fre = clamp(1.0+dot(nor,rd),0.0,1.0);\n float sha = occ;\n col += kd*mate*25.0*vec3(0.19,0.22,0.24)*(0.6 + 0.4*nor.y)*sha;\n col += ks* 25.0*vec3(0.19,0.22,0.24)*sha*smoothstep( -1.0+1.5*focc, 1.0-0.4*focc, ref.y ) * (f0 + (1.0-f0)*pow(fre,5.0));\n }\n \n // bottom\n {\n float dif = clamp(0.4-0.6*nor.y,0.0,1.0);\n col += kd*mate*5.0*vec3(0.25,0.20,0.15)*dif*occ;\n }\n }\n \n // compress \n // col = 1.2*col/(1.0+col);\n \n // vignetting\n col *= 1.0-0.1*dot(p,p);\n \n // gamma \n\t tot += pow(col,vec3(0.45) );\n #if AA>1\n }\n tot /= float(AA*AA);\n #endif\n\n // s-curve \n tot = min(tot,1.0);\n tot = tot*tot*(3.0-2.0*tot);\n \n // cheap dithering\n tot += sin(fragCoord.x*114.0)*sin(fragCoord.y*211.1)/512.0;\n\n fragColor = vec4( tot, 1.0 );\n}", + "views": 16421, + "likes": 420, + "createdAt": "2026-04-02T01:39:56.715Z", + "sourceFormat": "glsl" + }, + { + "id": "a8016745-d7ae-4fb3-ada9-0573e9fc213b", + "name": "点云", + "author": "unknown", + "code": "const float PI = acos(-1.);\nconst float LAYER_DISTANCE = 5.;\n\nconst vec3 BLUE = vec3(47, 75, 162) / 255.; \nconst vec3 PINK = vec3(233, 71, 245) / 255.;\nconst vec3 PURPLE = vec3(128, 63, 224) / 255.;\nconst vec3 CYAN = vec3(61, 199, 220) / 255.;\nconst vec3 MAGENTA = vec3(222, 51, 150) / 255.;\nconst vec3 LIME = vec3(160, 220, 70) / 255.;\nconst vec3 ORANGE = vec3(245, 140, 60) / 255.;\nconst vec3 TEAL = vec3(38, 178, 133) / 255.;\nconst vec3 RED = vec3(220, 50, 50) / 255.; \nconst vec3 YELLOW = vec3(240, 220, 80) / 255.;\nconst vec3 VIOLET = vec3(180, 90, 240) / 255.;\nconst vec3 AQUA = vec3(80, 210, 255) / 255.;\nconst vec3 FUCHSIA = vec3(245, 80, 220) / 255.;\nconst vec3 GREEN = vec3(70, 200, 100) / 255.;\n\nconst int NUM_COLORS = 14;\nconst vec3 COLS[NUM_COLORS] = vec3[](\n BLUE,\n PINK,\n PURPLE,\n CYAN,\n MAGENTA,\n LIME,\n ORANGE,\n TEAL,\n RED,\n YELLOW,\n VIOLET,\n AQUA,\n FUCHSIA,\n GREEN\n);\n\n// t within the range [0, 1]\nvec3 get_color(float t) {\n float scaledT = t * float(NUM_COLORS - 1);\n\n float curr = floor(scaledT);\n float next = min(curr + 1., float(NUM_COLORS) - 1.);\n\n float localT = scaledT - curr;\n return mix(COLS[int(curr)], COLS[int(next)], localT);\n}\n\n// https://www.shadertoy.com/view/4djSRW\nvec4 hash41(float p)\n{\n\tvec4 p4 = fract(vec4(p) * vec4(.1031, .1030, .0973, .1099));\n p4 += dot(p4, p4.wzxy+33.33);\n return fract((p4.xxyz+p4.yzzw)*p4.zywx);\n \n}\n\nfloat get_height(vec2 id, float layer) {\n float t = iTime;\n\n vec4 h = hash41(layer)*1000.;\n\n float o = 0.;\n o += sin(( id.x+h.x) *.2 + t)*.3;\n o += sin(( id.y+h.y) *.2 + t)*.3;\n o += sin((-id.x+id.y+h.z)*.3 + t)*.3;\n o += sin(( id.x+id.y+h.z)*.3 + t)*.4;\n o += sin(( id.x-id.y+h.w)*.8 + t)*.1;\n\n return o;\n}\n\nmat2x2 rotate(float r) {\n return mat2x2(cos(r), -sin(r), sin(r), cos(r));\n}\n\nfloat sdSphere(vec3 p, float r) {\n return length(p) - r;\n}\n\nfloat map(vec3 p) {\n float t = iTime;\n const float xz = .3;\n vec3 s = vec3(xz, LAYER_DISTANCE, xz);\n vec3 id = round(p / s);\n\n float ho = get_height(id.xz, id.y);\n p.y += ho;\n p -= s*id;\n return sdSphere(p, smoothstep(1.3, -1.3, ho)*.03+.0001);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n float seed = iDate.x + iDate.y + iDate.z + iDate.w;\n float t = iTime;\n vec3 col = vec3(0.);\n vec2 uv = (2. * gl_FragCoord.xy - iResolution.xy) / iResolution.y;\n uv.y *= -1.;\n\n float phase = t*.2;\n float y = sin(phase);\n float ny = smoothstep(-1., 1., y);\n vec3 c = get_color(mod((t + seed)/float(NUM_COLORS), 5.*2.*PI)/(5.*2.*PI));\n \n vec3 ro = vec3(0., y*LAYER_DISTANCE*.5, -t);\n vec3 rd = normalize(vec3(uv, -1.));\n\n rd.xy *= rotate(-ny*PI);\n rd.xz *= rotate(sin(t*.5)*.4);\n \n float d = 0.;\n for (int i = 0; i < 30; ++i) {\n vec3 p = ro + rd *d;\n\n float dt = map(p);\n dt = max(dt*(cos(ny*PI*2.)*.3+.5), 1e-3);\n\n col += (.1 / dt) * c;\n d += dt*.8;\n }\n\n col = tanh(col * .01);\n\n fragColor = vec4(col, 1.);\n}", + "views": 22975, + "likes": 583, + "createdAt": "2026-04-02T01:37:37.687Z", + "sourceFormat": "glsl" + }, + { + "id": "0d1722d9-c2f6-4d69-8a97-31e5baba1975", + "name": "火焰", + "author": "unknown", + "code": "// \"Volumetric explosion\" by Duke\n// https://www.shadertoy.com/view/lsySzd\n//-------------------------------------------------------------------------------------\n// Based on \"Supernova remnant\" (https://www.shadertoy.com/view/MdKXzc) \n// and other previous shaders \n// otaviogood's \"Alien Beacon\" (https://www.shadertoy.com/view/ld2SzK)\n// and Shane's \"Cheap Cloud Flythrough\" (https://www.shadertoy.com/view/Xsc3R4) shaders\n// Some ideas came from other shaders from this wonderful site\n// Press 1-2-3 to zoom in and zoom out.\n// License: Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License\n//-------------------------------------------------------------------------------------\n\n// comment this string to see each part in full screen\n#define BOTH\n// uncomment this string to see left part\n//#define LEFT\n\n//#define LOW_QUALITY\n\n#define DITHERING\n\n//#define TONEMAPPING\n\n//-------------------\n#define pi 3.14159265\n#define R(p, a) p=cos(a)*p+sin(a)*vec2(p.y, -p.x)\n\n// iq's noise\nfloat noise( in vec3 x )\n{\n vec3 p = floor(x);\n vec3 f = fract(x);\n\tf = f*f*(3.0-2.0*f);\n\tvec2 uv = (p.xy+vec2(37.0,17.0)*p.z) + f.xy;\n\tvec2 rg = textureLod( iChannel0, (uv+ 0.5)/256.0, 0.0 ).yx;\n\treturn 1. - 0.82*mix( rg.x, rg.y, f.z );\n}\n\nfloat fbm( vec3 p )\n{\n return noise(p*.06125)*.5 + noise(p*.125)*.25 + noise(p*.25)*.125 + noise(p*.4)*.2;\n}\n\nfloat Sphere( vec3 p, float r )\n{\n return length(p)-r;\n}\n\n//==============================================================\n// otaviogood's noise from https://www.shadertoy.com/view/ld2SzK\n//--------------------------------------------------------------\n// This spiral noise works by successively adding and rotating sin waves while increasing frequency.\n// It should work the same on all computers since it's not based on a hash function like some other noises.\n// It can be much faster than other noise functions if you're ok with some repetition.\nconst float nudge = 4.;\t// size of perpendicular vector\nfloat normalizer = 1.0 / sqrt(1.0 + nudge*nudge);\t// pythagorean theorem on that perpendicular to maintain scale\nfloat SpiralNoiseC(vec3 p)\n{\n float n = -mod(iTime * 0.2,-2.); // noise amount\n float iter = 2.0;\n for (int i = 0; i < 8; i++)\n {\n // add sin and cos scaled inverse with the frequency\n n += -abs(sin(p.y*iter) + cos(p.x*iter)) / iter;\t// abs for a ridged look\n // rotate by adding perpendicular and scaling down\n p.xy += vec2(p.y, -p.x) * nudge;\n p.xy *= normalizer;\n // rotate on other axis\n p.xz += vec2(p.z, -p.x) * nudge;\n p.xz *= normalizer;\n // increase the frequency\n iter *= 1.733733;\n }\n return n;\n}\n\nfloat VolumetricExplosion(vec3 p)\n{\n float final = Sphere(p,4.);\n #ifdef LOW_QUALITY\n final += noise(p*12.5)*.2;\n #else\n final += fbm(p*50.);\n #endif\n final += SpiralNoiseC(p.zxy*0.4132+333.)*3.0; //1.25;\n\n return final;\n}\n\nfloat map(vec3 p) \n{\n\tR(p.xz, iMouse.x*0.008*pi+iTime*0.1);\n\n\tfloat VolExplosion = VolumetricExplosion(p/0.5)*0.5; // scale\n \n\treturn VolExplosion;\n}\n//--------------------------------------------------------------\n\n// assign color to the media\nvec3 computeColor( float density, float radius )\n{\n\t// color based on density alone, gives impression of occlusion within\n\t// the media\n\tvec3 result = mix( vec3(1.0,0.9,0.8), vec3(0.4,0.15,0.1), density );\n\t\n\t// color added to the media\n\tvec3 colCenter = 7.*vec3(0.8,1.0,1.0);\n\tvec3 colEdge = 1.5*vec3(0.48,0.53,0.5);\n\tresult *= mix( colCenter, colEdge, min( (radius+.05)/.9, 1.15 ) );\n\t\n\treturn result;\n}\n\nbool RaySphereIntersect(vec3 org, vec3 dir, out float near, out float far)\n{\n\tfloat b = dot(dir, org);\n\tfloat c = dot(org, org) - 8.;\n\tfloat delta = b*b - c;\n\tif( delta < 0.0) \n\t\treturn false;\n\tfloat deltasqrt = sqrt(delta);\n\tnear = -b - deltasqrt;\n\tfar = -b + deltasqrt;\n\treturn far > 0.0;\n}\n\n// Applies the filmic curve from John Hable's presentation\n// More details at : http://filmicgames.com/archives/75\nvec3 ToneMapFilmicALU(vec3 _color)\n{\n\t_color = max(vec3(0), _color - vec3(0.004));\n\t_color = (_color * (6.2*_color + vec3(0.5))) / (_color * (6.2 * _color + vec3(1.7)) + vec3(0.06));\n\treturn _color;\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{ \n const float KEY_1 = 49.5/256.0;\n\tconst float KEY_2 = 50.5/256.0;\n\tconst float KEY_3 = 51.5/256.0;\n float key = 0.0;\n key += 0.7*texture(iChannel1, vec2(KEY_1,0.25)).x;\n key += 0.7*texture(iChannel1, vec2(KEY_2,0.25)).x;\n key += 0.7*texture(iChannel1, vec2(KEY_3,0.25)).x;\n\n vec2 uv = fragCoord/iResolution.xy;\n \n\t// ro: ray origin\n\t// rd: direction of the ray\n\tvec3 rd = normalize(vec3((fragCoord.xy-0.5*iResolution.xy)/iResolution.y, 1.));\n\tvec3 ro = vec3(0., 0., -6.+key*1.6);\n \n\t// ld, td: local, total density \n\t// w: weighting factor\n\tfloat ld=0., td=0., w=0.;\n\n\t// t: length of the ray\n\t// d: distance function\n\tfloat d=1., t=0.;\n \n const float h = 0.1;\n \n\tvec4 sum = vec4(0.0);\n \n float min_dist=0.0, max_dist=0.0;\n\n if(RaySphereIntersect(ro, rd, min_dist, max_dist))\n {\n \n\tt = min_dist*step(t,min_dist);\n \n\t// raymarch loop\n #ifdef LOW_QUALITY\n\tfor (int i=0; i<56; i++)\n #else\n for (int i=0; i<86; i++)\n #endif\n\t{\n\t \n\t\tvec3 pos = ro + t*rd;\n \n\t\t// Loop break conditions.\n\t if(td>0.9 || d<0.12*t || t>10. || sum.a > 0.99 || t>max_dist) break;\n \n // evaluate distance function\n float d = map(pos);\n \n #ifdef BOTH\n /*\n if (uv.x<0.5)\n {\n d = abs(d)+0.07;\n }\n */\n //split screen variant\n //d = uv.x < 0.5 ? abs(d)+0.07 : d;\n \n d = cos(iTime)*uv.x < 0.1 ? abs(d)+0.07 : d;\n #else\n #ifdef LEFT\n d = abs(d)+0.07;\n #endif\n\t\t#endif\n \n\t\t// change this string to control density \n\t\td = max(d,0.03);\n \n // point light calculations\n vec3 ldst = vec3(0.0)-pos;\n float lDist = max(length(ldst), 0.001);\n\n // the color of light \n vec3 lightColor=vec3(1.0,0.5,0.25);\n \n sum.rgb+=(lightColor/exp(lDist*lDist*lDist*.08)/30.); // bloom\n \n\t\tif (deps )\n\t\t{\n\t\t\tif(flame(p) < .0)\n\t\t\t\tglowed=true;\n\t\t\tif(glowed)\n \t\t\tglow = float(i)/64.;\n\t\t}\n\t}\n\treturn vec4(p,glow);\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n\tvec2 v = -1.0 + 2.0 * fragCoord.xy / iResolution.xy;\n\tv.x *= iResolution.x/iResolution.y;\n\t\n\tvec3 org = vec3(0., -2., 4.);\n\tvec3 dir = normalize(vec3(v.x*1.6, -v.y, -1.5));\n\t\n\tvec4 p = raymarch(org, dir);\n\tfloat glow = p.w;\n\t\n\tvec4 col = mix(vec4(1.,.5,.1,1.), vec4(0.1,.5,1.,1.), p.y*.02+.4);\n\t\n\tfragColor = mix(vec4(0.), col, pow(glow*2.,4.));\n\t//fragColor = mix(vec4(1.), mix(vec4(1.,.5,.1,1.),vec4(0.1,.5,1.,1.),p.y*.02+.4), pow(glow*2.,4.));\n\n}", + "views": 23256, + "likes": 84, + "createdAt": "2026-04-01T16:01:12.555Z", + "sourceFormat": "glsl" + }, + { + "id": "40cdf4d1-62fb-43fb-9891-3e7d4dc3c641", + "name": "星云1", + "author": "unknown", + "code": "// Playing with https://x.com/YoheiNishitsuji/status/1918213871375892638\n\n// You should probably listen to something like this while watching ^_^\n// https://www.youtube.com/watch?v=FtukH_bCDHg\n\nfloat sRGBencode(float C_linear) { return C_linear > 0.0031308 ? (1.055 * pow(C_linear, 1./2.4) - 0.055) : (12.92 * C_linear); }\nvec3 sRGBencode(vec3 C_linear) { C_linear = clamp(C_linear, 0., 1.); return vec3(sRGBencode(C_linear.x), sRGBencode(C_linear.y), sRGBencode(C_linear.z)); }\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n \n vec3 color = texelFetch(iChannel0, ivec2(fragCoord), 0).rgb;\n vec2 uv = (2. * fragCoord.xy- iResolution.xy)/iResolution.y;\n color *= 1.-.05*dot(uv,uv);\n color = 1.-exp(-9.*pow(color, vec3(3.35)));\n color = sRGBencode(color);\n fragColor = vec4(color, 1);\n}", + "views": 12044, + "likes": 244, + "createdAt": "2026-04-01T16:00:02.916Z", + "sourceFormat": "glsl" + }, + { + "id": "82ac512b-f051-42d1-b3cc-bd2f6d92fdb2", + "name": "流光", + "author": "unknown", + "code": "#define A 9. // amplitude\n#define T (iTime/3e2)\n#define H(a) (cos(radians(vec3(180, 90, 0))+(a)*6.2832)*.5+.5) // hue\n\nfloat map(vec3 u, float v) // sdf\n{\n float t = T, // speed\n l = 5., // loop to reduce clipping\n f = 1e10, i = 0., y, z;\n \n u.xy = vec2(atan(u.x, u.y), length(u.xy)); // polar transform\n u.x += t*v*3.1416*.7; // counter rotation\n \n for (; i++ 1e3) break;\n }\n \n c += texture(iChannel0, u*d +o).rrr * vec3(0, .4, s)*s*z*.03; // wavy aqua\n c += min(exp(-p.z -f*A)*z*k*.01/s, 1.); // light tips\n \n j = p.xy/v +m; // 2d coords\n c /= clamp(dot(j, j)*4., .04, 4.); // brightness\n \n C = vec4(exp(log(c)/2.2), 1);\n}", + "views": 19147, + "likes": 521, + "createdAt": "2026-04-01T15:58:19.514Z", + "sourceFormat": "glsl" + }, + { + "id": "e25336ee-9857-47b8-b5da-a87267dc6aad", + "name": "天际", + "author": "unknown", + "code": "/*\n Mostly just playing with nimitz' triangle noise, thought it came out nice.\n \n Yeah, it's *another* cloud shader :D\n\n See nimitz' \"Oblivion\" for the triangle noise source, I tweaked it a bit for this iirc.\n\n https://www.shadertoy.com/view/XtX3DH\n \n*/\n\n#define T iTime\n#define R(a) mat2(cos(a+vec4(0,33,11,0)))\n#define N normalize\n\nfloat tri(in float x){return abs(fract(x)-.5);}\nvec3 tri3(in vec3 p){return vec3( tri(p.z+tri(p.y*1.)), tri(p.z+tri(p.x*1.)), tri(p.y+tri(p.x*1.)));} \n\nfloat triNoise3d(vec3 p)\n{\n p.z += T/4e1;\n float z=1.5;\n\tfloat rz = 0.;\n vec3 bp = p;\n mat2 m2 = R(.3);\n\tfor (float i=0.; i<=3.; i++ )\n\t{\n vec3 dg = tri3(bp*2.)*1.;\n p += (dg+T/3e1);\n\n bp *= 2.;\n\t\tz *= 1.75;\n\t\tp *= 1.1;\n p.yz*= m2;\n \n rz+= (tri(p.z+tri(p.x+tri(p.y))))/z;\n bp += .2;\n\t}\n\treturn rz;\n}\n\nvoid mainImage(out vec4 o, vec2 u) {\n float a,i,s,d;\n vec3 p = iResolution; \n \n vec3 D = N(vec3(u = (u+u-p.xy)/p.y, 1));\n for(o*=i; i++<1e2;\n d += s = .1+.4*abs(s),\n o += 6.*(1.+cos(T/2.+.1*i+vec4(5,4,3,0)))/s\n + .5*vec4(1,2,4,0)/abs(1.01+u.y-cos(u.x/3.3))\n + 4.*vec4(6,2,1,0)/length(u*2.)\n )\n p = D*d,\n p.y+=2.5,\n s = 6. - abs(p.y-cos(p.x/3e1)*4.),\n s -= 7.*triNoise3d(p/3e1);\n\n o = tanh(o/5e3*exp(1e2*vec4(5,2,1,0)/d/d));\n}", + "views": 10493, + "likes": 103, + "createdAt": "2026-04-01T15:57:36.080Z", + "sourceFormat": "glsl" + }, + { + "id": "d6942ee2-97be-4d9d-bfaf-c0fde0558de0", + "name": "气泡", + "author": "unknown", + "code": "// noise from https://www.shadertoy.com/view/4sc3z2\nvec3 hash33(vec3 p3)\n{\n\tp3 = fract(p3 * vec3(.1031,.11369,.13787));\n p3 += dot(p3, p3.yxz+19.19);\n return -1.0 + 2.0 * fract(vec3(p3.x+p3.y, p3.x+p3.z, p3.y+p3.z)*p3.zyx);\n}\nfloat snoise3(vec3 p)\n{\n const float K1 = 0.333333333;\n const float K2 = 0.166666667;\n \n vec3 i = floor(p + (p.x + p.y + p.z) * K1);\n vec3 d0 = p - (i - (i.x + i.y + i.z) * K2);\n \n vec3 e = step(vec3(0.0), d0 - d0.yzx);\n\tvec3 i1 = e * (1.0 - e.zxy);\n\tvec3 i2 = 1.0 - e.zxy * (1.0 - e);\n \n vec3 d1 = d0 - (i1 - K2);\n vec3 d2 = d0 - (i2 - K1);\n vec3 d3 = d0 - 0.5;\n \n vec4 h = max(0.6 - vec4(dot(d0, d0), dot(d1, d1), dot(d2, d2), dot(d3, d3)), 0.0);\n vec4 n = h * h * h * h * vec4(dot(d0, hash33(i)), dot(d1, hash33(i + i1)), dot(d2, hash33(i + i2)), dot(d3, hash33(i + 1.0)));\n \n return dot(vec4(31.316), n);\n}\n\nvec4 extractAlpha(vec3 colorIn)\n{\n vec4 colorOut;\n float maxValue = min(max(max(colorIn.r, colorIn.g), colorIn.b), 1.0);\n if (maxValue > 1e-5)\n {\n colorOut.rgb = colorIn.rgb * (1.0 / maxValue);\n colorOut.a = maxValue;\n }\n else\n {\n colorOut = vec4(0.0);\n }\n return colorOut;\n}\n\n#define BG_COLOR (vec3(sin(iTime)*0.5+0.5) * 0.0 + vec3(0.0))\n#define time iTime\nconst vec3 color1 = vec3(0.611765, 0.262745, 0.996078);\nconst vec3 color2 = vec3(0.298039, 0.760784, 0.913725);\nconst vec3 color3 = vec3(0.062745, 0.078431, 0.600000);\nconst float innerRadius = 0.6;\nconst float noiseScale = 0.65;\n\nfloat light1(float intensity, float attenuation, float dist)\n{\n return intensity / (1.0 + dist * attenuation);\n}\nfloat light2(float intensity, float attenuation, float dist)\n{\n return intensity / (1.0 + dist * dist * attenuation);\n}\n\nvoid draw( out vec4 _FragColor, in vec2 vUv )\n{\n vec2 uv = vUv;\n float ang = atan(uv.y, uv.x);\n float len = length(uv);\n float v0, v1, v2, v3, cl;\n float r0, d0, n0;\n float r, d;\n \n // ring\n n0 = snoise3( vec3(uv * noiseScale, time * 0.5) ) * 0.5 + 0.5;\n r0 = mix(mix(innerRadius, 1.0, 0.4), mix(innerRadius, 1.0, 0.6), n0);\n d0 = distance(uv, r0 / len * uv);\n v0 = light1(1.0, 10.0, d0);\n v0 *= smoothstep(r0 * 1.05, r0, len);\n cl = cos(ang + time * 2.0) * 0.5 + 0.5;\n \n // high light\n float a = time * -1.0;\n vec2 pos = vec2(cos(a), sin(a)) * r0;\n d = distance(uv, pos);\n v1 = light2(1.5, 5.0, d);\n v1 *= light1(1.0, 50.0 , d0);\n \n // back decay\n v2 = smoothstep(1.0, mix(innerRadius, 1.0, n0 * 0.5), len);\n \n // hole\n v3 = smoothstep(innerRadius, mix(innerRadius, 1.0, 0.5), len);\n \n // color\n vec3 c = mix(color1, color2, cl);\n vec3 col = mix(color1, color2, cl);\n col = mix(color3, col, v0);\n col = (col + v1) * v2 * v3;\n col.rgb = clamp(col.rgb, 0.0, 1.0);\n \n //gl_FragColor = extractAlpha(col);\n _FragColor = extractAlpha(col);\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n vec2 uv = (fragCoord*2.-iResolution.xy)/iResolution.y;\n \n vec4 col;\n draw(col, uv);\n\n vec3 bg = BG_COLOR;\n\n fragColor.rgb = mix(bg, col.rgb, col.a); //normal blend\n}", + "views": 19836, + "likes": 476, + "createdAt": "2026-04-01T15:57:05.112Z", + "sourceFormat": "glsl" + }, + { + "id": "34548b08-2577-4fd9-b428-7deef9aca610", + "name": "玄彩", + "author": "unknown", + "code": "/*\n \"Singularity\" by @XorDev\n\n A whirling blackhole.\n Feel free to code golf!\n \n FabriceNeyret2: -19\n dean_the_coder: -12\n iq: -4\n*/\n\nvoid mainImage(out vec4 O, vec2 F)\n{\n //Iterator and attenuation (distance-squared)\n float i = .2, a;\n //Resolution for scaling and centering\n vec2 r = iResolution.xy,\n //Centered ratio-corrected coordinates\n p = ( F+F - r ) / r.y / .7,\n //Diagonal vector for skewing\n d = vec2(-1,1),\n //Blackhole center\n b = p - i*d,\n //Rotate and apply perspective\n c = p * mat2(1, 1, d/(.1 + i/dot(b,b))),\n //Rotate into spiraling coordinates\n v = c * mat2(cos(.5*log(a=dot(c,c)) + iTime*i + vec4(0,33,11,0)))/i,\n //Waves cumulative total for coloring\n w;\n \n //Loop through waves\n for(; i++<9.; w += 1.+sin(v) )\n //Distort coordinates\n v += .7* sin(v.yx*i+iTime) / i + .5;\n //Acretion disk radius\n i = length( sin(v/.3)*.4 + c*(3.+d) );\n //Red/blue gradient\n O = 1. - exp( -exp( c.x * vec4(.6,-.4,-1,0) )\n //Wave coloring\n / w.xyyx\n //Acretion disk brightness\n / ( 2. + i*i/4. - i )\n //Center darkness\n / ( .5 + 1. / a )\n //Rim highlight\n / ( .03 + abs( length(p)-.7 ) )\n );\n }", + "views": 19599, + "likes": 721, + "createdAt": "2026-04-01T15:56:37.442Z", + "sourceFormat": "glsl" + }, + { + "id": "256b1d36-4713-4103-b9d3-8f4e10667288", + "name": "热眼", + "author": "unknown", + "code": "// CC0: Clearly a bug\n// A \"Happy Accident\" Shader\n\n// Twigl: https://twigl.app?ol=true&ss=-OUOudmBPJ57CIb7rAxS\n\n// This shader uses a technique called \"raymarching\" to render 3D\n// Think of it like casting rays from your eye through each pixel into a 3D world,\n// then stepping along each ray until we hit something interesting.\n//\n// Key concepts for C developers:\n// - vec4/vec3/vec2: Like structs with x,y,z,w components (SIMD-style)\n// - Swizzling: p.xy means \"give me just the x,y parts of vector p\"\n// - mat2(): Creates a 2x2 rotation matrix from an angle\n// - All math operations work on vectors component-wise\n//\n// ATTRIBUTION: Shader techniques inspired by (alphabetical):\n// @byt3_m3chanic\n// @FabriceNeyrat2\n// @iq\n// @shane\n// @XorDev\n// + many more\n\nvoid mainImage(out vec4 O, vec2 C) {\n float \n i // Loop counter (starts at 0)\n , d // Distance to nearest surface\n , z = fract(dot(C,sin(C)))-.5 // Ray distance + noise for anti-banding\n ;\n vec4 \n o // Accumulated color/lighting\n , p // Current 3D position along ray\n ;\n for(\n vec2 r = iResolution.xy // Screen resolution\n ; ++i < 77. \n ; z += .6*d // Step forward (larger steps when far from surfaces)\n )\n // Convert 2D pixel to 3D ray direction\n p = vec4(z*normalize(vec3(C-.5*r,r.y)),.1*iTime)\n \n // Move through 3D space over time\n , p.z += iTime\n \n // Save position for lighting calculations\n , O = p\n \n // Apply rotation matrices to create fractal patterns\n // (These transform the 3D coordinates in interesting ways)\n , p.xy *= mat2(cos(2.+O.z+vec4(0,11,33,0)))\n \n // This was originally a bug in the matrix calculation\n // The incorrect transformation created an unexpectedly interesting pattern\n // Bob Ross would call this a \"happy little accident\"\n , p.xy *= mat2(cos(O+vec4(0,11,33,0)))\n \n // Calculate color based on position and space distortion\n // The sin() creates a nice looking palette, division by dot() creates falloff\n , O = (1.+sin(.5*O.z+length(p-O)+vec4(0,4,3,6)))\n / (.5+2.*dot(O.xy,O.xy))\n \n // Domain repetition, repeats the single line and the 2 planes infinitely\n , p = abs(fract(p)-.5)\n \n // Calculate distance to nearest surface\n // This combines a cylinder (length(p.xy)-.125) with 2 planesbox (min(p.x,p.y))\n , d = abs(min(length(p.xy)-.125,min(p.x,p.y)+1e-3))+1e-3\n \n // Add lighting contribution (brighter when closer to surfaces)\n , o += O.w/d*O\n ;\n \n // tanh() compresses the accumulated brightness to 0-1 range\n // (Like HDR tone mapping in photography)\n O = tanh(o/2e4);\n}", + "views": 22519, + "likes": 636, + "createdAt": "2026-04-01T15:56:04.431Z", + "sourceFormat": "glsl" + }, + { + "id": "f77eacef-c66d-4a84-b0f5-2044b6a83b5b", + "name": "炫彩", + "author": "unknown", + "code": "#define T iTime\n#define s1(v) (sin(v)*.5+.5)\n#define P(z) vec3(cos((z)*.1)*4.,sin((z)*.1)*4.,(z))\n#define t_path T*3.\n\n\nmat2 rotate(float a){\n float s = sin(a);\n float c = cos(a);\n return mat2(c,-s,s,c);\n}\n\n// https://www.shadertoy.com/view/lsKcDD\nmat3 setCamera( in vec3 ro, in vec3 ta, float cr )\n{\n\tvec3 cw = normalize(ta-ro); // 相机前\n\tvec3 cp = vec3(sin(cr), cos(cr),0.0); // 滚角\n\tvec3 cu = normalize( cross(cw,cp) ); // 相机右\n\tvec3 cv = normalize( cross(cu,cw) ); // 相机上\n return mat3( cu, cv, cw );\n}\n\nfloat noise(vec3 p){\n // p*=vec3(.1,.1,2.2);\n float n1 = dot(cos(p+sin(p*.4)*4.), vec3(.1)); // 不要在raymarch中用tanh,真的很费性能\n float n2 = dot(cos(p), vec3(.1));\n return mix(n1,n2,s1(T*.5));\n}\n\nvec3 C = vec3(10,2,1);\nvec3 RO;\nfloat fbm(vec3 p){\n float amp = 1.;\n float n = 0.;\n\n for(float i=0.;i<4.;i++){\n p += sin(p.zxy+T*i*2.)*amp;\n n += abs(noise(p))*amp;\n amp *= .5;\n p *= 2.;\n C += amp*.1;\n }\n return n;\n}\n\nvec3 col = vec3(0);\nfloat map(vec3 p){\n\n float d = fbm(p);\n float d1 = length(p - RO)-4.;\n d = max(d, -d1);\n col += s1(C+T)/(max(d, .01));\n\n return d;\n}\n\nvoid mainImage(out vec4 O, in vec2 I){\n vec2 R = iResolution.xy;\n vec2 uv = (I*2.-R)/R.y;\n\n O.rgb *= 0.;\n O.a = 1.;\n\n vec3 ro = P(t_path);\n RO = ro;\n vec3 rd = setCamera(ro, P(t_path+1.), sin(T*.5)*.4) * normalize(vec3(uv, 1.));\n\n float z = .1;\n\n float i=0.;\n while(i++<80.){\n vec3 p = ro + rd * z;\n\n float d = map(p);\n z += d;\n }\n\n\n O.rgb += col;\n O.rgb = tanh(O.rgb/8e2);\n}", + "views": 7870, + "likes": 161, + "createdAt": "2026-04-01T15:55:32.788Z", + "sourceFormat": "glsl" + }, + { + "id": "62d7b82f-a078-4f08-af39-e527ba916a01", + "name": "着色", + "author": "unknown", + "code": "#ifdef GL_ES\nprecision mediump float;\n#endif\n\nfloat cosRange(float amt, float range, float minimum) {\n\treturn (((1.0 + cos(radians(amt))) * 0.5) * range) + minimum;\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n const int zoom = 40;\n const float brightness = 0.975;\n\tfloat time = iTime * 1.25;\n\tvec2 uv = fragCoord.xy / iResolution.xy;\n\tvec2 p = (2.0*fragCoord.xy-iResolution.xy)/max(iResolution.x,iResolution.y);\n\tfloat ct = cosRange(time*5.0, 3.0, 1.1);\n\tfloat xBoost = cosRange(time*0.2, 5.0, 5.0);\n\tfloat yBoost = cosRange(time*0.1, 10.0, 5.0);\n\tfloat fScale = cosRange(time * 15.5, 1.25, 0.5);\n\t\n\tfor(int i=1;i.98 || uv.y>.98) col += 1.;\n #else\n col *= 1.-dot(uv,uv);\n t = mod(iTime, 230.);\n col *= S(0., 20., t)*S(224., 200., t);\n #endif\n \n fragColor = vec4(col,1);\n}", + "views": 13711, + "likes": 399, + "createdAt": "2026-04-01T15:53:34.082Z", + "sourceFormat": "glsl" + }, + { + "id": "da6767b8-bca1-4c1f-a18d-70767db6d81c", + "name": "海洋", + "author": "unknown", + "code": "// afl_ext 2017-2024\n// MIT License\n\n// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!\n\n#define DRAG_MULT 0.38 // changes how much waves pull on the water\n#define WATER_DEPTH 1.0 // how deep is the water\n#define CAMERA_HEIGHT 1.5 // how high the camera should be\n#define ITERATIONS_RAYMARCH 12 // waves iterations of raymarching\n#define ITERATIONS_NORMAL 36 // waves iterations when calculating normals\n\n#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords\n\n// Calculates wave value and its derivative, \n// for the wave direction, position in space, wave frequency and time\nvec2 wavedx(vec2 position, vec2 direction, float frequency, float timeshift) {\n float x = dot(direction, position) * frequency + timeshift;\n float wave = exp(sin(x) - 1.0);\n float dx = wave * cos(x);\n return vec2(wave, -dx);\n}\n\n// Calculates waves by summing octaves of various waves with various parameters\nfloat getwaves(vec2 position, int iterations) {\n float wavePhaseShift = length(position) * 0.1; // this is to avoid every octave having exactly the same phase everywhere\n float iter = 0.0; // this will help generating well distributed wave directions\n float frequency = 1.0; // frequency of the wave, this will change every iteration\n float timeMultiplier = 2.0; // time multiplier for the wave, this will change every iteration\n float weight = 1.0;// weight in final sum for the wave, this will change every iteration\n float sumOfValues = 0.0; // will store final sum of values\n float sumOfWeights = 0.0; // will store final sum of weights\n for(int i=0; i < iterations; i++) {\n // generate some wave direction that looks kind of random\n vec2 p = vec2(sin(iter), cos(iter));\n \n // calculate wave data\n vec2 res = wavedx(position, p, frequency, iTime * timeMultiplier + wavePhaseShift);\n\n // shift position around according to wave drag and derivative of the wave\n position += p * res.y * weight * DRAG_MULT;\n\n // add the results to sums\n sumOfValues += res.x * weight;\n sumOfWeights += weight;\n\n // modify next octave ;\n weight = mix(weight, 0.0, 0.2);\n frequency *= 1.18;\n timeMultiplier *= 1.07;\n\n // add some kind of random value to make next wave look random too\n iter += 1232.399963;\n }\n // calculate and return\n return sumOfValues / sumOfWeights;\n}\n\n// Raymarches the ray from top water layer boundary to low water layer boundary\nfloat raymarchwater(vec3 camera, vec3 start, vec3 end, float depth) {\n vec3 pos = start;\n vec3 dir = normalize(end - start);\n for(int i=0; i < 64; i++) {\n // the height is from 0 to -depth\n float height = getwaves(pos.xz, ITERATIONS_RAYMARCH) * depth - depth;\n // if the waves height almost nearly matches the ray height, assume its a hit and return the hit distance\n if(height + 0.01 > pos.y) {\n return distance(pos, camera);\n }\n // iterate forwards according to the height mismatch\n pos += dir * (pos.y - height);\n }\n // if hit was not registered, just assume hit the top layer, \n // this makes the raymarching faster and looks better at higher distances\n return distance(start, camera);\n}\n\n// Calculate normal at point by calculating the height at the pos and 2 additional points very close to pos\nvec3 normal(vec2 pos, float e, float depth) {\n vec2 ex = vec2(e, 0);\n float H = getwaves(pos.xy, ITERATIONS_NORMAL) * depth;\n vec3 a = vec3(pos.x, H, pos.y);\n return normalize(\n cross(\n a - vec3(pos.x - e, getwaves(pos.xy - ex.xy, ITERATIONS_NORMAL) * depth, pos.y), \n a - vec3(pos.x, getwaves(pos.xy + ex.yx, ITERATIONS_NORMAL) * depth, pos.y + e)\n )\n );\n}\n\n// Helper function generating a rotation matrix around the axis by the angle\nmat3 createRotationMatrixAxisAngle(vec3 axis, float angle) {\n float s = sin(angle);\n float c = cos(angle);\n float oc = 1.0 - c;\n return mat3(\n oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, \n oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, \n oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c\n );\n}\n\n// Helper function that generates camera ray based on UV and mouse\nvec3 getRay(vec2 fragCoord) {\n vec2 uv = ((fragCoord.xy / iResolution.xy) * 2.0 - 1.0) * vec2(iResolution.x / iResolution.y, 1.0);\n // for fisheye, uncomment following line and comment the next one\n //vec3 proj = normalize(vec3(uv.x, uv.y, 1.0) + vec3(uv.x, uv.y, -1.0) * pow(length(uv), 2.0) * 0.05); \n vec3 proj = normalize(vec3(uv.x, uv.y, 1.5));\n if(iResolution.x < 600.0) {\n return proj;\n }\n return createRotationMatrixAxisAngle(vec3(0.0, -1.0, 0.0), 3.0 * ((NormalizedMouse.x + 0.5) * 2.0 - 1.0)) \n * createRotationMatrixAxisAngle(vec3(1.0, 0.0, 0.0), 0.5 + 1.5 * (((NormalizedMouse.y == 0.0 ? 0.27 : NormalizedMouse.y) * 1.0) * 2.0 - 1.0))\n * proj;\n}\n\n// Ray-Plane intersection checker\nfloat intersectPlane(vec3 origin, vec3 direction, vec3 point, vec3 normal) { \n return clamp(dot(point - origin, normal) / dot(direction, normal), -1.0, 9991999.0); \n}\n\n// Some very barebones but fast atmosphere approximation\nvec3 extra_cheap_atmosphere(vec3 raydir, vec3 sundir) {\n //sundir.y = max(sundir.y, -0.07);\n float special_trick = 1.0 / (raydir.y * 1.0 + 0.1);\n float special_trick2 = 1.0 / (sundir.y * 11.0 + 1.0);\n float raysundt = pow(abs(dot(sundir, raydir)), 2.0);\n float sundt = pow(max(0.0, dot(sundir, raydir)), 8.0);\n float mymie = sundt * special_trick * 0.2;\n vec3 suncolor = mix(vec3(1.0), max(vec3(0.0), vec3(1.0) - vec3(5.5, 13.0, 22.4) / 22.4), special_trick2);\n vec3 bluesky= vec3(5.5, 13.0, 22.4) / 22.4 * suncolor;\n vec3 bluesky2 = max(vec3(0.0), bluesky - vec3(5.5, 13.0, 22.4) * 0.002 * (special_trick + -6.0 * sundir.y * sundir.y));\n bluesky2 *= special_trick * (0.24 + raysundt * 0.24);\n return bluesky2 * (1.0 + 1.0 * pow(1.0 - raydir.y, 3.0));\n} \n\n// Calculate where the sun should be, it will be moving around the sky\nvec3 getSunDirection() {\n return normalize(vec3(-0.0773502691896258 , 0.5 + sin(iTime * 0.2 + 2.6) * 0.45 , 0.5773502691896258));\n}\n\n// Get atmosphere color for given direction\nvec3 getAtmosphere(vec3 dir) {\n return extra_cheap_atmosphere(dir, getSunDirection()) * 0.5;\n}\n\n// Get sun color for given direction\nfloat getSun(vec3 dir) { \n return pow(max(0.0, dot(dir, getSunDirection())), 720.0) * 210.0;\n}\n\n// Great tonemapping function from my other shader: https://www.shadertoy.com/view/XsGfWV\nvec3 aces_tonemap(vec3 color) { \n mat3 m1 = mat3(\n 0.59719, 0.07600, 0.02840,\n 0.35458, 0.90834, 0.13383,\n 0.04823, 0.01566, 0.83777\n );\n mat3 m2 = mat3(\n 1.60475, -0.10208, -0.00327,\n -0.53108, 1.10813, -0.07276,\n -0.07367, -0.00605, 1.07602\n );\n vec3 v = m1 * color; \n vec3 a = v * (v + 0.0245786) - 0.000090537;\n vec3 b = v * (0.983729 * v + 0.4329510) + 0.238081;\n return pow(clamp(m2 * (a / b), 0.0, 1.0), vec3(1.0 / 2.2)); \n}\n\n// Main\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n // get the ray\n vec3 ray = getRay(fragCoord);\n if(ray.y >= 0.0) {\n // if ray.y is positive, render the sky\n vec3 C = getAtmosphere(ray) + getSun(ray);\n fragColor = vec4(aces_tonemap(C * 2.0),1.0); \n return;\n }\n\n // now ray.y must be negative, water must be hit\n // define water planes\n vec3 waterPlaneHigh = vec3(0.0, 0.0, 0.0);\n vec3 waterPlaneLow = vec3(0.0, -WATER_DEPTH, 0.0);\n\n // define ray origin, moving around\n vec3 origin = vec3(iTime * 0.2, CAMERA_HEIGHT, 1);\n\n // calculate intersections and reconstruct positions\n float highPlaneHit = intersectPlane(origin, ray, waterPlaneHigh, vec3(0.0, 1.0, 0.0));\n float lowPlaneHit = intersectPlane(origin, ray, waterPlaneLow, vec3(0.0, 1.0, 0.0));\n vec3 highHitPos = origin + ray * highPlaneHit;\n vec3 lowHitPos = origin + ray * lowPlaneHit;\n\n // raymatch water and reconstruct the hit pos\n float dist = raymarchwater(origin, highHitPos, lowHitPos, WATER_DEPTH);\n vec3 waterHitPos = origin + ray * dist;\n\n // calculate normal at the hit position\n vec3 N = normal(waterHitPos.xz, 0.01, WATER_DEPTH);\n\n // smooth the normal with distance to avoid disturbing high frequency noise\n N = mix(N, vec3(0.0, 1.0, 0.0), 0.8 * min(1.0, sqrt(dist*0.01) * 1.1));\n\n // calculate fresnel coefficient\n float fresnel = (0.04 + (1.0-0.04)*(pow(1.0 - max(0.0, dot(-N, ray)), 5.0)));\n\n // reflect the ray and make sure it bounces up\n vec3 R = normalize(reflect(ray, N));\n R.y = abs(R.y);\n \n // calculate the reflection and approximate subsurface scattering\n vec3 reflection = getAtmosphere(R) + getSun(R);\n vec3 scattering = vec3(0.0293, 0.0698, 0.1717) * 0.1 * (0.2 + (waterHitPos.y + WATER_DEPTH) / WATER_DEPTH);\n\n // return the combined result\n vec3 C = fresnel * reflection + scattering;\n fragColor = vec4(aces_tonemap(C * 2.0), 1.0);\n}", + "views": 21588, + "likes": 137, + "createdAt": "2026-04-01T15:52:47.322Z", + "sourceFormat": "glsl" + }, + { + "id": "3cfa51f8-b1d3-48f2-9f52-9f6fca69b08f", + "name": "穿越", + "author": "unknown", + "code": "// i was listening to Fear Factory then some random youtube industrial\n// it'd be cool with some flickering or something but i'm done with it for now\n\n#define T (sin(iTime*.4)/2.+iTime)\n#define P(z) (vec3(cos((z)*.02)*64., cos((z)*.015)*32., (-z)))\n#define R(a) mat2(cos(a + vec4(0,33,11,0)))\n#define N normalize\n\n\nfloat box (vec3 p, float i){\n p = i*.41 - abs(fract(p/i)*i - i/2.);\n return min(p.x, min(p.y, p.z));\n}\n\nfloat boxen(vec3 p) {\n float d = -9e9, i = 1e2;\n p *= 5e1;\n for(; i > .1; i *= .3)\n p.xz *= R((i < 50. ? i : 1.)),\n p.yz *= R((i < 20. ? i*i : 1.)),\n d = max(d, box(p, i));\n return d/5e1;\n}\n\nfloat map(vec3 p) {\n return max(1e1-length(p), max(boxen(p), 1e2*boxen(p.yxz/1e2)));\n}\n\nvoid mainImage(out vec4 o, vec2 u) {\n float s, i;\n\n vec3 r= iResolution;\n u = (u+u - r.xy) / r.y;\n if(abs(u.x) > 1.4) { o *= i; return; }\n \n \n vec3 p = P(T*6e1),\n Z = N(P(T*6e1 + 2e1) - p),\n X = N(vec3(Z.z, 0, -Z)),\n D = N(vec3(R(tanh(sin(p.z*.01)*4.)*6.) * u, 1) * mat3(-X, cross(X, Z), Z));\n vec2 v = 2e2*(.1*sin(T/1.5))+u + (u.yx*.8+.2-vec2(-1.,.1));\n for(o *= i; i++ < 64.; )\n p += D * s,\n s = map(p) * .8,\n o += s/i\n + .2*(vec4(clamp(v.x,1.,4.),1,2,0))*s,\n + vec4(4,2,1,0)/ length(v);\n \n vec4 lights = abs(vec4(8,1,1,0) / dot(cos(iTime*3.+p/4e1),vec3(1e1)));\n o += lights;\n\n o = tanh(o / 1e2 * length(v-u)/3e1);\n}", + "views": 21349, + "likes": 484, + "createdAt": "2026-04-01T15:51:59.158Z", + "sourceFormat": "glsl" + }, + { + "id": "ad4ccd5d-4c58-43f1-af72-fda7350bddc7", + "name": "光流", + "author": "unknown", + "code": "#define SCROLL 2.8\n#define SPEED 3.4\n\nfloat ncos(float x)\n{\n return cos(x) / (.5 + .4 * abs(cos(x)));\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord)\n{\n vec2 s = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;\n float v = (s.y + 1.0) * (s.y + 1.0) * 0.25;\n s.y -= 1.2;\n float per = 2.0 / abs(s.y);\n\n vec3 col = vec3(0);\n for (float z = 0.0; z < 1.0; z += 0.08)\n {\n float d = 1.0 + 0.4 * z;\n vec2 p = vec2(s.x * d, s.y + d) * per;\n vec2 s = p;\n s.y += SCROLL * iTime;\n vec2 c = s - 0.05 * iTime + sin(s * 5.3 + 0.03 * iTime);\n\n float shift = cos(z / 0.08);\n float wave = ncos(s.y * 1.4) + ncos(s.y * 0.9 + 0.3 * iTime);\n s.x += shift + (wave) / (1.0 + 0.01 * per * per);\n\n float w = s.x;\n float l = sin(s.y * 0.7 + z / 0.08 + SPEED * iTime * sign(shift));\n float intensity = exp(min(l, -l / 0.3 / (1.0 + 4.0 * w * w)));\n\n // Cold palette: deep blue -> cyan/ice-white\n vec3 coldA = vec3(0.05, 0.12, 0.45); // deep navy blue\n vec3 coldB = vec3(0.55, 0.85, 1.0); // ice cyan\n vec3 tint = mix(coldA, coldB, tanh(shift / 0.1) * 0.5 + 0.5);\n\n // Subtle purple shimmer on some strands\n tint += vec3(0.15, 0.0, 0.25) * smoothstep(0.3, 0.7, sin(z * 30.0 + iTime * 0.7));\n\n col += intensity * tint / (abs(w) + 0.01 * per) * per;\n }\n col = tanh(col / 2e1);\n fragColor = vec4(col * col, 1);\n}", + "views": 21822, + "likes": 311, + "createdAt": "2026-04-01T15:35:13.690Z", + "sourceFormat": "glsl" + }, + { + "id": "7c9bb8e9-503e-44ce-b5a0-85b9f11dbae3", + "name": "箱体", + "author": "unknown", + "code": "// CC0: Just another cube\n// Glowtracers are great for compact coding, but I wanted to see how much\n// I could squeeze a more normal raymarcher in terms of characters used.\n\n// Twigl: https://twigl.app?ol=true&ss=-OW-y9xgRgWubwKcn0Nd\n\n// == Globals ==\n// Single-letter variable names are used to save characters (code golfing).\nmat2 R; // A 2D rotation matrix, calculated once per frame in mainImage and used by D.\nfloat d=1. // Stores the most recent distance to the scene from the ray's position.\n , z // Stores the total distance traveled along the ray.\n , G=9. // \"Glow\" variable. Tracks the closest the ray comes to the object (for volumetric glow effect).\n , M=1e-3\n ;\n// == Distance Function (SDF - Signed Distance Field) ==\n// This function calculates the shortest distance from a given point 'p' to the scene geometry.\n// A positive result means the point is outside an object, negative is inside, and zero is on the surface.\n// This is the core of \"raymarching\", as it tells us the largest safe step we can take along a ray.\nfloat D(vec3 p) {\n // Apply two rotations to the point's coordinates. This twists the space the object\n // exists in, making the simple cube shape appear more complex and animated.\n p.xy *= R;\n p.xz *= R;\n\n // Create a higher-frequency version of the coordinate for detailed surface patterns.\n vec3 S = sin(123.*p);\n\n // This creates a volumetric glow effect by tracking the minimum distance\n // to either the existing glow value or a glowing shell around the object.\n G = min(\n G\n // The glowing shell\n , max(\n abs(length(p)-.6)\n // The main object distance calculation:\n // 1. A superquadric (rounded cube shape) is created using an L8-norm.\n // The expression `pow(dot(p=p*p*p*p,p),.125)` is a golfed version of\n // `pow(pow(p.x,8)+pow(p.y,8)+pow(p.z,8), 1./8.)`.\n // The `- .5` defines the object's size.\n , d = pow(dot(p*=p*p*p,p),.125) - .5\n // 2. Surface detail subtraction. This creates small surface variations\n // using high-frequency sine waves for more appealing reflections.\n - pow(1.+S.x*S.y*S.z,8.)/1e5\n )\n );\n\n return d;\n}\n\n// == Main Render Function ==\n// This function is called for every pixel on the screen to determine its color.\n// 'o' is the final output color (rgba). 'C' is the input pixel coordinate (xy).\nvoid mainImage(out vec4 o, vec2 C) {\n // Single-letter variable names are used to save characters (code golfing).\n vec3 p // The current point in 3D space along the ray.\n , O // Multi-purpose vector: color accumulator, then normal vector, then final color.\n , r=iResolution // 'r' holds screen resolution, later re-used for the epsilon vector and reflection.\n // 'I' is the Ray Direction vector. It's calculated once per pixel.\n // This converts the 2D screen coordinate 'C' into a 3D direction, creating the camera perspective.\n , I=normalize(vec3(C-.5*r.xy, r.y))\n // Base glow color (dark bluish tint).\n , B=vec3(1,2,9)*M\n ;\n\n // == Raymarching Loop ==\n // This loop \"marches\" a ray from the camera out into the scene to find what it hits.\n // It uses a golfed structure where the body of the loop updates the ray position 'p',\n // and the \"advancement\" step moves the ray forward.\n for(\n // -- Initializer (runs once before the loop) --\n // Calculate the rotation matrix for this frame based on time.\n R = mat2(cos(.3*iTime+vec4(0,11,33,0)))\n // -- Condition --\n // Loop while total distance 'z' is less than 9 and we are not yet touching a surface (d > 1e-3).\n ; z<9. && d > M\n // -- Advancement --\n // The ray advances by the safe distance 'd' returned by D(p).\n // The result of D(p) is also assigned to the global 'd' inside the function.\n ; z += D(p)\n )\n // -- Loop Body --\n // Calculate the current position 'p' in world space.\n // The camera starts at (0,0,-2) and points forward.\n p = z*I\n , p.z -= 2.\n ;\n\n // -- Hit Condition --\n // If the loop finished because z exceeded the max distance, we hit nothing. Otherwise, we hit the surface.\n if (z < 9.) {\n // -- Calculate Surface Normal --\n // Estimate the gradient ∇D at the hit point 'p' via central differences on the SDF D.\n // We use ε = 1e-3 and loop over each axis (x, y, z):\n // • Zero r, then set r[i] = ε.\n // • Compute O[i] = D(p + r) – D(p – r).\n // After the loop, O holds the unnormalized normal vector.\n for (\n int i // axis index: 0→x, 1→y, 2→z\n ; i < 3\n ; O[i++] = D(p+r) - D(p-r)\n )\n r -= r // clear r to vec3(0)\n , r[i] = M // set only the i-th component\n ;\n\n // -- Lighting and Shading --\n // 'z' is re-purposed to store a fresnel factor (1 - cos(angle)) for edge brightness.\n // `dot(O, I)` calculates how much the surface faces away from the camera.\n // O is also normalized here to become a proper normal vector.\n z = 1.+dot(O = normalize(O),I);\n\n // 'r' is re-purposed to store the reflection vector.\n r = reflect(I,O);\n\n // Calculate a point 'C' along the reflection vector 'r' to sample a background color.\n // For upward reflections (r.y > 0), this finds the intersection with the plane y=5.\n C = (p+r*(5.-p.y)/abs(r.y)).xz;\n \n // Calculate the final color 'O' of the hit point.\n O =\n // Multiply by the fresnel factor squared for stronger edge reflections.\n z*z *\n // Use a ternary operator to decide the color based on where the reflection ray goes.\n (\n // If the reflection vector points upward...\n r.y>0.\n // ...sample a procedural \"sky\" with a radial gradient and blue tint.\n ? 5e2*smoothstep(5., 4., d = sqrt(length(C*C))+1.)*d*B\n // ...otherwise, sample a \"floor\" with a deep blue exponential falloff.\n : exp(-2.*length(C))*(B/M-1.)\n )\n // Add rim lighting (brighter on upward-facing surfaces).\n + pow(1.+O.y,5.)*B\n ;\n }\n\n // == Tonemapping & Output ==\n // Apply final effects and map the High Dynamic Range (HDR) color to a displayable range.\n // Add glow contribution: smaller G values (closer ray passes) create a brighter blue glow.\n o = sqrt(O+B/G).xyzx;\n}", + "views": 3108, + "likes": 51, + "createdAt": "2026-04-01T15:34:35.030Z", + "sourceFormat": "glsl" + }, + { + "id": "2881c592-2827-413b-8f91-270c2f6f6788", + "name": "粒子隧道", + "author": "unknown", + "code": "着色器输入\n// MIT License\n\n// low tech tunnel\n// 28 steps\n\n/*\n @FabriceNeyret2 -40 chars\n → 611 (from 651)!\n \n Further golfing below shader code\n \n*/\n\n#define T iTime*4. + 5. + 5.*sin(iTime*.3) //\n#define P(z) vec3( 12.* cos( (z)*vec2(.1,.12) ) , z) //\n#define A(F,H,K) abs(dot( sin(F*p*K), H +p-p )) / K\n\nvoid mainImage(out vec4 o, in vec2 u) {\n \n float t,s,i,d,e;\n vec3 c,r = iResolution;\n\n u = ( u - r.xy/2. ) / r.y; // scaled coords\n if (abs(u.y) > .375) { o*= i; return;}// cinema bars\n \n \n vec3 p = P(T), // setup ray origin, direction, and look-at\n Z = normalize( P(T+4.) - p),\n X = normalize(vec3(Z.z,0,-Z)),\n D = vec3(u, 1) * mat3(-X, cross(X, Z), Z);\n \n for(; i++ < 28. && d < 3e1 ;\n c += 1./s + 1e1*vec3(1,2,5)/max(e, .6)\n )\n p += D * s, // march\n X = P(p.z), // get path\n t = sin(iTime), // store sine of iTime (not T)\n e = length(p - vec3( // orb (sphere with xyz offset by t)\n X.x + t,\n X.y + t*2.,\n 6.+T + t*2.))-.01,\n s = cos(p.z*.6)*2.+ 4. // tunnel with modulating radius\n - min( length(p.xy - X.x - 6.)\n , length((p-X).xy) )\n + A( 4., .25, .1) // noise, large scoops\n + A(T+8., .22, 2.), // noise, detail texture \n // (remove \"T+\" if you don't like the texture moving)\n d += s = min(e,.01+.3*abs(s)); // accumulate distance\n \n o.rgb = c*c/1e6; // adjust brightness and saturation\n}", + "views": 24459, + "likes": 695, + "createdAt": "2026-04-01T15:33:45.538Z", + "sourceFormat": "glsl" + }, + { + "id": "cddda4e7-5f78-4c1b-8aaf-5d7e7e0f0a37", + "name": "粒子束", + "author": "unknown", + "code": "#define R iResolution\n#define T iTime\n#define rot(a) mat2(cos(a), sin(a), -sin(a), cos(a))\n\nvec3 path(float v) {\n return vec3(sin(v*.1)*7., cos(v*.15)*5., v);\n}\n\nfloat bulk(vec3 p, float h) {\n float t = T * .3;\n for(int i=0; i<8; i++) {\n p = abs(p) - vec3(1.2, 2.5, 2.);\n p.yz *= rot(t*.5 + p.x*.1);\n p.xz *= rot(t*.8 + p.y*.12);\n p = p * 1.3 - .2;\n }\n return max(length(p) * pow(1.3, -8.0), -h);\n}\n\nvoid mainImage(out vec4 O, vec2 C) {\n vec2 uv = (C*2. - R.xy) / R.y;\n float s = T * 5., z = .3;\n vec3 ro = path(s), \n ta = path(s + 1.2),\n f = normalize(ta - ro),\n r = normalize(cross(f, vec3(0, 1, 0))),\n rd = mat3(r, cross(r, f), f) * normalize(vec3(uv, 1.8)),\n col = vec3(0);\n\n for(float i=0.; i<120.; i++) {\n vec3 p = ro + rd * z;\n vec3 q = p - path(p.z);\n float h = length(q.xy) - 4.5;\n float d = bulk(q, h);\n \n vec3 id = floor(p/10. + .5);\n vec3 hsh = fract(sin(id * vec3(12.9, 78.2, 45.3)) * 43758.5);\n float ds = length(p - id*10. - (hsh-.5)*10.) - .01;\n \n d = max(min(d, max(ds, -h)), .001);\n \n float sh = pow(sin(p.z*.05 + T*3.)*.5 + .5, 1.6);\n vec3 gc = sin(vec3(4, 2.8, 1.2) + p.z*.03 + hsh.x);\n \n col += (2.2 + gc) * sh / (d + .08);\n \n if(z > 80.) break;\n z += d * 0.55;\n }\n \n O = vec4(pow(tanh(col / 350.0), vec3(1.2)), 1.0);\n}", + "views": 12483, + "likes": 705, + "createdAt": "2026-04-01T15:31:53.940Z", + "sourceFormat": "glsl" + }, + { + "id": "e1f817dd-627c-419c-a5ce-7dc7a4b05f64", "name": "线条", "author": "unknown", - "code": "void ANGLE_loopForwardProgress() {}\n\n\n\nvec2 ANGLE_sc3(float ANGLE_sc40, float ANGLE_sc41)\n{\n vec2 ANGLE_sc42 = vec2(ANGLE_sc40, ANGLE_sc41);\n return ANGLE_sc42;\n}\n\n\n\nvec2 ANGLE_sc3c(float ANGLE_sc3d, float ANGLE_sc3e)\n{\n vec2 ANGLE_sc43 = vec2(ANGLE_sc3d, ANGLE_sc3e);\n return ANGLE_sc43;\n}\n\n\n\nvec4 ANGLE_sc39(vec3 ANGLE_sc3a, float ANGLE_sc3b)\n{\n vec4 ANGLE_sc44 = vec4(ANGLE_sc3a.x, ANGLE_sc3a.y, ANGLE_sc3a.z, ANGLE_sc3b);\n return ANGLE_sc44;\n}\n\n\n\nvec4 ANGLE_sc36(vec3 ANGLE_sc37, float ANGLE_sc38)\n{\n vec4 ANGLE_sc45 = vec4(ANGLE_sc37.x, ANGLE_sc37.y, ANGLE_sc37.z, ANGLE_sc38);\n return ANGLE_sc45;\n}\n\n\n\nvec3 ANGLE_sc33(vec2 ANGLE_sc34, float ANGLE_sc35)\n{\n vec3 ANGLE_sc46 = vec3(ANGLE_sc34.x, ANGLE_sc34.y, ANGLE_sc35);\n return ANGLE_sc46;\n}\n\n\n\nmat3 ANGLE_sc2(vec3 ANGLE_sc30, vec3 ANGLE_sc31, vec3 ANGLE_sc32)\n{\n mat3 ANGLE_sc47 = mat3(ANGLE_sc30.x, ANGLE_sc30.y, ANGLE_sc30.z, ANGLE_sc31.x, ANGLE_sc31.y, ANGLE_sc31.z, ANGLE_sc32.x, ANGLE_sc32.y, ANGLE_sc32.z);\n return ANGLE_sc47;\n}\n\n\n\nmat2 ANGLE_sc2a(float ANGLE_sc2b, float ANGLE_sc2c, float ANGLE_sc2d, float ANGLE_sc2e)\n{\n mat2 ANGLE_sc48 = mat2(ANGLE_sc2b, ANGLE_sc2c, ANGLE_sc2d, ANGLE_sc2e);\n return ANGLE_sc48;\n}\n\n\n\nmat2 ANGLE_sc25(float ANGLE_sc26, float ANGLE_sc27, float ANGLE_sc28, float ANGLE_sc29)\n{\n mat2 ANGLE_sc49 = mat2(ANGLE_sc26, ANGLE_sc27, ANGLE_sc28, ANGLE_sc29);\n return ANGLE_sc49;\n}\n\n\n\nvec3 ANGLE_sc21(float ANGLE_sc22, float ANGLE_sc23, float ANGLE_sc24)\n{\n vec3 ANGLE_sc4a = vec3(ANGLE_sc22, ANGLE_sc23, ANGLE_sc24);\n return ANGLE_sc4a;\n}\n\n\n\nvec3 _upath(float _uv)\n{\n float ANGLE_sc4b = (_uv * 0.100000001);\n float ANGLE_sc4c = sin(ANGLE_sc4b);\n float ANGLE_sc4d = (ANGLE_sc4c * 7.0);\n float ANGLE_sc4e = (_uv * 0.150000006);\n float ANGLE_sc4 = cos(ANGLE_sc4e);\n float ANGLE_sc50 = (ANGLE_sc4 * 5.0);\n vec3 ANGLE_sc51 = ANGLE_sc21(ANGLE_sc4d, ANGLE_sc50, _uv);\n return ANGLE_sc51;\n}\n\n\n\nfloat _ubulk( vec3 _up, float _uh)\n{\n float _ut = (iTime * 0.300000012);\n {\n int _ui = 0;\n bool ANGLE_sbfc = (_ui < 8);\n while (ANGLE_sbfc)\n {\n {\n vec3 ANGLE_sc54 = abs(_up);\n _up = (ANGLE_sc54 - vec3(1.20000005, 2.5, 2.0));\n float ANGLE_sc56 = (_ut * 0.5);\n float ANGLE_sc57 = (_up.x * 0.100000001);\n float ANGLE_sc58 = (ANGLE_sc56 + ANGLE_sc57);\n float ANGLE_sc59 = cos(ANGLE_sc58);\n float ANGLE_sc5a = (_ut * 0.5);\n float ANGLE_sc5b = (_up.x * 0.100000001);\n float ANGLE_sc5c = (ANGLE_sc5a + ANGLE_sc5b);\n float ANGLE_sc5d = sin(ANGLE_sc5c);\n float ANGLE_sc5e = (_ut * 0.5);\n float ANGLE_sc5 = (_up.x * 0.100000001);\n float ANGLE_sc60 = (ANGLE_sc5e + ANGLE_sc5);\n float ANGLE_sc61 = sin(ANGLE_sc60);\n float ANGLE_sc62 = (-ANGLE_sc61);\n float ANGLE_sc63 = (_ut * 0.5);\n float ANGLE_sc64 = (_up.x * 0.100000001);\n float ANGLE_sc65 = (ANGLE_sc63 + ANGLE_sc64);\n float ANGLE_sc66 = cos(ANGLE_sc65);\n mat2 ANGLE_sc67 = ANGLE_sc25(ANGLE_sc59, ANGLE_sc5d, ANGLE_sc62, ANGLE_sc66);\n _up.yz = (_up.yz * ANGLE_sc67);\n float ANGLE_sc68 = (_ut * 0.800000012);\n float ANGLE_sc69 = (_up.y * 0.119999997);\n float ANGLE_sc6a = (ANGLE_sc68 + ANGLE_sc69);\n float ANGLE_sc6b = cos(ANGLE_sc6a);\n float ANGLE_sc6c = (_ut * 0.800000012);\n float ANGLE_sc6d = (_up.y * 0.119999997);\n float ANGLE_sc6e = (ANGLE_sc6c + ANGLE_sc6d);\n float ANGLE_sc6 = sin(ANGLE_sc6e);\n float ANGLE_sc70 = (_ut * 0.800000012);\n float ANGLE_sc71 = (_up.y * 0.119999997);\n float ANGLE_sc72 = (ANGLE_sc70 + ANGLE_sc71);\n float ANGLE_sc73 = sin(ANGLE_sc72);\n float ANGLE_sc74 = (-ANGLE_sc73);\n float ANGLE_sc75 = (_ut * 0.800000012);\n float ANGLE_sc76 = (_up.y * 0.119999997);\n float ANGLE_sc77 = (ANGLE_sc75 + ANGLE_sc76);\n float ANGLE_sc78 = cos(ANGLE_sc77);\n mat2 ANGLE_sc79 = ANGLE_sc2a(ANGLE_sc6b, ANGLE_sc6, ANGLE_sc74, ANGLE_sc78);\n _up.xz = (_up.xz * ANGLE_sc79);\n vec3 ANGLE_sc7a = (_up * 1.29999995);\n _up = (ANGLE_sc7a - 0.200000003);\n }\n _ui++;\n ANGLE_sbfc = (_ui < 8);\n }\n }\n float ANGLE_sc7d = length(_up);\n float ANGLE_sc7e = (ANGLE_sc7d * 0.122589514);\n float ANGLE_sc7 = (-_uh);\n float ANGLE_sc80 = max(ANGLE_sc7e, ANGLE_sc7);\n return ANGLE_sc80;\n}\n\n\n\nvoid _umainImage(out vec4 _ufragColor, vec2 _ufragCoord)\n{\n _uO = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 ANGLE_sc81 = (_uC * 2.0);\n vec2 ANGLE_sc82 = (ANGLE_sc81 - iResolution.xy);\n vec2 _uuv = (ANGLE_sc82 / iResolution.y);\n float _us = (iTime * 5.0);\n float _uz = 0.300000012;\n vec3 _uro = _upath(_us);\n float ANGLE_sc86 = (_us + 1.20000005);\n vec3 _uta = _upath(ANGLE_sc86);\n vec3 ANGLE_sc88 = (_uta - _uro);\n vec3 _uf = normalize(ANGLE_sc88);\n vec3 ANGLE_sc8a = cross(_uf, vec3(0.0, 1.0, 0.0));\n vec3 _ur = normalize(ANGLE_sc8a);\n vec3 ANGLE_sc8c = cross(_ur, _uf);\n mat3 ANGLE_sc8d = ANGLE_sc2(_ur, ANGLE_sc8c, _uf);\n vec3 ANGLE_sc8e = ANGLE_sc33(_uuv, 1.79999995);\n vec3 ANGLE_sc8 = normalize(ANGLE_sc8e);\n vec3 _urd = (ANGLE_sc8d * ANGLE_sc8);\n vec3 _ucol = vec3(0.0, 0.0, 0.0);\n {\n float _ui = 0.0;\n bool ANGLE_sbfd = (_ui < 120.0);\n while (ANGLE_sbfd)\n {\n {\n ANGLE_loopForwardProgress();\n {\n vec3 ANGLE_sc92 = (_urd * _uz);\n vec3 _up = (_uro + ANGLE_sc92);\n vec3 ANGLE_sc94 = _upath(_up.z);\n vec3 _uq = (_up - ANGLE_sc94);\n float ANGLE_sc96 = length(_uq.xy);\n float _uh = (ANGLE_sc96 - 4.5);\n float _ud = _ubulk(ANGLE_userUniforms, _uq, _uh);\n vec3 ANGLE_sc99 = (_up / 10.0);\n vec3 ANGLE_sc9a = (ANGLE_sc99 + 0.5);\n vec3 _uid = floor(ANGLE_sc9a);\n vec3 ANGLE_sc9c = (_uid * vec3(12.8999996, 78.1999969, 45.2999992));\n vec3 ANGLE_sc9d = sin(ANGLE_sc9c);\n vec3 ANGLE_sc9e = (ANGLE_sc9d * 43758.5);\n vec3 _uhsh = fract(ANGLE_sc9e);\n vec3 ANGLE_sca0 = (_uid * 10.0);\n vec3 ANGLE_sca1 = (_up - ANGLE_sca0);\n vec3 ANGLE_sca2 = (_uhsh - 0.5);\n vec3 ANGLE_sca3 = (ANGLE_sca2 * 10.0);\n vec3 ANGLE_sca4 = (ANGLE_sca1 - ANGLE_sca3);\n float ANGLE_sca5 = length(ANGLE_sca4);\n float _uds = (ANGLE_sca5 - 0.00999999978);\n float ANGLE_sca7 = (-_uh);\n float ANGLE_sca8 = max(_uds, ANGLE_sca7);\n float ANGLE_sca9 = min(_ud, ANGLE_sca8);\n _ud = max(ANGLE_sca9, 0.00100000005);\n float ANGLE_scab = (_up.z * 0.0500000007);\n float ANGLE_scac = (iTime * 3.0);\n float ANGLE_scad = (ANGLE_scab + ANGLE_scac);\n float ANGLE_scae = sin(ANGLE_scad);\n float ANGLE_scaf = (ANGLE_scae * 0.5);\n float ANGLE_scb0 = (ANGLE_scaf + 0.5);\n float _ush = powr(ANGLE_scb0, 1.60000002);\n float ANGLE_scb2 = (_up.z * 0.0299999993);\n vec3 ANGLE_scb3 = (vec3(4.0, 2.79999995, 1.20000005) + ANGLE_scb2);\n vec3 ANGLE_scb4 = (ANGLE_scb3 + _uhsh.x);\n vec3 _ugc = sin(ANGLE_scb4);\n vec3 ANGLE_scb6 = (2.20000005 + _ugc);\n vec3 ANGLE_scb7 = (ANGLE_scb6 * _ush);\n float ANGLE_scb8 = (_ud + 0.0799999982);\n vec3 ANGLE_scb9 = (ANGLE_scb7 / ANGLE_scb8);\n _ucol += ANGLE_scb9;\n bool ANGLE_scba = (_uz > 80.0);\n if (ANGLE_scba)\n {\n break;\n } else {}\n float ANGLE_scbb = (_ud * 0.550000012);\n _uz += ANGLE_scbb;\n }\n }\n _ui++;\n ANGLE_sbfd = (_ui < 120.0);\n }\n }\n vec3 ANGLE_scbd = (_ucol / 350.0);\n vec3 ANGLE_scbe = tanh(ANGLE_scbd);\n vec3 ANGLE_scbf = powr(ANGLE_scbe, vec3(1.20000005, 1.20000005, 1.20000005));\n _uO = ANGLE_sc36(ANGLE_scbf, 1.0);\n}\n\n\n\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) { _umainImage(fragColor, fragCoord); }", - "views": 9700, - "likes": 574, - "createdAt": "2026-04-01T12:24:58.267Z", - "updatedAt": "2026-04-01T13:31:34.476Z", - "sourceFormat": "angle-metal-auto-converted" + "code": "void mainImage(out vec4 o, vec2 u) {\n \n vec3 q,p = iResolution,\n D = normalize(vec3(u =(u+u-p.xy)/p.y+vec2(cos(iTime*2.)*.15, cos(iTime)*.13), .7));\n \n float i,s,d;\n \n for(o*=i; i++<50.; ) {\n \n p = D * d;\n p.z = cos(p.z*(sin(p.x+iTime*.7)+1.5));\n for (s = 2.; s++ <15.;\n p = p*1.05+sin(2.6*iTime+p.yzx*s)*(.125*cos(iTime*.7)));\n d += s = .01 + .1*abs(length(p)-.8);\n o += vec4(sin(p*vec3(.9,.3,.2)-vec3(1.,4.,1.)),0)/s;\n \n }\n o = tanh(o*o/1e6)*(1.-.2*dot(u,u));\n}", + "views": 5699, + "likes": 105, + "createdAt": "2026-04-01T15:29:41.289Z", + "sourceFormat": "glsl" }, { - "id": "0b5f6b51-d43d-4be8-b5a3-f430ebb1960e", - "name": "粒子云", - "author": "unknown", - "code": "void ANGLE_loopForwardProgress() {}\n\n\n\nvec2 ANGLE_sc1c(float ANGLE_sc1d, float ANGLE_sc1e)\n{\n vec2 ANGLE_sc1 = vec2(ANGLE_sc1d, ANGLE_sc1e);\n return ANGLE_sc1;\n}\n\n\n\nvec2 ANGLE_sc19(float ANGLE_sc1a, float ANGLE_sc1b)\n{\n vec2 ANGLE_sc20 = vec2(ANGLE_sc1a, ANGLE_sc1b);\n return ANGLE_sc20;\n}\n\n\n\nvec4 ANGLE_sc16(vec3 ANGLE_sc17, float ANGLE_sc18)\n{\n vec4 ANGLE_sc21 = vec4(ANGLE_sc17.x, ANGLE_sc17.y, ANGLE_sc17.z, ANGLE_sc18);\n return ANGLE_sc21;\n}\n\n\n\nvec4 ANGLE_sc13(vec3 ANGLE_sc14, int ANGLE_sc15)\n{\n float ANGLE_sc22 = float(ANGLE_sc15);\n vec4 ANGLE_sc23 = vec4(ANGLE_sc14.x, ANGLE_sc14.y, ANGLE_sc14.z, ANGLE_sc22);\n return ANGLE_sc23;\n}\n\n\n\nvec3 ANGLE_sc10(vec2 ANGLE_sc11, float ANGLE_sc12)\n{\n vec3 ANGLE_sc24 = vec3(ANGLE_sc11.x, ANGLE_sc11.y, ANGLE_sc12);\n return ANGLE_sc24;\n}\n\n\n\nvec2 ANGLE_sc0d(float ANGLE_sc0e, float ANGLE_sc0)\n{\n vec2 ANGLE_sc25 = vec2(ANGLE_sc0e, ANGLE_sc0);\n return ANGLE_sc25;\n}\n\n\n\nvoid _umainImage(out vec4 _ufragColor, vec2 _ufragCoord)\n{\n _uo = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 _up = iResolution;\n vec2 ANGLE_sc26 = (_uu + _uu);\n vec2 ANGLE_sc27 = (ANGLE_sc26 - _up.xy);\n vec2 ANGLE_sc28 = (ANGLE_sc27 / _up.y);\n float ANGLE_sc29 = (iTime * 2.0);\n float ANGLE_sc2a = cos(ANGLE_sc29);\n float ANGLE_sc2b = (ANGLE_sc2a * 0.150000006);\n float ANGLE_sc2c = cos(iTime);\n float ANGLE_sc2d = (ANGLE_sc2c * 0.129999995);\n vec2 ANGLE_sc2e = ANGLE_sc0d(ANGLE_sc2b, ANGLE_sc2d);\n vec2 ANGLE_sc30 = _uu = (ANGLE_sc28 + ANGLE_sc2e);\n vec3 ANGLE_sc31 = ANGLE_sc10(ANGLE_sc30, 0.699999988);\n vec3 _uD = normalize(ANGLE_sc31);\n float _ui = 0.0;\n float _us = 0.0;\n float _ud = 0.0;\n {\n _uo *= _ui;\n float ANGLE_sc33 = (_ui++);\n bool ANGLE_sbe8 = (ANGLE_sc33 < 50.0);\n while (ANGLE_sbe8)\n {\n {\n ANGLE_loopForwardProgress();\n {\n _up = (_uD * _ud);\n float ANGLE_sc36 = (iTime * 0.699999988);\n float ANGLE_sc37 = (_up.x + ANGLE_sc36);\n float ANGLE_sc38 = sin(ANGLE_sc37);\n float ANGLE_sc39 = (ANGLE_sc38 + 1.5);\n float ANGLE_sc3a = (_up.z * ANGLE_sc39);\n _up.z = cos(ANGLE_sc3a);\n {\n _us = 2.0;\n float ANGLE_sc3c = (_us++);\n bool ANGLE_sbe9 = (ANGLE_sc3c < 15.0);\n while (ANGLE_sbe9)\n {\n {\n ANGLE_loopForwardProgress();\n {\n }\n }\n vec3 ANGLE_sc3e = (_up * 1.04999995);\n float ANGLE_sc3 = (2.5999999 * iTime);\n vec3 ANGLE_sc40 = (_up.yzx * _us);\n vec3 ANGLE_sc41 = (ANGLE_sc3 + ANGLE_sc40);\n vec3 ANGLE_sc42 = sin(ANGLE_sc41);\n float ANGLE_sc43 = (iTime * 0.699999988);\n float ANGLE_sc44 = cos(ANGLE_sc43);\n float ANGLE_sc45 = (0.125 * ANGLE_sc44);\n vec3 ANGLE_sc46 = (ANGLE_sc42 * ANGLE_sc45);\n _up = (ANGLE_sc3e + ANGLE_sc46);\n float ANGLE_sc48 = (_us++);\n ANGLE_sbe9 = (ANGLE_sc48 < 15.0);\n }\n }\n float ANGLE_sc4a = length(_up);\n float ANGLE_sc4b = (ANGLE_sc4a - 0.800000012);\n float ANGLE_sc4c = abs(ANGLE_sc4b);\n float ANGLE_sc4d = (0.100000001 * ANGLE_sc4c);\n float ANGLE_sc4 = _us = (0.00999999978 + ANGLE_sc4d);\n _ud += ANGLE_sc4;\n vec3 ANGLE_sc50 = (_up * vec3(0.899999976, 0.300000012, 0.200000003));\n vec3 ANGLE_sc51 = (ANGLE_sc50 - vec3(1.0, 4.0, 1.0));\n vec3 ANGLE_sc52 = sin(ANGLE_sc51);\n vec4 ANGLE_sc53 = ANGLE_sc13(ANGLE_sc52, 0);\n vec4 ANGLE_sc54 = (ANGLE_sc53 / _us);\n _uo += ANGLE_sc54;\n }\n }\n float ANGLE_sc55 = (_ui++);\n ANGLE_sbe8 = (ANGLE_sc55 < 50.0);\n }\n }\n vec4 ANGLE_sc57 = (_uo * _uo);\n vec4 ANGLE_sc58 = (ANGLE_sc57 / 1000000.0);\n vec4 ANGLE_sc59 = tanh(ANGLE_sc58);\n float ANGLE_sc5a = dot(_uu, _uu);\n float ANGLE_sc5b = (0.200000003 * ANGLE_sc5a);\n float ANGLE_sc5c = (1.0 - ANGLE_sc5b);\n _uo = (ANGLE_sc59 * ANGLE_sc5c);\n}\n\n\n\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) { _umainImage(fragColor, fragCoord); }", - "views": 14387, - "likes": 77, - "createdAt": "2026-04-01T12:24:12.354Z", - "updatedAt": "2026-04-01T13:31:34.477Z", - "sourceFormat": "angle-metal-auto-converted" - }, - { - "id": "7be053e5-33c9-4ecc-a6dc-b0e258f8bebe", + "id": "07545078-a585-4e2b-b35e-66f75f080bbd", "name": "星云", "author": "unknown", - "code": "void ANGLE_loopForwardProgress() {}\n\n\n\nvec2 ANGLE_sc50(float ANGLE_sc51, float ANGLE_sc52)\n{\n vec2 ANGLE_sc53 = vec2(ANGLE_sc51, ANGLE_sc52);\n return ANGLE_sc53;\n}\n\n\n\nvec2 ANGLE_sc4d(float ANGLE_sc4e, float ANGLE_sc4)\n{\n vec2 ANGLE_sc54 = vec2(ANGLE_sc4e, ANGLE_sc4);\n return ANGLE_sc54;\n}\n\n\n\nvec4 ANGLE_sc4a(vec3 ANGLE_sc4b, float ANGLE_sc4c)\n{\n vec4 ANGLE_sc55 = vec4(ANGLE_sc4b.x, ANGLE_sc4b.y, ANGLE_sc4b.z, ANGLE_sc4c);\n return ANGLE_sc55;\n}\n\n\n\nvec4 ANGLE_sc45(float ANGLE_sc46, float ANGLE_sc47, float ANGLE_sc48, float ANGLE_sc49)\n{\n vec4 ANGLE_sc56 = vec4(ANGLE_sc46, ANGLE_sc47, ANGLE_sc48, ANGLE_sc49);\n return ANGLE_sc56;\n}\n\n\n\nvec4 ANGLE_sc41(vec2 ANGLE_sc42, float ANGLE_sc43, int ANGLE_sc44)\n{\n float ANGLE_sc57 = float(ANGLE_sc44);\n vec4 ANGLE_sc58 = vec4(ANGLE_sc42.x, ANGLE_sc42.y, ANGLE_sc43, ANGLE_sc57);\n return ANGLE_sc58;\n}\n\n\n\nvec3 ANGLE_sc3e(vec2 ANGLE_sc3, float ANGLE_sc40)\n{\n vec3 ANGLE_sc59 = vec3(ANGLE_sc3.x, ANGLE_sc3.y, ANGLE_sc40);\n return ANGLE_sc59;\n}\n\n\n\nvec3 ANGLE_sc3a(float ANGLE_sc3b, float ANGLE_sc3c, float ANGLE_sc3d)\n{\n vec3 ANGLE_sc5a = vec3(ANGLE_sc3b, ANGLE_sc3c, ANGLE_sc3d);\n return ANGLE_sc5a;\n}\n\n\n\nvec2 ANGLE_sc37(float ANGLE_sc38, float ANGLE_sc39)\n{\n vec2 ANGLE_sc5b = vec2(ANGLE_sc38, ANGLE_sc39);\n return ANGLE_sc5b;\n}\n\n\n\nvec2 ANGLE_sc34(int ANGLE_sc35, int ANGLE_sc36)\n{\n float ANGLE_sc5c = float(ANGLE_sc35);\n float ANGLE_sc5d = float(ANGLE_sc36);\n vec2 ANGLE_sc5e = vec2(ANGLE_sc5c, ANGLE_sc5d);\n return ANGLE_sc5e;\n}\n\n\n\nfloat _uStar(vec2 _uuv, float _uflare)\n{\n float _ud = length(_uuv);\n float _um = (0.029995501 / _ud);\n float ANGLE_sc61 = (_uuv.x * _uuv.y);\n float ANGLE_sc62 = (ANGLE_sc61 * 1000.0);\n float ANGLE_sc63 = abs(ANGLE_sc62);\n float ANGLE_sc64 = (0.5 - ANGLE_sc63);\n float _urays = max(0.0, ANGLE_sc64);\n float ANGLE_sc66 = (_urays * _uflare);\n float ANGLE_sc67 = (ANGLE_sc66 * 2.0);\n _um += ANGLE_sc67;\n float ANGLE_sc68 = smoothstep(1.0, 0.100000001, _ud);\n _um *= ANGLE_sc68;\n return _um;\n}\n\n\n\nfloat _uHash21(vec2 _up)\n{\n vec2 ANGLE_sc69 = (_up * vec2(123.339996, 456.209991));\n _up = fract(ANGLE_sc69);\n vec2 ANGLE_sc6b = (_up + 45.3199997);\n float ANGLE_sc6c = dot(_up, ANGLE_sc6b);\n _up += ANGLE_sc6c;\n float ANGLE_sc6d = (_up.x * _up.y);\n float ANGLE_sc6e = fract(ANGLE_sc6d);\n return ANGLE_sc6e;\n}\n\n\n\nvec3 _uStarLayer( vec2 _uuv)\n{\n vec3 _ucol = vec3(0.0, 0.0, 0.0);\n vec2 _ugv = fract(_uuv);\n vec2 _uid = floor(_uuv);\n {\n int _uy = -1;\n bool ANGLE_sc0b = (_uy <= 1);\n while (ANGLE_sc0b)\n {\n {\n {\n int _ux = -1;\n bool ANGLE_sc0c = (_ux <= 1);\n while (ANGLE_sc0c)\n {\n {\n vec2 _uoffs = ANGLE_sc34(_ux, _uy);\n vec2 ANGLE_sc74 = (_uid + _uoffs);\n float _un = _uHash21(ANGLE_sc74);\n float _usize = fract(_un);\n vec2 ANGLE_sc77 = (_ugv - _uoffs);\n float ANGLE_sc78 = (_un * 34.0);\n float ANGLE_sc79 = fract(ANGLE_sc78);\n vec2 ANGLE_sc7a = ANGLE_sc37(_un, ANGLE_sc79);\n vec2 ANGLE_sc7b = (ANGLE_sc77 - ANGLE_sc7a);\n vec2 ANGLE_sc7c = (ANGLE_sc7b + 0.5);\n float ANGLE_sc7d = smoothstep(0.100000001, 0.899999976, _usize);\n float ANGLE_sc7e = (ANGLE_sc7d * 0.460000008);\n float _ustar = _uStar(ANGLE_sc7c, ANGLE_sc7e);\n float ANGLE_sc80 = (_un * 2345.19995);\n float ANGLE_sc81 = fract(ANGLE_sc80);\n vec3 ANGLE_sc82 = (vec3(0.200000003, 0.300000012, 0.899999976) * ANGLE_sc81);\n vec3 ANGLE_sc83 = (ANGLE_sc82 * 6.28318024);\n vec3 ANGLE_sc84 = sin(ANGLE_sc83);\n vec3 ANGLE_sc85 = (ANGLE_sc84 * 0.25);\n vec3 _ucolor = (ANGLE_sc85 + 0.75);\n float ANGLE_sc87 = (0.899999976 + _usize);\n vec3 ANGLE_sc88 = ANGLE_sc3a(0.899999976, 0.589999974, ANGLE_sc87);\n _ucolor = (_ucolor * ANGLE_sc88);\n float ANGLE_sc8a = (iTime * 0.600000024);\n float ANGLE_sc8b = (_un * 6.28318024);\n float ANGLE_sc8c = (ANGLE_sc8a + ANGLE_sc8b);\n float ANGLE_sc8d = sin(ANGLE_sc8c);\n float ANGLE_sc8e = (ANGLE_sc8d * 0.5);\n float ANGLE_sc8 = (ANGLE_sc8e + 0.5);\n _ustar *= ANGLE_sc8;\n float ANGLE_sc90 = (_ustar * _usize);\n vec3 ANGLE_sc91 = (ANGLE_sc90 * _ucolor);\n _ucol += ANGLE_sc91;\n }\n _ux++;\n ANGLE_sc0c = (_ux <= 1);\n }\n }\n }\n _uy++;\n ANGLE_sc0b = (_uy <= 1);\n }\n }\n return _ucol;\n}\n\n\n\nvoid _umainImage(out vec4 _ufragColor, vec2 _ufragCoord)\n{\n _uo = vec4(0.0, 0.0, 0.0, 0.0);\n float _ui = 0.0;\n float _us = 0.0;\n vec3 _up = vec3(0.0, 0.0, 0.0);\n vec3 _ur = iResolution;\n vec4 _uo2 = _uo;\n vec2 _uF = _uu;\n vec2 ANGLE_sc94 = (0.5 * iResolution.xy);\n vec2 ANGLE_sc95 = (_uu - ANGLE_sc94);\n vec2 _uuv = (ANGLE_sc95 / iResolution.y);\n vec2 _uM = vec2(0.0, 0.0);\n float _ut = (iTime * 0.0);\n vec3 _ucol = vec3(0.0, 0.0, 0.0);\n {\n float _ui = 0.0;\n bool ANGLE_sc0d = (_ui < 1.0);\n while (ANGLE_sc0d)\n {\n {\n ANGLE_loopForwardProgress();\n {\n float ANGLE_sc99 = (_ui + _ut);\n float _udepth = fract(ANGLE_sc99);\n float _uscale = mix(20.0, 0.5, _udepth);\n float ANGLE_sc9c = smoothstep(1.0, 0.899999976, _udepth);\n float _ufade = (_udepth * ANGLE_sc9c);\n vec2 ANGLE_sc9e = (_uuv * _uscale);\n float ANGLE_sc9 = (_ui * 453.200012);\n vec2 ANGLE_sca0 = (ANGLE_sc9e + ANGLE_sc9);\n float ANGLE_sca1 = (iTime * 0.0500000007);\n vec2 ANGLE_sca2 = (ANGLE_sca0 - ANGLE_sca1);\n vec2 ANGLE_sca3 = (ANGLE_sca2 + _uM);\n vec3 ANGLE_sca4 = _uStarLayer(ANGLE_userUniforms, ANGLE_sca3);\n vec3 ANGLE_sca5 = (ANGLE_sca4 * _ufade);\n _ucol += ANGLE_sca5;\n }\n }\n _ui += 0.0833333358;\n ANGLE_sc0d = (_ui < 1.0);\n }\n }\n vec2 ANGLE_sca7 = (_uu + _uu);\n vec2 ANGLE_sca8 = (ANGLE_sca7 - _ur.xy);\n _uu = (ANGLE_sca8 / _ur.y);\n {\n _uo *= _ui;\n float ANGLE_scaa = (_ui++);\n bool ANGLE_sc0e = (ANGLE_scaa < 100.0);\n while (ANGLE_sc0e)\n {\n {\n ANGLE_loopForwardProgress();\n {\n vec2 ANGLE_scac = (_uu * _us);\n vec3 ANGLE_scad = ANGLE_sc3e(ANGLE_scac, _us);\n _up += ANGLE_scad;\n _us = (6.0 + _up.y);\n float ANGLE_scaf = (0.100000001 * _up.z);\n float ANGLE_scb0 = (iTime + ANGLE_scaf);\n vec3 ANGLE_scb1 = (0.300000012 * _up);\n vec3 ANGLE_scb2 = (ANGLE_scb1 / 0.0799999982);\n vec3 ANGLE_scb3 = (ANGLE_scb0 + ANGLE_scb2);\n vec3 ANGLE_scb4 = sin(ANGLE_scb3);\n float ANGLE_scb5 = dot(ANGLE_scb4, vec3(0.159999996, 0.159999996, 0.159999996));\n float ANGLE_scb6 = abs(ANGLE_scb5);\n _us -= ANGLE_scb6;\n float ANGLE_scb7 = (0.100000001 * _up.z);\n float ANGLE_scb8 = (iTime + ANGLE_scb7);\n vec3 ANGLE_scb9 = (0.300000012 * _up);\n vec3 ANGLE_scba = (ANGLE_scb9 / 0.200000003);\n vec3 ANGLE_scbb = (ANGLE_scb8 + ANGLE_scba);\n vec3 ANGLE_scbc = sin(ANGLE_scbb);\n float ANGLE_scbd = dot(ANGLE_scbc, vec3(0.400000006, 0.400000006, 0.400000006));\n float ANGLE_scbe = abs(ANGLE_scbd);\n _us -= ANGLE_scbe;\n float ANGLE_scbf = (0.100000001 * _up.z);\n float ANGLE_scc0 = (iTime + ANGLE_scbf);\n vec3 ANGLE_scc1 = (0.300000012 * _up);\n vec3 ANGLE_scc2 = (ANGLE_scc1 / 0.600000024);\n vec3 ANGLE_scc3 = (ANGLE_scc0 + ANGLE_scc2);\n vec3 ANGLE_scc4 = sin(ANGLE_scc3);\n float ANGLE_scc5 = dot(ANGLE_scc4, vec3(1.20000005, 1.20000005, 1.20000005));\n float ANGLE_scc6 = abs(ANGLE_scc5);\n _us -= ANGLE_scc6;\n float ANGLE_scc7 = abs(_us);\n float ANGLE_scc8 = (ANGLE_scc7 * 0.200000003);\n _us = (0.100000001 + ANGLE_scc8);\n vec4 ANGLE_scca = (vec4(4.0, 2.0, 1.0, 0.0) / _us);\n _uo += ANGLE_scca;\n }\n }\n float ANGLE_sccb = (_ui++);\n ANGLE_sc0e = (ANGLE_sccb < 100.0);\n }\n }\n float ANGLE_sccd = abs(_uu.y);\n float ANGLE_scce = smoothstep(0.800000012, 0.75, ANGLE_sccd);\n _uo *= ANGLE_scce;\n vec2 _uR = iResolution.xy;\n _uo2 -= _uo2;\n {\n float _ud = 0.0;\n float ANGLE_sccf = (-iTime);\n float _ut = (ANGLE_sccf * 0.00499999989);\n float _ui = 0.0;\n bool ANGLE_sc0 = (_ui > -1.0);\n while (ANGLE_sc0)\n {\n {\n ANGLE_loopForwardProgress();\n {\n float ANGLE_scd2 = (3.0 * _ut);\n float ANGLE_scd3 = (_ui - ANGLE_scd2);\n _ud = fract(ANGLE_scd3);\n vec2 ANGLE_scd5 = (_uR * 0.5);\n vec2 ANGLE_scd6 = (_uF - ANGLE_scd5);\n vec2 ANGLE_scd7 = (ANGLE_scd6 / _uR.y);\n vec2 ANGLE_scd8 = (ANGLE_scd7 * _ud);\n vec4 ANGLE_scd9 = ANGLE_sc41(ANGLE_scd8, _ui, 0);\n vec4 _uc = (ANGLE_scd9 * 28.0);\n {\n int _uj = 0;\n int ANGLE_scdb = (_uj++);\n bool ANGLE_sc10 = (ANGLE_scdb < 27);\n while (ANGLE_sc10)\n {\n {\n ANGLE_loopForwardProgress();\n {\n float ANGLE_scdd = dot(_uc, _uc);\n vec4 ANGLE_scde = (_uc / ANGLE_scdd);\n float ANGLE_scdf = sin(_ut);\n float ANGLE_sce0 = (0.200000003 * ANGLE_scdf);\n float ANGLE_sce1 = (7.0 - ANGLE_sce0);\n float ANGLE_sce2 = (_ut / 0.800000012);\n float ANGLE_sce3 = cos(ANGLE_sce2);\n float ANGLE_sce4 = (1.0 - ANGLE_sce3);\n vec4 ANGLE_sce5 = ANGLE_sc45(ANGLE_sce1, 6.30000019, 0.699999988, ANGLE_sce4);\n vec4 ANGLE_sce6 = (ANGLE_sce5 / 7.0);\n vec4 ANGLE_sce7 = (ANGLE_scde - ANGLE_sce6);\n _uc.xzyw = abs(ANGLE_sce7);\n }\n }\n int ANGLE_sce9 = (_uj++);\n ANGLE_sc10 = (ANGLE_sce9 < 27);\n }\n }\n vec4 ANGLE_sceb = (_uc * _uc.yzww);\n float ANGLE_scec = (_ud--);\n vec4 ANGLE_sced = (ANGLE_sceb * ANGLE_scec);\n vec4 ANGLE_scee = (ANGLE_sced * _ud);\n vec4 ANGLE_scef = (ANGLE_scee / vec4(3.0, 5.0, 1.0, 1.0));\n _uo2 -= ANGLE_scef;\n }\n }\n _ui -= 0.0599999987;\n ANGLE_sc0 = (_ui > -1.0);\n }\n }\n _uo += _uo2;\n vec4 ANGLE_scf1 = (_uo / 2000.0);\n float ANGLE_scf2 = length(_uu);\n vec4 ANGLE_scf3 = (ANGLE_scf1 / ANGLE_scf2);\n _uo = tanh(ANGLE_scf3);\n float _ustarMask = smoothstep(-0.400000006, 0.100000001, _uu.y);\n vec3 ANGLE_scf6 = (_ucol * _ustarMask);\n vec3 ANGLE_scf7 = (ANGLE_scf6 * _uo2.xyz);\n vec3 ANGLE_scf8 = (ANGLE_scf7 * 12.0);\n _uo.xyz = (_uo.xyz + ANGLE_scf8);\n}\n\n\n\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) { _umainImage(fragColor, fragCoord); }", - "views": 3190, - "likes": 385, - "createdAt": "2026-04-01T12:19:57.972Z", - "updatedAt": "2026-04-01T13:31:34.478Z", - "sourceFormat": "angle-metal-auto-converted" + "code": "#define N(a) abs(dot(sin(iTime+.1*p.z+.3*p / a), vec3(a+a)))\n#define NUM_LAYERS 12.\n#define TAU 6.28318\n#define PI 3.141592\n#define Velocity .025 //modified value to increse or decrease speed, negative value travel backwards\n#define StarGlow 0.025\n#define StarSize 02.\n#define CanvasView 20.\n\n\nfloat Star(vec2 uv, float flare){\n float d = length(uv);\n \tfloat m = sin(StarGlow*1.2)/d; \n float rays = max(0., .5-abs(uv.x*uv.y*1000.)); \n m += (rays*flare)*2.;\n m *= smoothstep(1., .1, d);\n return m;\n}\n\nfloat Hash21(vec2 p){\n p = fract(p*vec2(123.34, 456.21));\n p += dot(p, p+45.32);\n return fract(p.x*p.y);\n}\n\n\nvec3 StarLayer(vec2 uv){\n vec3 col = vec3(0);\n vec2 gv = fract(uv);\n vec2 id = floor(uv);\n for(int y=-1;y<=1;y++){\n for(int x=-1; x<=1; x++){\n vec2 offs = vec2(x,y);\n float n = Hash21(id+offs);\n float size = fract(n);\n float star = Star(gv-offs-vec2(n, fract(n*34.))+.5, smoothstep(.1,.9,size)*.46);\n vec3 color = sin(vec3(.2,.3,.9)*fract(n*2345.2)*TAU)*.25+.75;\n color = color*vec3(.9,.59,.9+size);\n star *= sin(iTime*.6+n*TAU)*.5+.5;\n col += star*size*color;\n }\n }\n return col;\n}\n\n\nvoid mainImage(out vec4 o, vec2 u) {\n float i,s;\n vec3 p,r = iResolution; \n \n vec4 o2=o;\n vec2 F =u;\n \n vec2 uv = (u-.5*iResolution.xy)/iResolution.y;\n\tvec2 M = vec2(0);\n\n float t = iTime*.0; \n vec3 col = vec3(0); \n for(float i=0.; i<1.; i+=1./NUM_LAYERS){\n float depth = fract(i+t);\n float scale = mix(CanvasView, .5, depth);\n float fade = depth*smoothstep(1.,.9,depth);\n col += StarLayer(uv*scale+i*453.2-iTime*.05+M)*fade;} \n \n \n \n u = (u+u-r.xy)/r.y;\n \n \n for(o*=i; i++<1e2; ) {\n p += vec3(u * s, s);\n s = 6.+(p.y);\n s -= N(.08);\n s -= N(.2);\n s -= N(.6);\n s = .1 + abs(s)*.2;\n o += vec4(4,2,1,0)/s;\n }\n \n o *= smoothstep(0.8, 0.75, abs(u.y));\n \n vec2 R = iResolution.xy; \n o2-=o2;\n for(float d,t = -iTime*.005, i = 0. ; i > -1.; i -= .06 ) \t\n { d = fract( i -3.*t ); \t\n vec4 c = vec4( ( F - R *.5 ) / R.y *d ,i,0 ) * 28.; \t\n for (int j=0 ; j++ <27; ) \t\n c.xzyw = abs( c / dot(c,c) \t\n -vec4( 7.-.2*sin(t) , 6.3 , .7 , 1.-cos(t/.8))/7.);\t\n o2 -= c * c.yzww * d--*d / vec4(3,5,1,1); \n }\n o+=o2;\n \n o = tanh(o / 2e3 / length(u));\n\n float starMask = smoothstep(-0.4, 0.1, u.y);\n \n o.rgb += col * starMask*o2.xyz*12.;\n \n}", + "views": 3552, + "likes": 195, + "createdAt": "2026-04-01T15:25:55.867Z", + "sourceFormat": "glsl", + "updatedAt": "2026-04-01T15:26:50.214Z" }, { - "id": "c8775e7b-d592-4e58-8442-dd77f3364e95", - "name": "云光", + "id": "d90c5b45-858f-41ca-a826-28ab3444188b", + "name": "雪花", "author": "unknown", - "code": "void ANGLE_loopForwardProgress() {}\n\n\n\nvec2 ANGLE_sc1b(float ANGLE_sc1c, float ANGLE_sc1d)\n{\n vec2 ANGLE_sc1e = vec2(ANGLE_sc1c, ANGLE_sc1d);\n return ANGLE_sc1e;\n}\n\n\n\nvec2 ANGLE_sc18(float ANGLE_sc19, float ANGLE_sc1a)\n{\n vec2 ANGLE_sc1 = vec2(ANGLE_sc19, ANGLE_sc1a);\n return ANGLE_sc1;\n}\n\n\n\nvec4 ANGLE_sc15(vec3 ANGLE_sc16, float ANGLE_sc17)\n{\n vec4 ANGLE_sc20 = vec4(ANGLE_sc16.x, ANGLE_sc16.y, ANGLE_sc16.z, ANGLE_sc17);\n return ANGLE_sc20;\n}\n\n\n\nvec4 ANGLE_sc12(vec3 ANGLE_sc13, float ANGLE_sc14)\n{\n vec4 ANGLE_sc21 = vec4(ANGLE_sc13.x, ANGLE_sc13.y, ANGLE_sc13.z, ANGLE_sc14);\n return ANGLE_sc21;\n}\n\n\n\nvec3 _upalette(float _ut)\n{\n vec3 _ua = vec3(0.5, 0.5, 0.5);\n vec3 _ub = vec3(0.5, 0.5, 0.5);\n vec3 _uc = vec3(1.0, 1.0, 1.0);\n vec3 _ud = vec3(0.263000011, 0.416000009, 0.556999981);\n vec3 ANGLE_sc22 = (_uc * _ut);\n vec3 ANGLE_sc23 = (ANGLE_sc22 + _ud);\n vec3 ANGLE_sc24 = (6.28318024 * ANGLE_sc23);\n vec3 ANGLE_sc25 = cos(ANGLE_sc24);\n vec3 ANGLE_sc26 = (_ub * ANGLE_sc25);\n vec3 ANGLE_sc27 = (_ua + ANGLE_sc26);\n return ANGLE_sc27;\n}\n\n\n\nvoid _umainImage(out vec4 _ufragColor, vec2 _ufragCoord)\n{\n _ufragColor = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 ANGLE_sc28 = (_ufragCoord * 2.0);\n vec2 ANGLE_sc29 = (ANGLE_sc28 - iResolution.xy);\n vec2 _uuv = (ANGLE_sc29 / iResolution.y);\n vec2 _uuv0 = _uuv;\n vec3 _ufinalColor = vec3(0.0, 0.0, 0.0);\n {\n float _ui = 0.0;\n bool ANGLE_sbee = (_ui < 4.0);\n while (ANGLE_sbee)\n {\n {\n ANGLE_loopForwardProgress();\n {\n vec2 ANGLE_sc2c = (_uuv * 1.5);\n vec2 ANGLE_sc2d = fract(ANGLE_sc2c);\n _uuv = (ANGLE_sc2d - 0.5);\n float ANGLE_sc2 = length(_uuv);\n float ANGLE_sc30 = length(_uuv0);\n float ANGLE_sc31 = (-ANGLE_sc30);\n float ANGLE_sc32 = exp(ANGLE_sc31);\n float _ud = (ANGLE_sc2 * ANGLE_sc32);\n float ANGLE_sc34 = length(_uuv0);\n float ANGLE_sc35 = (_ui * 0.400000006);\n float ANGLE_sc36 = (ANGLE_sc34 + ANGLE_sc35);\n float ANGLE_sc37 = (iTime * 0.400000006);\n float ANGLE_sc38 = (ANGLE_sc36 + ANGLE_sc37);\n vec3 _ucol = _upalette(ANGLE_sc38);\n float ANGLE_sc3a = (_ud * 8.0);\n float ANGLE_sc3b = (ANGLE_sc3a + iTime);\n float ANGLE_sc3c = sin(ANGLE_sc3b);\n _ud = (ANGLE_sc3c / 8.0);\n _ud = abs(_ud);\n float ANGLE_sc3 = (0.00999999978 / _ud);\n _ud = powr(ANGLE_sc3, 1.20000005);\n vec3 ANGLE_sc41 = (_ucol * _ud);\n _ufinalColor += ANGLE_sc41;\n }\n }\n _ui++;\n ANGLE_sbee = (_ui < 4.0);\n }\n }\n _ufragColor = ANGLE_sc12(_ufinalColor, 1.0);\n}\n\n\n\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) { _umainImage(fragColor, fragCoord); }", - "views": 17430, - "likes": 297, - "createdAt": "2026-04-01T12:18:41.938Z", - "updatedAt": "2026-04-01T13:31:34.478Z", - "sourceFormat": "angle-metal-auto-converted" + "code": "precision highp float;\n\n\nfloat gTime = 0.;\nconst float REPEAT = 5.0;\n\n// 回転行列\nmat2 rot(float a) {\n\tfloat c = cos(a), s = sin(a);\n\treturn mat2(c,s,-s,c);\n}\n\nfloat sdBox( vec3 p, vec3 b )\n{\n\tvec3 q = abs(p) - b;\n\treturn length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0);\n}\n\nfloat box(vec3 pos, float scale) {\n\tpos *= scale;\n\tfloat base = sdBox(pos, vec3(.4,.4,.1)) /1.5;\n\tpos.xy *= 5.;\n\tpos.y -= 3.5;\n\tpos.xy *= rot(.75);\n\tfloat result = -base;\n\treturn result;\n}\n\nfloat box_set(vec3 pos, float iTime) {\n\tvec3 pos_origin = pos;\n\tpos = pos_origin;\n\tpos .y += sin(gTime * 0.4) * 2.5;\n\tpos.xy *= rot(.8);\n\tfloat box1 = box(pos,2. - abs(sin(gTime * 0.4)) * 1.5);\n\tpos = pos_origin;\n\tpos .y -=sin(gTime * 0.4) * 2.5;\n\tpos.xy *= rot(.8);\n\tfloat box2 = box(pos,2. - abs(sin(gTime * 0.4)) * 1.5);\n\tpos = pos_origin;\n\tpos .x +=sin(gTime * 0.4) * 2.5;\n\tpos.xy *= rot(.8);\n\tfloat box3 = box(pos,2. - abs(sin(gTime * 0.4)) * 1.5);\t\n\tpos = pos_origin;\n\tpos .x -=sin(gTime * 0.4) * 2.5;\n\tpos.xy *= rot(.8);\n\tfloat box4 = box(pos,2. - abs(sin(gTime * 0.4)) * 1.5);\t\n\tpos = pos_origin;\n\tpos.xy *= rot(.8);\n\tfloat box5 = box(pos,.5) * 6.;\t\n\tpos = pos_origin;\n\tfloat box6 = box(pos,.5) * 6.;\t\n\tfloat result = max(max(max(max(max(box1,box2),box3),box4),box5),box6);\n\treturn result;\n}\n\nfloat map(vec3 pos, float iTime) {\n\tvec3 pos_origin = pos;\n\tfloat box_set1 = box_set(pos, iTime);\n\n\treturn box_set1;\n}\n\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord ) {\n\tvec2 p = (fragCoord.xy * 2. - iResolution.xy) / min(iResolution.x, iResolution.y);\n\tvec3 ro = vec3(0., -0.2 ,iTime * 4.);\n\tvec3 ray = normalize(vec3(p, 1.5));\n\tray.xy = ray.xy * rot(sin(iTime * .03) * 5.);\n\tray.yz = ray.yz * rot(sin(iTime * .05) * .2);\n\tfloat t = 0.1;\n\tvec3 col = vec3(0.);\n\tfloat ac = 0.0;\n\n\n\tfor (int i = 0; i < 99; i++){\n\t\tvec3 pos = ro + ray * t;\n\t\tpos = mod(pos-2., 4.) -2.;\n\t\tgTime = iTime -float(i) * 0.01;\n\t\t\n\t\tfloat d = map(pos, iTime);\n\n\t\td = max(abs(d), 0.01);\n\t\tac += exp(-d*23.);\n\n\t\tt += d* 0.55;\n\t}\n\n\tcol = vec3(ac * 0.02);\n\n\tcol +=vec3(0.,0.2 * abs(sin(iTime)),0.5 + sin(iTime) * 0.2);\n\n\n\tfragColor = vec4(col ,1.0 - t * (0.02 + 0.02 * sin (iTime)));\n}\n\n/** SHADERDATA\n{\n\t\"title\": \"Octgrams\",\n\t\"description\": \"Lorem ipsum dolor\",\n\t\"model\": \"person\"\n}\n*/", + "views": 23855, + "likes": 545, + "createdAt": "2026-04-01T15:24:44.569Z", + "sourceFormat": "glsl", + "updatedAt": "2026-04-01T15:26:50.214Z" }, { - "id": "abed41ac-a1fc-491e-815d-a38a34220993", - "name": "蜂窝", + "id": "a5e23f6d-aa92-4ed1-9cea-4ba04181e3ff", + "name": "冰层", "author": "unknown", - "code": "void ANGLE_loopForwardProgress() {}\n\n\nvec2 ANGLE_sc6(float ANGLE_sc70, float ANGLE_sc71)\n{\n vec2 ANGLE_sc72 = vec2(ANGLE_sc70, ANGLE_sc71);\n return ANGLE_sc72;\n}\n\n\n\nvec2 ANGLE_sc6c(float ANGLE_sc6d, float ANGLE_sc6e)\n{\n vec2 ANGLE_sc73 = vec2(ANGLE_sc6d, ANGLE_sc6e);\n return ANGLE_sc73;\n}\n\n\n\nvec4 ANGLE_sc69(vec3 ANGLE_sc6a, float ANGLE_sc6b)\n{\n vec4 ANGLE_sc74 = vec4(ANGLE_sc6a.x, ANGLE_sc6a.y, ANGLE_sc6a.z, ANGLE_sc6b);\n return ANGLE_sc74;\n}\n\n\n\nvec4 ANGLE_sc66(vec3 ANGLE_sc67, float ANGLE_sc68)\n{\n vec4 ANGLE_sc75 = vec4(ANGLE_sc67.x, ANGLE_sc67.y, ANGLE_sc67.z, ANGLE_sc68);\n return ANGLE_sc75;\n}\n\n\n\nvec2 ANGLE_sc63(float ANGLE_sc64, float ANGLE_sc65)\n{\n vec2 ANGLE_sc76 = vec2(ANGLE_sc64, ANGLE_sc65);\n return ANGLE_sc76;\n}\n\n\n\nvec2 ANGLE_sc60(float ANGLE_sc61, float ANGLE_sc62)\n{\n vec2 ANGLE_sc77 = vec2(ANGLE_sc61, ANGLE_sc62);\n return ANGLE_sc77;\n}\n\n\n\nvec2 ANGLE_sc5d(float ANGLE_sc5e, float ANGLE_sc5)\n{\n vec2 ANGLE_sc78 = vec2(ANGLE_sc5e, ANGLE_sc5);\n return ANGLE_sc78;\n}\n\n\n\nvec4 ANGLE_sc59(float ANGLE_sc5a, float ANGLE_sc5b, vec2 ANGLE_sc5c)\n{\n vec4 ANGLE_sc79 = vec4(ANGLE_sc5a, ANGLE_sc5b, ANGLE_sc5c.x, ANGLE_sc5c.y);\n return ANGLE_sc79;\n}\n\n\n\nvec2 ANGLE_sc56(float ANGLE_sc57, float ANGLE_sc58)\n{\n vec2 ANGLE_sc7a = vec2(ANGLE_sc57, ANGLE_sc58);\n return ANGLE_sc7a;\n}\n\n\n\nvec2 ANGLE_sc53(float ANGLE_sc54, float ANGLE_sc55)\n{\n vec2 ANGLE_sc7b = vec2(ANGLE_sc54, ANGLE_sc55);\n return ANGLE_sc7b;\n}\n\n\n\nvec2 ANGLE_sc50(float ANGLE_sc51, float ANGLE_sc52)\n{\n vec2 ANGLE_sc7c = vec2(ANGLE_sc51, ANGLE_sc52);\n return ANGLE_sc7c;\n}\n\n\n\nvec2 _uhexCenter(vec2 _uid)\n{\n float ANGLE_sc7d = (_uid.x * 1.73205078);\n float ANGLE_sc7e = (ANGLE_sc7d / 2.0);\n float ANGLE_sc7 = (_uid.x * 0.5);\n float ANGLE_sc80 = (_uid.y - ANGLE_sc7);\n vec2 ANGLE_sc81 = ANGLE_sc50(ANGLE_sc7e, ANGLE_sc80);\n return ANGLE_sc81;\n}\n\n\n\nvec4 _uhexVoronoi(vec2 _up)\n{\n float ANGLE_sc82 = (_up.x * 2.0);\n float ANGLE_sc83 = (ANGLE_sc82 / 1.73205078);\n float ANGLE_sc84 = (_up.x * 0.5);\n float ANGLE_sc85 = (_up.y + ANGLE_sc84);\n vec2 _uq = ANGLE_sc53(ANGLE_sc83, ANGLE_sc85);\n vec2 _ubase = floor(_uq);\n float _uf1 = 1000000000.0;\n float _uf2 = 1000000000.0;\n vec2 _ubestId = vec2(0.0, 0.0);\n {\n int _uj = -2;\n bool ANGLE_sc2a = (_uj <= 2);\n while (ANGLE_sc2a)\n {\n {\n {\n int _ui = -2;\n bool ANGLE_sc2b = (_ui <= 2);\n while (ANGLE_sc2b)\n {\n {\n float ANGLE_sc8a = float(_ui);\n float ANGLE_sc8b = float(_uj);\n vec2 ANGLE_sc8c = ANGLE_sc56(ANGLE_sc8a, ANGLE_sc8b);\n vec2 _uid = (_ubase + ANGLE_sc8c);\n vec2 _uc = _uhexCenter(_uid);\n vec2 ANGLE_sc8 = (_up - _uc);\n float _ud = length(ANGLE_sc8);\n bool ANGLE_sc91 = (_ud < _uf1);\n if (ANGLE_sc91)\n {\n _uf2 = _uf1;\n _uf1 = _ud;\n _ubestId = _uid;\n }\n else\n {\n bool ANGLE_sc92 = (_ud < _uf2);\n if (ANGLE_sc92)\n {\n _uf2 = _ud;\n } else {}\n }\n }\n _ui++;\n ANGLE_sc2b = (_ui <= 2);\n }\n }\n }\n _uj++;\n ANGLE_sc2a = (_uj <= 2);\n }\n }\n vec4 ANGLE_sc95 = ANGLE_sc59(_uf1, _uf2, _ubestId);\n return ANGLE_sc95;\n}\n\n\n\nfloat _uhash21(vec2 _up)\n{\n vec2 ANGLE_sc96 = (_up * vec2(123.339996, 456.209991));\n _up = fract(ANGLE_sc96);\n vec2 ANGLE_sc98 = (_up + 45.3199997);\n float ANGLE_sc99 = dot(_up, ANGLE_sc98);\n _up += ANGLE_sc99;\n float ANGLE_sc9a = (_up.x * _up.y);\n float ANGLE_sc9b = fract(ANGLE_sc9a);\n return ANGLE_sc9b;\n}\n\n\n\nfloat _ufftSample( float _ux)\n{\n _ux = clamp(_ux, 0.0, 1.0);\n vec2 ANGLE_sc9d = ANGLE_sc5d(_ux, 0.25);\n vec4 ANGLE_sc9e = vec4(0.0);\n return ANGLE_sc9e.x;\n}\n\n\n\nfloat _uwaveSample( float _ux)\n{\n _ux = clamp(_ux, 0.0, 1.0);\n vec2 ANGLE_sca0 = ANGLE_sc60(_ux, 0.75);\n vec4 ANGLE_sca1 = vec4(0.0);\n return ANGLE_sca1.x;\n}\n\n\n\nvoid _umainImage(out vec4 _ufragColor, vec2 _ufragCoord)\n{\n _ufragColor = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 ANGLE_sca2 = (0.5 * iResolution.xy);\n vec2 ANGLE_sca3 = (_ufragCoord - ANGLE_sca2);\n vec2 _uuv = (ANGLE_sca3 / iResolution.y);\n float _uscale = 16.0;\n _uuv *= _uscale;\n vec2 _umouse = iMouse.xy;\n bool ANGLE__1 = (_umouse.x <= 0.0);\n if (ANGLE__1)\n {\n ANGLE__1 = (_umouse.y <= 0.0);\n } else {}\n if (ANGLE__1)\n {\n _umouse = (0.5 * iResolution.xy);\n } else {}\n vec2 ANGLE_sca9 = (0.5 * iResolution.xy);\n vec2 ANGLE_scaa = (_umouse - ANGLE_sca9);\n vec2 _upulseOrigin = (ANGLE_scaa / iResolution.y);\n _upulseOrigin *= _uscale;\n vec2 _urel = (_uuv - _upulseOrigin);\n float _ur = length(_urel);\n vec2 ANGLE_scae = (_urel + 9.99999975e-05);\n vec2 _udir = normalize(ANGLE_scae);\n float _ubassA = _ufftSample(ANGLE_textureEnvs, 0.00999999978);\n float _ubassB = _ufftSample(ANGLE_textureEnvs, 0.0199999996);\n float _ubassC = _ufftSample(ANGLE_textureEnvs, 0.0399999991);\n float _ubassD = _ufftSample(ANGLE_textureEnvs, 0.0799999982);\n float ANGLE_scb4 = (_ubassA * 0.400000006);\n float ANGLE_scb5 = (_ubassB * 0.300000012);\n float ANGLE_scb6 = (ANGLE_scb4 + ANGLE_scb5);\n float ANGLE_scb7 = (_ubassC * 0.200000003);\n float ANGLE_scb8 = (ANGLE_scb6 + ANGLE_scb7);\n float ANGLE_scb9 = (_ubassD * 0.100000001);\n float _ubass = (ANGLE_scb8 + ANGLE_scb9);\n float ANGLE_scbb = _ufftSample(ANGLE_textureEnvs, 0.119999997);\n float ANGLE_scbc = (ANGLE_scbb * 0.600000024);\n float ANGLE_scbd = _ufftSample(ANGLE_textureEnvs, 0.180000007);\n float ANGLE_scbe = (ANGLE_scbd * 0.400000006);\n float _ulowMid = (ANGLE_scbc + ANGLE_scbe);\n float ANGLE_scc0 = (iTime * 0.25);\n float ANGLE_scc1 = fract(ANGLE_scc0);\n float _uwave = _uwaveSample(ANGLE_textureEnvs, ANGLE_scc1);\n float ANGLE_scc3 = (_uwave * 2.0);\n _uwave = (ANGLE_scc3 - 1.0);\n float ANGLE_scc5 = clamp(_ubass, 0.0, 1.0);\n _ubass = powr(ANGLE_scc5, 0.75);\n float ANGLE_scc7 = (_ubass * 2.20000005);\n float ANGLE_scc8 = (_ulowMid * 0.600000024);\n float ANGLE_scc9 = (ANGLE_scc7 + ANGLE_scc8);\n float _uaudioDrive = clamp(ANGLE_scc9, 0.0, 1.5);\n float _uconeRadius = 2.4000001;\n float ANGLE_sccb = (_ur / _uconeRadius);\n float ANGLE_sccc = powr(ANGLE_sccb, 2.0);\n float ANGLE_sccd = (-ANGLE_sccc);\n float ANGLE_scce = (ANGLE_sccd * 2.20000005);\n float _uconeCore = exp(ANGLE_scce);\n float ANGLE_scd0 = (_ur - _uconeRadius);\n float ANGLE_scd1 = (ANGLE_scd0 / 0.899999976);\n float ANGLE_scd2 = powr(ANGLE_scd1, 2.0);\n float ANGLE_scd3 = (-ANGLE_scd2);\n float ANGLE_scd4 = (ANGLE_scd3 * 2.0);\n float _usurround = exp(ANGLE_scd4);\n float ANGLE_scd6 = (_ur * 7.5);\n float ANGLE_scd7 = (iTime * 18.0);\n float ANGLE_scd8 = (ANGLE_scd6 - ANGLE_scd7);\n float ANGLE_scd9 = sin(ANGLE_scd8);\n float ANGLE_scda = (ANGLE_scd9 * 0.649999976);\n float ANGLE_scdb = (_ur * 4.0);\n float ANGLE_scdc = (iTime * 10.0);\n float ANGLE_scdd = (ANGLE_scdb - ANGLE_scdc);\n float ANGLE_scde = sin(ANGLE_scdd);\n float ANGLE_scdf = (ANGLE_scde * 0.349999994);\n float _uripple = (ANGLE_scda + ANGLE_scdf);\n float ANGLE_sce1 = sign(_uripple);\n float ANGLE_sce2 = abs(_uripple);\n float ANGLE_sce3 = powr(ANGLE_sce2, 1.14999998);\n _uripple = (ANGLE_sce1 * ANGLE_sce3);\n float ANGLE_sce5 = (_uconeCore * _uaudioDrive);\n float _uconePush = (ANGLE_sce5 * 0.219999999);\n float ANGLE_sce7 = (_uripple * _uaudioDrive);\n float ANGLE_sce8 = (-_ur);\n float ANGLE_sce9 = (ANGLE_sce8 * 0.219999999);\n float ANGLE_scea = exp(ANGLE_sce9);\n float ANGLE_sceb = (ANGLE_sce7 * ANGLE_scea);\n float _uripplePush = (ANGLE_sceb * 0.0900000036);\n float ANGLE_sced = (_uwave * _uconeCore);\n float ANGLE_scee = (ANGLE_sced * 0.0149999997);\n float ANGLE_scef = (-_ur);\n float ANGLE_scf0 = (ANGLE_scef * 0.119999997);\n float ANGLE_scf1 = exp(ANGLE_scf0);\n float ANGLE_scf2 = (_uwave * ANGLE_scf1);\n float ANGLE_scf3 = (ANGLE_scf2 * 0.00600000005);\n float _ufineVibe = (ANGLE_scee + ANGLE_scf3);\n float ANGLE_scf5 = (_uconePush + _uripplePush);\n float ANGLE_scf6 = (ANGLE_scf5 + _ufineVibe);\n vec2 _udisplacement = (_udir * ANGLE_scf6);\n float ANGLE_scf8 = (-_udir.y);\n vec2 _utangent = ANGLE_sc63(ANGLE_scf8, _udir.x);\n vec2 ANGLE_scfa = (_utangent * _usurround);\n vec2 ANGLE_scfb = (ANGLE_scfa * _uwave);\n vec2 ANGLE_scfc = (ANGLE_scfb * _uaudioDrive);\n vec2 ANGLE_scfd = (ANGLE_scfc * 0.00800000038);\n _udisplacement += ANGLE_scfd;\n vec2 _up = (_uuv + _udisplacement);\n vec4 _uhv = _uhexVoronoi(_up);\n float _uf1 = _uhv.x;\n float _uf2 = _uhv.y;\n vec2 _ucellId = _uhv.zw;\n float _uborderMetric = (_uf2 - _uf1);\n float _uwall = 0.0500000007;\n float ANGLE_sd01 = (_uwall + 0.00800000038);\n float ANGLE_sd02 = smoothstep(_uwall, ANGLE_sd01, _uborderMetric);\n float _uframeMask = (1.0 - ANGLE_sd02);\n float ANGLE_sd04 = (_uwall + 0.00999999978);\n float ANGLE_sd05 = (_uwall + 0.0399999991);\n float _uinnerMask = smoothstep(ANGLE_sd04, ANGLE_sd05, _uborderMetric);\n float ANGLE_sd07 = (_uwall + 0.00300000003);\n float ANGLE_sd08 = (_uwall + 0.0120000001);\n float ANGLE_sd09 = smoothstep(ANGLE_sd07, ANGLE_sd08, _uborderMetric);\n float ANGLE_sd0a = (_uwall + 0.0120000001);\n float ANGLE_sd0b = (_uwall + 0.0299999993);\n float ANGLE_sd0c = smoothstep(ANGLE_sd0a, ANGLE_sd0b, _uborderMetric);\n float _urimMask = (ANGLE_sd09 - ANGLE_sd0c);\n vec3 _ubg = vec3(0.0399999991, 0.0450000018, 0.0500000007);\n vec3 _umetalBase = vec3(0.159999996, 0.180000007, 0.200000003);\n vec3 _umetalMid = vec3(0.319999993, 0.349999994, 0.379999995);\n vec3 _umetalHi = vec3(0.620000005, 0.660000026, 0.699999988);\n float _urnd = _uhash21(_ucellId);\n float ANGLE_sd0 = (_up.x * 18.0);\n float ANGLE_sd10 = (_up.y * 11.0);\n float ANGLE_sd11 = (ANGLE_sd0 + ANGLE_sd10);\n float ANGLE_sd12 = (_urnd * 2.0);\n float ANGLE_sd13 = (ANGLE_sd11 + ANGLE_sd12);\n float _ugrimeA = sin(ANGLE_sd13);\n float ANGLE_sd15 = (_up.x * 36.0);\n float ANGLE_sd16 = (_up.y * 24.0);\n float ANGLE_sd17 = (ANGLE_sd15 - ANGLE_sd16);\n float _ugrimeB = sin(ANGLE_sd17);\n float ANGLE_sd19 = (_ugrimeA + _ugrimeB);\n float ANGLE_sd1a = (ANGLE_sd19 * 0.25);\n float _ugrime = (ANGLE_sd1a + 0.5);\n float ANGLE_sd1c = (_uf1 * 20.0);\n float ANGLE_sd1d = (iTime * 10.0);\n float ANGLE_sd1e = (ANGLE_sd1c - ANGLE_sd1d);\n float ANGLE_sd1 = sin(ANGLE_sd1e);\n float ANGLE_sd20 = (0.5 * ANGLE_sd1);\n float _upressureShade = (0.5 + ANGLE_sd20);\n float ANGLE_sd22 = (_uaudioDrive * 0.219999999);\n float ANGLE_sd23 = (_uconeCore * _uaudioDrive);\n float ANGLE_sd24 = (ANGLE_sd23 * 0.180000007);\n float ANGLE_sd25 = (ANGLE_sd22 + ANGLE_sd24);\n float _umetalLift = clamp(ANGLE_sd25, 0.0, 0.5);\n vec3 _umetal = _umetalBase;\n float ANGLE_sd27 = (_urimMask * 0.899999976);\n _umetal = mix(_umetal, _umetalMid, ANGLE_sd27);\n float ANGLE_sd29 = (_upressureShade * 0.140000001);\n float ANGLE_sd2a = (ANGLE_sd29 + _umetalLift);\n _umetal = mix(_umetal, _umetalHi, ANGLE_sd2a);\n float ANGLE_sd2c = (_ugrime * 0.0299999993);\n _umetal += ANGLE_sd2c;\n float ANGLE_sd2d = (_uwall + 0.00200000009);\n float ANGLE_sd2e = (_uwall + 0.00999999978);\n float _uwear = smoothstep(ANGLE_sd2d, ANGLE_sd2e, _uborderMetric);\n float ANGLE_sd30 = (_uwear * 0.449999988);\n _umetal = mix(_umetal, _umetalHi, ANGLE_sd30);\n float ANGLE_sd32 = (_uaudioDrive * 0.100000001);\n float ANGLE_sd33 = (0.200000003 + ANGLE_sd32);\n vec3 ANGLE_sd34 = (vec3(0.0299999993, 0.0350000001, 0.0399999991) * ANGLE_sd33);\n vec3 _ucavity = (_ubg + ANGLE_sd34);\n vec3 _ucol = _ubg;\n _ucol = mix(_ucol, _ucavity, _uinnerMask);\n _ucol = mix(_ucol, _umetal, _uframeMask);\n float ANGLE_sd38 = (_uconeCore * _uaudioDrive);\n float _ucentreGlow = (ANGLE_sd38 * 0.0799999982);\n vec3 ANGLE_sd3a = (vec3(0.0799999982, 0.0900000036, 0.100000001) * _ucentreGlow);\n vec3 ANGLE_sd3b = (ANGLE_sd3a * _uinnerMask);\n _ucol += ANGLE_sd3b;\n vec2 _usuv = (_ufragCoord / iResolution.xy);\n vec2 ANGLE_sd3d = (_usuv - 0.5);\n vec2 ANGLE_sd3e = (_usuv - 0.5);\n float ANGLE_sd3 = dot(ANGLE_sd3d, ANGLE_sd3e);\n float ANGLE_sd40 = (ANGLE_sd3 * 0.800000012);\n float _uvignette = (1.0 - ANGLE_sd40);\n _ucol *= _uvignette;\n float ANGLE_sd42 = (_ufragCoord.y * 0.349999994);\n float ANGLE_sd43 = sin(ANGLE_sd42);\n float ANGLE_sd44 = (0.5 * ANGLE_sd43);\n float _uscan = (0.5 + ANGLE_sd44);\n float ANGLE_sd46 = (0.0149999997 * _uscan);\n float ANGLE_sd47 = (0.985000014 + ANGLE_sd46);\n _ucol *= ANGLE_sd47;\n _ufragColor = ANGLE_sc66(_ucol, 1.0);\n}\n\n\n\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) { _umainImage(fragColor, fragCoord); }", - "views": 23059, - "likes": 526, - "createdAt": "2026-04-01T12:17:45.743Z", - "updatedAt": "2026-04-01T13:31:34.479Z", - "sourceFormat": "angle-metal-auto-converted" + "code": "precision highp float;\n\n\nmat2 rot(float a) {\n float c = cos(a), s = sin(a);\n return mat2(c,s,-s,c);\n}\n\nconst float pi = acos(-1.0);\nconst float pi2 = pi*2.0;\n\nvec2 pmod(vec2 p, float r) {\n float a = atan(p.x, p.y) + pi/r;\n float n = pi2 / r;\n a = floor(a/n)*n;\n return p*rot(-a);\n}\n\nfloat box( vec3 p, vec3 b ) {\n vec3 d = abs(p) - b;\n return min(max(d.x,max(d.y,d.z)),0.0) + length(max(d,0.0));\n}\n\nfloat ifsBox(vec3 p) {\n for (int i=0; i<5; i++) {\n p = abs(p) - 1.0;\n p.xy *= rot(iTime*0.3);\n p.xz *= rot(iTime*0.1);\n }\n p.xz *= rot(iTime);\n return box(p, vec3(0.4,0.8,0.3));\n}\n\nfloat map(vec3 p, vec3 cPos) {\n vec3 p1 = p;\n p1.x = mod(p1.x-5., 10.) - 5.;\n p1.y = mod(p1.y-5., 10.) - 5.;\n p1.z = mod(p1.z, 16.)-8.;\n p1.xy = pmod(p1.xy, 5.0);\n return ifsBox(p1);\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord ) {\n vec2 p = (fragCoord.xy * 2.0 - iResolution.xy) / min(iResolution.x, iResolution.y);\n\n vec3 cPos = vec3(0.0,0.0, -3.0 * iTime);\n // vec3 cPos = vec3(0.3*sin(iTime*0.8), 0.4*cos(iTime*0.3), -6.0 * iTime);\n vec3 cDir = normalize(vec3(0.0, 0.0, -1.0));\n vec3 cUp = vec3(sin(iTime), 1.0, 0.0);\n vec3 cSide = cross(cDir, cUp);\n\n vec3 ray = normalize(cSide * p.x + cUp * p.y + cDir);\n\n // Phantom Mode https://www.shadertoy.com/view/MtScWW by aiekick\n float acc = 0.0;\n float acc2 = 0.0;\n float t = 0.0;\n for (int i = 0; i < 99; i++) {\n vec3 pos = cPos + ray * t;\n float dist = map(pos, cPos);\n dist = max(abs(dist), 0.02);\n float a = exp(-dist*3.0);\n if (mod(length(pos)+24.0*iTime, 30.0) < 3.0) {\n a *= 2.0;\n acc2 += a;\n }\n acc += a;\n t += dist * 0.5;\n }\n\n vec3 col = vec3(acc * 0.01, acc * 0.011 + acc2*0.002, acc * 0.012+ acc2*0.005);\n fragColor = vec4(col, 1.0 - t * 0.03);\n}", + "views": 22810, + "likes": 76, + "createdAt": "2026-04-01T15:24:08.297Z", + "sourceFormat": "glsl", + "updatedAt": "2026-04-01T15:26:50.214Z" }, { - "id": "3697323d-bf83-412e-b5b5-772755a76102", - "name": "地形", + "id": "ab0cc421-e34d-4244-a540-03f029ec7372", + "name": "繁花", "author": "unknown", - "code": "void ANGLE_loopForwardProgress() {}\n\n\n\nvec2 ANGLE_sd72(float ANGLE_sd73, float ANGLE_sd74)\n{\n vec2 ANGLE_sd75 = vec2(ANGLE_sd73, ANGLE_sd74);\n return ANGLE_sd75;\n}\n\n\n\nvec2 ANGLE_sd6(float ANGLE_sd70, float ANGLE_sd71)\n{\n vec2 ANGLE_sd76 = vec2(ANGLE_sd70, ANGLE_sd71);\n return ANGLE_sd76;\n}\n\n\n\nvec4 ANGLE_sd6c(vec3 ANGLE_sd6d, float ANGLE_sd6e)\n{\n vec4 ANGLE_sd77 = vec4(ANGLE_sd6d.x, ANGLE_sd6d.y, ANGLE_sd6d.z, ANGLE_sd6e);\n return ANGLE_sd77;\n}\n\n\n\nvec4 ANGLE_sd69(vec3 ANGLE_sd6a, float ANGLE_sd6b)\n{\n vec4 ANGLE_sd78 = vec4(ANGLE_sd6a.x, ANGLE_sd6a.y, ANGLE_sd6a.z, ANGLE_sd6b);\n return ANGLE_sd78;\n}\n\n\n\nvec2 ANGLE_sd66(float ANGLE_sd67, float ANGLE_sd68)\n{\n vec2 ANGLE_sd79 = vec2(ANGLE_sd67, ANGLE_sd68);\n return ANGLE_sd79;\n}\n\n\n\nvec3 ANGLE_sd62(float ANGLE_sd63, float ANGLE_sd64, float ANGLE_sd65)\n{\n vec3 ANGLE_sd7a = vec3(ANGLE_sd63, ANGLE_sd64, ANGLE_sd65);\n return ANGLE_sd7a;\n}\n\n\n\nvec4 ANGLE_sd5(float ANGLE_sd60, vec3 ANGLE_sd61)\n{\n vec4 ANGLE_sd7b = vec4(ANGLE_sd60, ANGLE_sd61.x, ANGLE_sd61.y, ANGLE_sd61.z);\n return ANGLE_sd7b;\n}\n\n\n\nvec3 ANGLE_sd5c(vec2 ANGLE_sd5d, float ANGLE_sd5e)\n{\n vec3 ANGLE_sd7c = vec3(ANGLE_sd5d.x, ANGLE_sd5d.y, ANGLE_sd5e);\n return ANGLE_sd7c;\n}\n\n\n\nvec3 ANGLE_sd59(vec2 ANGLE_sd5a, float ANGLE_sd5b)\n{\n vec3 ANGLE_sd7d = vec3(ANGLE_sd5a.x, ANGLE_sd5a.y, ANGLE_sd5b);\n return ANGLE_sd7d;\n}\n\n\n\nvec2 ANGLE_sd56(float ANGLE_sd57, float ANGLE_sd58)\n{\n vec2 ANGLE_sd7e = vec2(ANGLE_sd57, ANGLE_sd58);\n return ANGLE_sd7e;\n}\n\n\n\nvec2 ANGLE_sd54(float ANGLE_sd55)\n{\n vec2 ANGLE_sd7 = vec2(ANGLE_sd55, ANGLE_sd55);\n return ANGLE_sd7;\n}\n\n\n\nvec2 ANGLE_sd51(float ANGLE_sd52, float ANGLE_sd53)\n{\n vec2 ANGLE_sd80 = vec2(ANGLE_sd52, ANGLE_sd53);\n return ANGLE_sd80;\n}\n\n\n\nvec2 ANGLE_sd4(float ANGLE_sd50)\n{\n vec2 ANGLE_sd81 = vec2(ANGLE_sd50, ANGLE_sd50);\n return ANGLE_sd81;\n}\n\n\n\nvec2 ANGLE_sd4d(float ANGLE_sd4e)\n{\n vec2 ANGLE_sd82 = vec2(ANGLE_sd4e, ANGLE_sd4e);\n return ANGLE_sd82;\n}\n\n\n\nvec2 ANGLE_sd4b(float ANGLE_sd4c)\n{\n vec2 ANGLE_sd83 = vec2(ANGLE_sd4c, ANGLE_sd4c);\n return ANGLE_sd83;\n}\n\n\n\nvec2 ANGLE_sd48(float ANGLE_sd49, float ANGLE_sd4a)\n{\n vec2 ANGLE_sd84 = vec2(ANGLE_sd49, ANGLE_sd4a);\n return ANGLE_sd84;\n}\n\n\n\nvec2 ANGLE_sd45(float ANGLE_sd46, float ANGLE_sd47)\n{\n vec2 ANGLE_sd85 = vec2(ANGLE_sd46, ANGLE_sd47);\n return ANGLE_sd85;\n}\n\n\n\nvec2 ANGLE_sd43(float ANGLE_sd44)\n{\n vec2 ANGLE_sd86 = vec2(ANGLE_sd44, ANGLE_sd44);\n return ANGLE_sd86;\n}\n\n\n\nvec2 ANGLE_sd41(float ANGLE_sd42)\n{\n vec2 ANGLE_sd87 = vec2(ANGLE_sd42, ANGLE_sd42);\n return ANGLE_sd87;\n}\n\n\n\nvec2 ANGLE_sd3(float ANGLE_sd40)\n{\n vec2 ANGLE_sd88 = vec2(ANGLE_sd40, ANGLE_sd40);\n return ANGLE_sd88;\n}\n\n\n\nvec2 ANGLE_sd3d(float ANGLE_sd3e)\n{\n vec2 ANGLE_sd89 = vec2(ANGLE_sd3e, ANGLE_sd3e);\n return ANGLE_sd89;\n}\n\n\n\nvec4 ANGLE_sd38(float ANGLE_sd39, float ANGLE_sd3a, float ANGLE_sd3b, float ANGLE_sd3c)\n{\n vec4 ANGLE_sd8a = vec4(ANGLE_sd39, ANGLE_sd3a, ANGLE_sd3b, ANGLE_sd3c);\n return ANGLE_sd8a;\n}\n\n\n\nvec3 ANGLE_sd34(int ANGLE_sd35, int ANGLE_sd36, float ANGLE_sd37)\n{\n float ANGLE_sd8b = float(ANGLE_sd35);\n float ANGLE_sd8c = float(ANGLE_sd36);\n vec3 ANGLE_sd8d = vec3(ANGLE_sd8b, ANGLE_sd8c, ANGLE_sd37);\n return ANGLE_sd8d;\n}\n\n\n\nvec2 ANGLE_sd31(float ANGLE_sd32, float ANGLE_sd33)\n{\n vec2 ANGLE_sd8e = vec2(ANGLE_sd32, ANGLE_sd33);\n return ANGLE_sd8e;\n}\n\n\n\nvec2 ANGLE_sd2e(float ANGLE_sd2, float ANGLE_sd30)\n{\n vec2 ANGLE_sd8 = vec2(ANGLE_sd2, ANGLE_sd30);\n return ANGLE_sd8;\n}\n\n\n\nmat3 ANGLE_sd24(float ANGLE_sd25, float ANGLE_sd26, float ANGLE_sd27, float ANGLE_sd28, float ANGLE_sd29, float ANGLE_sd2a, float ANGLE_sd2b, float ANGLE_sd2c, float ANGLE_sd2d)\n{\n mat3 ANGLE_sd90 = mat3(ANGLE_sd25, ANGLE_sd26, ANGLE_sd27, ANGLE_sd28, ANGLE_sd29, ANGLE_sd2a, ANGLE_sd2b, ANGLE_sd2c, ANGLE_sd2d);\n return ANGLE_sd90;\n}\n\n\n\nvec3 ANGLE_sd21(vec2 ANGLE_sd22, float ANGLE_sd23)\n{\n vec3 ANGLE_sd91 = vec3(ANGLE_sd22.x, ANGLE_sd22.y, ANGLE_sd23);\n return ANGLE_sd91;\n}\n\n\n\nvec2 ANGLE_sd1e(float ANGLE_sd1, float ANGLE_sd20)\n{\n vec2 ANGLE_sd92 = vec2(ANGLE_sd1, ANGLE_sd20);\n return ANGLE_sd92;\n}\n\n\n\nvec2 _uboxIntersection(vec3 _uro, vec3 _urd, vec3 _uboxSize, vec3 & _uoutNormal)\n{\n _uoutNormal = vec3(0.0, 0.0, 0.0);\n vec3 _um = (1.0 / _urd);\n vec3 _un = (_um * _uro);\n vec3 ANGLE_sd95 = abs(_um);\n vec3 _uk = (ANGLE_sd95 * _uboxSize);\n vec3 ANGLE_sd97 = (-_un);\n vec3 _ut1 = (ANGLE_sd97 - _uk);\n vec3 ANGLE_sd99 = (-_un);\n vec3 _ut2 = (ANGLE_sd99 + _uk);\n float ANGLE_sd9b = max(_ut1.x, _ut1.y);\n float _utN = max(ANGLE_sd9b, _ut1.z);\n float ANGLE_sd9d = min(_ut2.x, _ut2.y);\n float _utF = min(ANGLE_sd9d, _ut2.z);\n bool ANGLE__1 = (_utN > _utF);\n if (!ANGLE__1)\n {\n ANGLE__1 = (_utF < 0.0);\n } else {}\n if (ANGLE__1)\n {\n return vec2(-1.0, -1.0);\n } else {}\n vec3 ANGLE_sda2 = sign(_urd);\n vec3 ANGLE_sda3 = (-ANGLE_sda2);\n vec3 ANGLE_sda4 = step(_ut1.yzx, _ut1.xyz);\n vec3 ANGLE_sda5 = (ANGLE_sda3 * ANGLE_sda4);\n vec3 ANGLE_sda6 = step(_ut1.zxy, _ut1.xyz);\n _uoutNormal = (ANGLE_sda5 * ANGLE_sda6);\n vec2 ANGLE_sda8 = ANGLE_sd1e(_utN, _utF);\n return ANGLE_sda8;\n}\n\n\n\nvec3 _uCameraRay(float _ufov, vec2 _usize, vec2 _upos)\n{\n vec2 ANGLE_sda9 = (_usize * 0.5);\n vec2 _uxy = (_upos - ANGLE_sda9);\n float ANGLE_sdab = (_ufov * 0.5);\n float ANGLE_sdac = (90.0 - ANGLE_sdab);\n float ANGLE_sdad = (ANGLE_sdac * 0.0174532924);\n float _ucot_half_fov = tan(ANGLE_sdad);\n float ANGLE_sdaf = (_usize.y * 0.5);\n float _uz = (ANGLE_sdaf * _ucot_half_fov);\n float ANGLE_sdb1 = (-_uz);\n vec3 ANGLE_sdb2 = ANGLE_sd21(_uxy, ANGLE_sdb1);\n vec3 ANGLE_sdb3 = normalize(ANGLE_sdb2);\n return ANGLE_sdb3;\n}\n\n\n\nmat3 _uCameraRotation(vec2 _uangle)\n{\n vec2 _uc = cos(_uangle);\n vec2 _us = sin(_uangle);\n float ANGLE_sdb6 = (-_us.y);\n float ANGLE_sdb7 = (_us.y * _us.x);\n float ANGLE_sdb8 = (_uc.y * _us.x);\n float ANGLE_sdb9 = (_us.y * _uc.x);\n float ANGLE_sdba = (-_us.x);\n float ANGLE_sdbb = (_uc.y * _uc.x);\n mat3 ANGLE_sdbc = ANGLE_sd24(_uc.y, 0.0, ANGLE_sdb6, ANGLE_sdb7, _uc.x, ANGLE_sdb8, ANGLE_sdb9, ANGLE_sdba, ANGLE_sdbb);\n return ANGLE_sdbc;\n}\n\n\n\nvoid _uGetRay( vec3 & _uro, vec3 & _urd, float _uiTime, vec4 _uiMouse, vec3 _uiResolution, vec2 _ufragCoord, float _udebugWidth)\n{\n _uro = vec3(0.0, 0.0, 0.0);\n _urd = vec3(0.0, 0.0, 0.0);\n float ANGLE_sdbd = (_uiTime * 2.0);\n float _uiRevolution = (ANGLE_sdbd * 3.14159274);\n float ANGLE_sdbf = mod(_uiTime, 240.0);\n float ANGLE_sdc1;\n if (ANGLE_sdbf >= 120.0)\n {\n ANGLE_sdc1 = 0.0;\n }\n else\n {\n ANGLE_sdc1 = 0.0166666675;\n }\n float ANGLE_sdc2 = (_uiRevolution * ANGLE_sdc1);\n float ANGLE_sdc3 = (_uiRevolution / 6.0);\n float ANGLE_sdc4 = sin(ANGLE_sdc3);\n float ANGLE_sdc5 = (ANGLE_sdc4 * 0.0);\n float ANGLE_sdc6 = (ANGLE_sdc5 * 6.0);\n float ANGLE_sdc7 = (ANGLE_sdc2 + ANGLE_sdc6);\n float ANGLE_sdc8 = mod(_uiTime, 240.0);\n float ANGLE_sdca;\n if (ANGLE_sdc8 >= 120.0)\n {\n ANGLE_sdca = 0.25;\n }\n else\n {\n ANGLE_sdca = -0.449999988;\n }\n float ANGLE_sdcb = (ANGLE_sdca * 2.0);\n float ANGLE_sdcc = (ANGLE_sdcb * 3.14159274);\n float ANGLE_sdcd = (ANGLE_sdc7 + ANGLE_sdcc);\n float ANGLE_sdce = mod(_uiTime, 240.0);\n float ANGLE_sdd0;\n if (ANGLE_sdce >= 120.0)\n {\n ANGLE_sdd0 = -0.349999994;\n }\n else\n {\n ANGLE_sdd0 = -0.430000007;\n }\n vec2 _ucameraAngle = ANGLE_sd2e(ANGLE_sdcd, ANGLE_sdd0);\n float ANGLE_sdd2 = mod(_uiTime, 240.0);\n float ANGLE_sdd4;\n if (ANGLE_sdd2 >= 120.0)\n {\n ANGLE_sdd4 = 1.5;\n }\n else\n {\n ANGLE_sdd4 = 3.25;\n }\n float _ucameraDistance = ANGLE_sdd4;\n bool ANGLE_sdd5 = (_uiMouse.z > 0.5);\n if (ANGLE_sdd5)\n {\n vec2 _umouse = (_uiMouse.xy / _uiResolution.xy);\n float ANGLE_sdd7 = mix(_umouse.y, 0.5, -1.0);\n _umouse.y = clamp(ANGLE_sdd7, 0.0, 1.0);\n vec2 ANGLE_sdd9 = (_umouse - vec2(0.5, 1.0));\n _ucameraAngle = (ANGLE_sdd9 * vec2(-6.28318548, 1.57079637));\n } else {}\n mat3 _urot = _uCameraRotation(_ucameraAngle.yx);\n float ANGLE_sddc = mod(_uiTime, 240.0);\n float ANGLE_sdde;\n if (ANGLE_sddc >= 120.0)\n {\n ANGLE_sdde = 20.0;\n }\n else\n {\n ANGLE_sdde = 11.0;\n }\n float ANGLE_sddf = (_udebugWidth / 2.0);\n vec2 ANGLE_sde0 = ANGLE_sd31(ANGLE_sddf, 0.0);\n vec2 ANGLE_sde1 = (_ufragCoord.xy - ANGLE_sde0);\n _urd = _uCameraRay(ANGLE_sdde, _uiResolution.xy, ANGLE_sde1);\n _urd = (_urot * _urd);\n vec3 ANGLE_sde4 = ANGLE_sd34(0, 0, _ucameraDistance);\n vec3 ANGLE_sde5 = (_urot * ANGLE_sde4);\n _uro = (vec3(0.0, 0.400000006, 0.0) + ANGLE_sde5);\n}\n\n\n\nvec3 _uSkyColor(vec3 _urd, vec3 _usun)\n{\n float _ucosth = dot(_urd, _usun);\n float ANGLE_sde8 = abs(_ucosth);\n float ANGLE_sde9 = (ANGLE_sde8 * 0.800000012);\n float ANGLE_sdea = (1.0 - ANGLE_sde9);\n vec3 ANGLE_sdeb = (vec3(0.0942477882, 0.157079637, 0.219911486) * ANGLE_sdea);\n return ANGLE_sdeb;\n}\n\n\n\nvec3 _uTonemap_ACES(vec3 _ux)\n{\n vec3 ANGLE_sdec = (2.50999999 * _ux);\n vec3 ANGLE_sded = (ANGLE_sdec + 0.0299999993);\n vec3 ANGLE_sdee = (_ux * ANGLE_sded);\n vec3 ANGLE_sdef = (2.43000007 * _ux);\n vec3 ANGLE_sdf0 = (ANGLE_sdef + 0.589999974);\n vec3 ANGLE_sdf1 = (_ux * ANGLE_sdf0);\n vec3 ANGLE_sdf2 = (ANGLE_sdf1 + 0.140000001);\n vec3 ANGLE_sdf3 = (ANGLE_sdee / ANGLE_sdf2);\n return ANGLE_sdf3;\n}\n\n\n\nfloat _upow5(float _ux)\n{\n float _ux2 = (_ux * _ux);\n float ANGLE_sdf5 = (_ux2 * _ux2);\n float ANGLE_sdf6 = (ANGLE_sdf5 * _ux);\n return ANGLE_sdf6;\n}\n\n\n\nfloat _uD_GGX(float _ulinearRoughness, float _uNoH, vec3 _uh)\n{\n float ANGLE_sdf7 = (_uNoH * _uNoH);\n float _uoneMinusNoHSquared = (1.0 - ANGLE_sdf7);\n float _ua = (_uNoH * _ulinearRoughness);\n float ANGLE_sdfa = (_ua * _ua);\n float ANGLE_sdfb = (_uoneMinusNoHSquared + ANGLE_sdfa);\n float _uk = (_ulinearRoughness / ANGLE_sdfb);\n float ANGLE_sdfd = (_uk * _uk);\n float _ud = (ANGLE_sdfd * 0.318309873);\n return _ud;\n}\n\n\n\nfloat _uV_SmithGGXCorrelated(float _ulinearRoughness, float _uNoV, float _uNoL)\n{\n float _ua2 = (_ulinearRoughness * _ulinearRoughness);\n float ANGLE_se00 = (_ua2 * _uNoV);\n float ANGLE_se01 = (_uNoV - ANGLE_se00);\n float ANGLE_se02 = (ANGLE_se01 * _uNoV);\n float ANGLE_se03 = (ANGLE_se02 + _ua2);\n float ANGLE_se04 = sqrt(ANGLE_se03);\n float _uGGXV = (_uNoL * ANGLE_se04);\n float ANGLE_se06 = (_ua2 * _uNoL);\n float ANGLE_se07 = (_uNoL - ANGLE_se06);\n float ANGLE_se08 = (ANGLE_se07 * _uNoL);\n float ANGLE_se09 = (ANGLE_se08 + _ua2);\n float ANGLE_se0a = sqrt(ANGLE_se09);\n float _uGGXL = (_uNoV * ANGLE_se0a);\n float ANGLE_se0c = (_uGGXV + _uGGXL);\n float ANGLE_se0d = (0.5 / ANGLE_se0c);\n return ANGLE_se0d;\n}\n\n\n\nvec3 _uF_Schlick(vec3 _uf0, float _uVoH)\n{\n vec3 ANGLE_se0e = (vec3(1.0, 1.0, 1.0) - _uf0);\n float ANGLE_se0 = (1.0 - _uVoH);\n float ANGLE_se10 = _upow5(ANGLE_se0);\n vec3 ANGLE_se11 = (ANGLE_se0e * ANGLE_se10);\n vec3 ANGLE_se12 = (_uf0 + ANGLE_se11);\n return ANGLE_se12;\n}\n\n\n\nfloat _uF_Schlick(float _uf0, float _uf90, float _uVoH)\n{\n float ANGLE_se13 = (_uf90 - _uf0);\n float ANGLE_se14 = (1.0 - _uVoH);\n float ANGLE_se15 = _upow5(ANGLE_se14);\n float ANGLE_se16 = (ANGLE_se13 * ANGLE_se15);\n float ANGLE_se17 = (_uf0 + ANGLE_se16);\n return ANGLE_se17;\n}\n\n\n\nfloat _uFd_Burley(float _ulinearRoughness, float _uNoV, float _uNoL, float _uLoH)\n{\n float ANGLE_se18 = (2.0 * _ulinearRoughness);\n float ANGLE_se19 = (ANGLE_se18 * _uLoH);\n float ANGLE_se1a = (ANGLE_se19 * _uLoH);\n float _uf90 = (0.5 + ANGLE_se1a);\n float _ulightScatter = _uF_Schlick(1.0, _uf90, _uNoL);\n float _uviewScatter = _uF_Schlick(1.0, _uf90, _uNoV);\n float ANGLE_se1e = (_ulightScatter * _uviewScatter);\n float ANGLE_se1 = (ANGLE_se1e * 0.318309873);\n return ANGLE_se1;\n}\n\n\n\nfloat _uFd_Lambert()\n{\n return 0.318309873;\n}\n\n\n\nvec3 _uShade(vec3 _udiffuse, vec3 _uf0, float _usmoothness, vec3 _un, vec3 _uv, vec3 _ul, vec3 _ulc)\n{\n vec3 ANGLE_se20 = (_uv + _ul);\n vec3 _uh = normalize(ANGLE_se20);\n float ANGLE_se22 = dot(_un, _uv);\n float ANGLE_se23 = abs(ANGLE_se22);\n float _uNoV = (ANGLE_se23 + 9.99999975e-06);\n float ANGLE_se25 = dot(_un, _ul);\n float _uNoL = clamp(ANGLE_se25, 0.0, 1.0);\n float ANGLE_se27 = dot(_un, _uh);\n float _uNoH = clamp(ANGLE_se27, 0.0, 1.0);\n float ANGLE_se29 = dot(_ul, _uh);\n float _uLoH = clamp(ANGLE_se29, 0.0, 1.0);\n float _uroughness = (1.0 - _usmoothness);\n float _ulinearRoughness = (_uroughness * _uroughness);\n float _uD = _uD_GGX(_ulinearRoughness, _uNoH, _uh);\n float _uV = _uV_SmithGGXCorrelated(_ulinearRoughness, _uNoV, _uNoL);\n vec3 _uF = _uF_Schlick(_uf0, _uLoH);\n float ANGLE_se30 = (_uD * _uV);\n vec3 _uFr = (ANGLE_se30 * _uF);\n float ANGLE_se32 = _uFd_Burley(_ulinearRoughness, _uNoV, _uNoL, _uLoH);\n vec3 _uFd = (_udiffuse * ANGLE_se32);\n vec3 ANGLE_se34 = (_uFd + _uFr);\n vec3 ANGLE_se35 = (ANGLE_se34 * _ulc);\n vec3 ANGLE_se36 = (ANGLE_se35 * _uNoL);\n return ANGLE_se36;\n}\n\n\n\nfloat _uPhaseRayleigh(float _ucosth)\n{\n float ANGLE_se37 = (_ucosth * _ucosth);\n float ANGLE_se38 = (1.0 + ANGLE_se37);\n float ANGLE_se39 = (3.0 * ANGLE_se38);\n float ANGLE_se3a = (ANGLE_se39 / 50.2654839);\n return ANGLE_se3a;\n}\n\n\n\nfloat _uPhaseMie(float _ucosth, float _ug)\n{\n _ug = min(_ug, 0.93809998);\n float ANGLE_se3c = (1.54999995 * _ug);\n float ANGLE_se3d = (0.550000012 * _ug);\n float ANGLE_se3e = (ANGLE_se3d * _ug);\n float ANGLE_se3 = (ANGLE_se3e * _ug);\n float _uk = (ANGLE_se3c - ANGLE_se3);\n float _ukcosth = (_uk * _ucosth);\n float ANGLE_se42 = (_uk * _uk);\n float ANGLE_se43 = (1.0 - ANGLE_se42);\n float ANGLE_se44 = (1.0 - _ukcosth);\n float ANGLE_se45 = (12.566371 * ANGLE_se44);\n float ANGLE_se46 = (1.0 - _ukcosth);\n float ANGLE_se47 = (ANGLE_se45 * ANGLE_se46);\n float ANGLE_se48 = (ANGLE_se43 / ANGLE_se47);\n return ANGLE_se48;\n}\n\n\n\nvec4 _uunpack4(float _ucol)\n{\n int _uval = as_type(_ucol);\n int ANGLE_se4a = (_uval >> 24);\n int ANGLE_se4b = (ANGLE_se4a & 255);\n float ANGLE_se4c = float(ANGLE_se4b);\n float ANGLE_se4d = (ANGLE_se4c / 255.0);\n int ANGLE_se4e = (_uval >> 16);\n int ANGLE_se4 = (ANGLE_se4e & 255);\n float ANGLE_se50 = float(ANGLE_se4);\n float ANGLE_se51 = (ANGLE_se50 / 255.0);\n int ANGLE_se52 = (_uval >> 8);\n int ANGLE_se53 = (ANGLE_se52 & 255);\n float ANGLE_se54 = float(ANGLE_se53);\n float ANGLE_se55 = (ANGLE_se54 / 255.0);\n int ANGLE_se56 = (_uval & 255);\n float ANGLE_se57 = float(ANGLE_se56);\n float ANGLE_se58 = (ANGLE_se57 / 255.0);\n vec4 ANGLE_se59 = ANGLE_sd38(ANGLE_se4d, ANGLE_se51, ANGLE_se55, ANGLE_se58);\n return ANGLE_se59;\n}\n\n\n\nvec3 _uGetChannel0( vec2 _uuv)\n{\n float ANGLE_se5a = min(iResolution.x, iResolution.y);\n float ANGLE_se5b = min(ANGLE_se5a, 1080.0);\n vec2 ANGLE_se5c = ANGLE_sd3d(ANGLE_se5b);\n vec2 ANGLE_se5d = (ANGLE_se5c / iResolution.xy);\n _uuv *= ANGLE_se5d;\n vec4 ANGLE_se5e = vec4(0.0);\n return ANGLE_se5e.xyz;\n}\n\n\n\nvec4 _uGetChannel1( vec2 _uuv)\n{\n float ANGLE_se5 = min(iResolution.x, iResolution.y);\n float ANGLE_se60 = min(ANGLE_se5, 1080.0);\n vec2 ANGLE_se61 = ANGLE_sd3(ANGLE_se60);\n vec2 ANGLE_se62 = (ANGLE_se61 / iResolution.xy);\n _uuv *= ANGLE_se62;\n vec4 ANGLE_se63 = vec4(0.0);\n return ANGLE_se63;\n}\n\n\n\nvec3 _uGetChannel0Data( vec2 _uuv, vec4 & _udata)\n{\n _udata = vec4(0.0, 0.0, 0.0, 0.0);\n float ANGLE_se64 = min(iResolution.x, iResolution.y);\n float ANGLE_se65 = min(ANGLE_se64, 1080.0);\n vec2 ANGLE_se66 = ANGLE_sd41(ANGLE_se65);\n vec2 ANGLE_se67 = (_uuv * ANGLE_se66);\n vec2 _up = (ANGLE_se67 - 0.5);\n ivec2 _ui = ivec2(_up);\n vec2 _ub = fract(_up);\n vec2 _ua = (1.0 - _ub);\n vec4 _uAA = vec4(0.0);\n ivec2 ANGLE_se6d = (_ui + ivec2(0, 1));\n vec4 _uAB = vec4(0.0);\n ivec2 ANGLE_se6 = (_ui + ivec2(1, 0));\n vec4 _uBA = vec4(0.0);\n ivec2 ANGLE_se71 = (_ui + ivec2(1, 1));\n vec4 _uBB = vec4(0.0);\n vec4 ANGLE_se73 = (_uAA * _ua.y);\n vec4 ANGLE_se74 = (_uAB * _ub.y);\n vec4 ANGLE_se75 = (ANGLE_se73 + ANGLE_se74);\n vec4 ANGLE_se76 = (ANGLE_se75 * _ua.x);\n vec4 ANGLE_se77 = (_uBA * _ua.y);\n vec4 ANGLE_se78 = (_uBB * _ub.y);\n vec4 ANGLE_se79 = (ANGLE_se77 + ANGLE_se78);\n vec4 ANGLE_se7a = (ANGLE_se79 * _ub.x);\n vec4 _uret = (ANGLE_se76 + ANGLE_se7a);\n vec4 _uAAdata = _uunpack4(_uAA.w);\n vec4 _uABdata = _uunpack4(_uAB.w);\n vec4 _uBAdata = _uunpack4(_uBA.w);\n vec4 _uBBdata = _uunpack4(_uBB.w);\n vec4 ANGLE_se80 = (_uAAdata * _ua.y);\n vec4 ANGLE_se81 = (_uABdata * _ub.y);\n vec4 ANGLE_se82 = (ANGLE_se80 + ANGLE_se81);\n vec4 ANGLE_se83 = (ANGLE_se82 * _ua.x);\n vec4 ANGLE_se84 = (_uBAdata * _ua.y);\n vec4 ANGLE_se85 = (_uBBdata * _ub.y);\n vec4 ANGLE_se86 = (ANGLE_se84 + ANGLE_se85);\n vec4 ANGLE_se87 = (ANGLE_se86 * _ub.x);\n _udata = (ANGLE_se83 + ANGLE_se87);\n return _uret.xyz;\n}\n\n\n\nvec2 _uGetUV( vec3 _up)\n{\n float ANGLE_se89 = min(iResolution.x, iResolution.y);\n float ANGLE_se8a = min(ANGLE_se89, 1080.0);\n vec2 ANGLE_se8b = ANGLE_sd43(ANGLE_se8a);\n vec2 _upixel = (vec2(1.0, 1.0) / ANGLE_se8b);\n vec2 ANGLE_se8d = (_upixel * 2.0);\n vec2 ANGLE_se8e = (1.0 - ANGLE_se8d);\n vec2 ANGLE_se8 = (_up.xz * ANGLE_se8e);\n vec2 _uuv = (ANGLE_se8 + vec2(0.5, 0.5));\n vec2 ANGLE_se91 = (vec2(1.0, 1.0) - _upixel);\n _uuv = clamp(_uuv, _upixel, ANGLE_se91);\n float ANGLE_se93 = (iTime / 60.0);\n float ANGLE_se94 = (ANGLE_se93 * 2.0);\n float ANGLE_se95 = (ANGLE_se94 * 3.14159274);\n float ANGLE_se96 = cos(ANGLE_se95);\n float ANGLE_se97 = (ANGLE_se96 * 2.0);\n float ANGLE_se98 = (iTime / 60.0);\n float ANGLE_se99 = (ANGLE_se98 * 2.0);\n float ANGLE_se9a = (ANGLE_se99 * 3.14159274);\n float ANGLE_se9b = sin(ANGLE_se9a);\n float ANGLE_se9c = (-ANGLE_se9b);\n float ANGLE_se9d = (ANGLE_se9c * 0.100000001);\n vec2 ANGLE_se9e = ANGLE_sd45(ANGLE_se97, ANGLE_se9d);\n float ANGLE_se9 = (iTime / 60.0);\n float ANGLE_sea0 = (ANGLE_se9 * 2.0);\n float ANGLE_sea1 = (ANGLE_sea0 * 3.14159274);\n float ANGLE_sea2 = cos(ANGLE_sea1);\n float ANGLE_sea3 = (ANGLE_sea2 * 2.0);\n float ANGLE_sea4 = (iTime / 60.0);\n float ANGLE_sea5 = (ANGLE_sea4 * 2.0);\n float ANGLE_sea6 = (ANGLE_sea5 * 3.14159274);\n float ANGLE_sea7 = sin(ANGLE_sea6);\n float ANGLE_sea8 = (-ANGLE_sea7);\n float ANGLE_sea9 = (ANGLE_sea8 * 0.100000001);\n vec2 ANGLE_seaa = ANGLE_sd48(ANGLE_sea3, ANGLE_sea9);\n float ANGLE_seab = min(iResolution.x, iResolution.y);\n float ANGLE_seac = min(ANGLE_seab, 1080.0);\n vec2 ANGLE_sead = ANGLE_sd4b(ANGLE_seac);\n vec2 ANGLE_seae = (ANGLE_seaa * ANGLE_sead);\n vec2 ANGLE_seaf = round(ANGLE_seae);\n float ANGLE_seb0 = min(iResolution.x, iResolution.y);\n float ANGLE_seb1 = min(ANGLE_seb0, 1080.0);\n vec2 ANGLE_seb2 = ANGLE_sd4d(ANGLE_seb1);\n vec2 ANGLE_seb3 = (ANGLE_seaf / ANGLE_seb2);\n vec2 ANGLE_seb4 = (ANGLE_se9e - ANGLE_seb3);\n _uuv += ANGLE_seb4;\n return _uuv;\n}\n\n\n\nfloat _umapHeight( vec2 _uuv)\n{\n vec3 ANGLE_seb5 = _uGetChannel0(ANGLE_userUniforms, ANGLE_textureEnvs, _uuv);\n return ANGLE_seb5.x;\n}\n\n\n\nvec4 _umap( vec2 _uuv, float & _uerosion, float & _uridgemap, float & _utrees, float & _udebug)\n{\n _uerosion = 0.0;\n _uridgemap = 0.0;\n _utrees = 0.0;\n _udebug = 0.0;\n vec4 _udata = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 _utex = _uGetChannel0Data(ANGLE_userUniforms, ANGLE_textureEnvs, _uuv, _udata);\n float _uheight = _utex.x;\n float ANGLE_seb7 = min(iResolution.x, iResolution.y);\n float ANGLE_seb8 = min(ANGLE_seb7, 1080.0);\n vec2 ANGLE_seb9 = ANGLE_sd4(ANGLE_seb8);\n float ANGLE_seba = (1.0 / ANGLE_seb9.x);\n vec2 ANGLE_sebb = ANGLE_sd51(ANGLE_seba, 0.0);\n vec2 _uuv1 = (_uuv + ANGLE_sebb);\n float ANGLE_sebd = min(iResolution.x, iResolution.y);\n float ANGLE_sebe = min(ANGLE_sebd, 1080.0);\n vec2 ANGLE_sebf = ANGLE_sd54(ANGLE_sebe);\n float ANGLE_sec0 = (1.0 / ANGLE_sebf.y);\n vec2 ANGLE_sec1 = ANGLE_sd56(0.0, ANGLE_sec0);\n vec2 _uuv2 = (_uuv + ANGLE_sec1);\n vec3 ANGLE_sec3 = _uGetChannel0(ANGLE_userUniforms, ANGLE_textureEnvs, _uuv1);\n float _uh1 = ANGLE_sec3.x;\n vec3 ANGLE_sec4 = _uGetChannel0(ANGLE_userUniforms, ANGLE_textureEnvs, _uuv2);\n float _uh2 = ANGLE_sec4.x;\n vec2 ANGLE_sec5 = (_uuv1 - _uuv);\n float ANGLE_sec6 = (_uh1 - _uheight);\n vec3 _uv1 = ANGLE_sd59(ANGLE_sec5, ANGLE_sec6);\n vec2 ANGLE_sec8 = (_uuv2 - _uuv);\n float ANGLE_sec9 = (_uh2 - _uheight);\n vec3 _uv2 = ANGLE_sd5c(ANGLE_sec8, ANGLE_sec9);\n vec3 ANGLE_secb = cross(_uv1, _uv2);\n vec3 ANGLE_secc = normalize(ANGLE_secb);\n vec3 _unormal = ANGLE_secc.xzy;\n float ANGLE_secd = (_udata.x * 2.0);\n _uerosion = (ANGLE_secd - 1.0);\n _uridgemap = _udata.y;\n _utrees = _udata.z;\n _udebug = _udata.w;\n vec4 ANGLE_secf = ANGLE_sd5(_uheight, _unormal);\n return ANGLE_secf;\n}\n\n\n\nfloat _umarch( vec3 _uro, vec3 _urd, vec3 & _unormal, int & _umaterial, float & _us_t)\n{\n _unormal = vec3(0.0, 0.0, 0.0);\n _umaterial = 0;\n _us_t = 0.0;\n _us_t = 9999.0;\n vec3 _uboxNormal = vec3(0.0, 0.0, 0.0);\n vec2 _ubox = _uboxIntersection(_uro, _urd, ANGLE_nonConstGlobals._uboxSize, _uboxNormal);\n float ANGLE_sed1 = max(0.0, _ubox.x);\n float _utStart = (ANGLE_sed1 + 0.00999999978);\n float _utEnd = (_ubox.y - 0.00999999978);\n _umaterial = 0;\n float _ustepSize = 0.0;\n float _ustepScale = 0.5;\n int _usamples = 96;\n float _ut = _utStart;\n float _ualtitude = 0.0;\n {\n int _ui = 0;\n bool ANGLE_scf7 = (_ui < _usamples);\n while (ANGLE_scf7)\n {\n {\n ANGLE_loopForwardProgress();\n {\n vec3 ANGLE_sed5 = (_urd * _ut);\n vec3 _upos = (_uro + ANGLE_sed5);\n vec2 ANGLE_sed7 = _uGetUV(ANGLE_userUniforms, _upos);\n float _uh = _umapHeight(ANGLE_userUniforms, ANGLE_textureEnvs, ANGLE_sed7);\n _ualtitude = (_upos.y - _uh);\n float ANGLE_seda = (_ualtitude / _ut);\n float ANGLE_sedb = min(_us_t, ANGLE_seda);\n _us_t = max(0.0, ANGLE_sedb);\n bool ANGLE_sedd = (_ualtitude < 0.0);\n if (ANGLE_sedd)\n {\n bool ANGLE_sede = (_ui < 1);\n if (ANGLE_sede)\n {\n bool ANGLE_sedf = (_upos.y < 0.349999994);\n if (ANGLE_sedf)\n {\n _us_t = 9999.0;\n return -1.0;\n } else {}\n _unormal = _uboxNormal;\n _umaterial = 1;\n break;\n } else {}\n } else {}\n bool ANGLE_see0 = (_ualtitude < 0.0);\n if (ANGLE_see0)\n {\n _ustepScale *= 0.5;\n float ANGLE_see1 = (_ustepSize * _ustepScale);\n _ut -= ANGLE_see1;\n }\n else\n {\n float ANGLE_see2 = abs(_ualtitude);\n float ANGLE_see3 = abs(_ualtitude);\n float ANGLE_see4 = (ANGLE_see3 * 0.00999999978);\n float ANGLE_see5 = min(0.00999999978, ANGLE_see4);\n _ustepSize = (ANGLE_see2 + ANGLE_see5);\n float ANGLE_see7 = (_ustepSize * _ustepScale);\n _ut += ANGLE_see7;\n }\n }\n }\n _ui++;\n ANGLE_scf7 = (_ui < _usamples);\n }\n }\n vec3 _uwaterNormal = vec3(0.0, 0.0, 0.0);\n float ANGLE_see9 = mod(iTime, 120.0);\n float ANGLE_seea = smoothstep(54.0, 60.0, ANGLE_see9);\n float ANGLE_seeb = mod(iTime, 120.0);\n float ANGLE_seec = smoothstep(114.0, 120.0, ANGLE_seeb);\n float ANGLE_seed = (ANGLE_seea - ANGLE_seec);\n float ANGLE_seee = (0.100000001 * ANGLE_seed);\n float ANGLE_seef = (0.360000014 + ANGLE_seee);\n vec3 ANGLE_sef0 = ANGLE_sd62(ANGLE_nonConstGlobals._uboxSize.x, ANGLE_seef, ANGLE_nonConstGlobals._uboxSize.z);\n vec2 _uwater = _uboxIntersection(_uro, _urd, ANGLE_sef0, _uwaterNormal);\n bool ANGLE__4 = (_uwater.y > 0.0);\n if (ANGLE__4)\n {\n bool ANGLE__2 = (_uwater.x < _ut);\n if (!ANGLE__2)\n {\n ANGLE__2 = (_ut < 0.0);\n } else {}\n bool ANGLE__3 = ANGLE__2;\n if (ANGLE__3)\n {\n ANGLE__3 = (_umaterial != 1);\n } else {}\n ANGLE__4 = ANGLE__3;\n } else {}\n if (ANGLE__4)\n {\n _ut = max(0.0, _uwater.x);\n _unormal = _uwaterNormal;\n _umaterial = 2;\n } else {}\n bool ANGLE_sefa = (_ubox.y < 0.0);\n if (ANGLE_sefa)\n {\n _us_t = 9999.0;\n return -1.0;\n } else {}\n bool ANGLE_sefb = (_ut > _utEnd);\n if (ANGLE_sefb)\n {\n return -1.0;\n } else {}\n return _ut;\n}\n\n\n\nvec3 _uGetReflection( vec3 _up, vec3 _ur, vec3 _usun, float _usmoothness)\n{\n vec3 ANGLE_sefc = _uSkyColor(_ur, _usun);\n vec3 _urefl = (ANGLE_sefc * 4.0);\n vec3 _ufoo = vec3(0.0, 0.0, 0.0);\n float _ur_t = 0.0;\n int _ur_material = 0;\n _umarch(ANGLE_userUniforms, ANGLE_nonConstGlobals, ANGLE_textureEnvs, _up, _ur, _ufoo, _ur_material, _ur_t);\n float ANGLE_sefe = (-_ur_t);\n float ANGLE_seff = (ANGLE_sefe * 10.0);\n float ANGLE_sf00 = (_usmoothness * _usmoothness);\n float ANGLE_sf01 = (ANGLE_seff * ANGLE_sf00);\n float ANGLE_sf02 = exp(ANGLE_sf01);\n float ANGLE_sf03 = (1.0 - ANGLE_sf02);\n vec3 ANGLE_sf04 = (_urefl * ANGLE_sf03);\n return ANGLE_sf04;\n}\n\n\n\nvoid _umainImage(out vec4 _ufragColor, vec2 _ufragCoord)\n{\n _ufragColor = vec4(0.0, 0.0, 0.0, 0.0);\n float _udebugWidth = 0.0;\n vec3 _uro = vec3(0.0, 0.0, 0.0);\n vec3 _urd = vec3(0.0, 0.0, 0.0);\n _uGetRay(_uro, _urd, iTime, iMouse, iResolution, _ufragCoord, _udebugWidth);\n vec4 _ufoo = vec4(0.0, 0.0, 0.0, 0.0);\n vec3 _unormal = vec3(0.0, 0.0, 0.0);\n int _umaterial = 0;\n float _ut = _umarch(ANGLE_userUniforms, ANGLE_nonConstGlobals, ANGLE_textureEnvs, _uro, _urd, _unormal, _umaterial, _ufoo, 3u);\n vec3 _usun = vec3(-0.927477777, 0.370991111, 0.0463738889);\n vec3 ANGLE_sf06 = _uSkyColor(_urd, _usun);\n vec3 ANGLE_sf07 = (-ANGLE_sf06);\n vec3 ANGLE_sf08 = (ANGLE_sf07 * 2.0);\n vec3 ANGLE_sf09 = exp(ANGLE_sf08);\n vec3 _ufogColor = (1.0 - ANGLE_sf09);\n vec3 _ucolor = vec3(0.0, 0.0, 0.0);\n bool ANGLE_sf0b = (_ut < 0.0);\n if (ANGLE_sf0b)\n {\n float ANGLE_sf0c = (_ufragCoord.y / iResolution.y);\n float ANGLE_sf0d = powr(ANGLE_sf0c, 3.0);\n float ANGLE_sf0e = (ANGLE_sf0d * 3.0);\n float ANGLE_sf0 = (1.0 + ANGLE_sf0e);\n vec3 ANGLE_sf10 = (_ufogColor * ANGLE_sf0);\n _ucolor = (ANGLE_sf10 * 0.5);\n }\n else\n {\n vec3 ANGLE_sf12 = (_urd * _ut);\n vec3 _upos = (_uro + ANGLE_sf12);\n float _uerosion = 0.0;\n float _uridgemap = 0.0;\n float _utrees = 0.0;\n float _udebug = 0.0;\n vec2 ANGLE_sf14 = _uGetUV(ANGLE_userUniforms, _upos);\n vec4 _umapData = _umap( ANGLE_textureEnvs, ANGLE_sf14, _uerosion, _uridgemap, _utrees, _udebug);\n float ANGLE_sf16 = (_uridgemap / 0.300000012);\n float ANGLE_sf17 = clamp(ANGLE_sf16, 0.0, 1.0);\n float ANGLE_sf18 = (1.0 - ANGLE_sf17);\n float ANGLE_sf19 = (ANGLE_sf18 * 1.5);\n float _udrainage = clamp(ANGLE_sf19, 0.0, 1.0);\n float _udiff = (_upos.y - _umapData.x);\n float _ubreakup = 0.0;\n vec2 ANGLE_sf1c = _uGetUV(ANGLE_userUniforms, _upos);\n vec4 _ubreakupTex = _uGetChannel1(ANGLE_userUniforms, ANGLE_textureEnvs, ANGLE_sf1c);\n _ubreakup = _ubreakupTex.x;\n bool ANGLE_sf1e = (_umaterial == 2);\n if (ANGLE_sf1e)\n {\n vec2 ANGLE_sf1 = (_ubreakupTex.zy * 0.100000001);\n _unormal.xz = (_unormal.xz + ANGLE_sf1);\n _unormal = normalize(_unormal);\n } else {}\n vec3 _uf0 = vec3(0.0399999991, 0.0399999991, 0.0399999991);\n float _usmoothness = 0.0;\n float _uocclusion = 1.0;\n vec3 _ur = reflect(_urd, _unormal);\n vec3 _udiffuseColor = vec3(0.5, 0.5, 0.5);\n bool ANGLE_sf22 = (_umaterial == 0);\n if (ANGLE_sf22)\n {\n _unormal = _umapData.yzw;\n float ANGLE_sf23 = (_uerosion + 0.5);\n _uocclusion = clamp(ANGLE_sf23, 0.0, 1.0);\n float ANGLE_sf25 = smoothstep(0.400000006, 0.519999981, _upos.y);\n _udiffuseColor = (vec3(0.219999999, 0.200000003, 0.200000003) * ANGLE_sf25);\n float ANGLE_sf27 = (_ubreakup * 1.5);\n float ANGLE_sf28 = (_uocclusion + ANGLE_sf27);\n float ANGLE_sf29 = smoothstep(0.600000024, 0.0, ANGLE_sf28);\n _udiffuseColor = mix(_udiffuseColor, vec3(0.600000024, 0.5, 0.400000006), ANGLE_sf29);\n float ANGLE_sf2b = (_ubreakup * 0.100000001);\n float ANGLE_sf2c = (_upos.y + ANGLE_sf2b);\n float ANGLE_sf2d = smoothstep(0.529999971, 0.600000024, ANGLE_sf2c);\n _udiffuseColor = mix(_udiffuseColor, vec3(1.0, 1.0, 1.0), ANGLE_sf2d);\n float ANGLE_sf2 = mod(iTime, 120.0);\n float ANGLE_sf30 = smoothstep(54.0, 60.0, ANGLE_sf2);\n float ANGLE_sf31 = mod(iTime, 120.0);\n float ANGLE_sf32 = smoothstep(114.0, 120.0, ANGLE_sf31);\n float ANGLE_sf33 = (ANGLE_sf30 - ANGLE_sf32);\n float ANGLE_sf34 = (0.100000001 * ANGLE_sf33);\n float ANGLE_sf35 = (0.360000014 + ANGLE_sf34);\n float ANGLE_sf36 = (ANGLE_sf35 + 0.00499999989);\n float ANGLE_sf37 = mod(iTime, 120.0);\n float ANGLE_sf38 = smoothstep(54.0, 60.0, ANGLE_sf37);\n float ANGLE_sf39 = mod(iTime, 120.0);\n float ANGLE_sf3a = smoothstep(114.0, 120.0, ANGLE_sf39);\n float ANGLE_sf3b = (ANGLE_sf38 - ANGLE_sf3a);\n float ANGLE_sf3c = (0.100000001 * ANGLE_sf3b);\n float ANGLE_sf3d = (0.360000014 + ANGLE_sf3c);\n float ANGLE_sf3e = (_ubreakup * 0.00999999978);\n float ANGLE_sf3 = (_upos.y + ANGLE_sf3e);\n float ANGLE_sf40 = smoothstep(ANGLE_sf36, ANGLE_sf3d, ANGLE_sf3);\n _udiffuseColor = mix(_udiffuseColor, vec3(0.800000012, 0.699999988, 0.600000024), ANGLE_sf40);\n float ANGLE_sf42 = (_uerosion * 0.0500000007);\n float ANGLE_sf43 = (_upos.y - ANGLE_sf42);\n float ANGLE_sf44 = (_ubreakup * 0.300000012);\n float ANGLE_sf45 = (ANGLE_sf43 + ANGLE_sf44);\n float ANGLE_sf46 = smoothstep(0.400000006, 0.600000024, ANGLE_sf45);\n vec3 _ugrassMix = mix(vec3(0.150000006, 0.300000012, 0.100000001), vec3(0.400000006, 0.5, 0.200000003), ANGLE_sf46);\n float ANGLE_sf48 = (_upos.y + 0.00999999978);\n float ANGLE_sf49 = (_uocclusion - 0.800000012);\n float ANGLE_sf4a = (ANGLE_sf49 * 0.0500000007);\n float ANGLE_sf4b = (ANGLE_sf48 + ANGLE_sf4a);\n float ANGLE_sf4c = (_ubreakup * 0.0199999996);\n float ANGLE_sf4d = (ANGLE_sf4b - ANGLE_sf4c);\n float ANGLE_sf4e = smoothstep(0.514999986, 0.485000014, ANGLE_sf4d);\n float ANGLE_sf4 = (1.0 - _unormal.y);\n float ANGLE_sf50 = (1.0 - _utrees);\n float ANGLE_sf51 = (ANGLE_sf4 * ANGLE_sf50);\n float ANGLE_sf52 = (1.0 - ANGLE_sf51);\n float ANGLE_sf53 = (_ubreakup * 0.100000001);\n float ANGLE_sf54 = (ANGLE_sf52 + ANGLE_sf53);\n float ANGLE_sf55 = smoothstep(0.800000012, 1.0, ANGLE_sf54);\n float ANGLE_sf56 = (ANGLE_sf4e * ANGLE_sf55);\n _udiffuseColor = mix(_udiffuseColor, _ugrassMix, ANGLE_sf56);\n float ANGLE_sf58 = powr(_utrees, 8.0);\n vec3 ANGLE_sf59 = (vec3(0.119999997, 0.25999999, 0.100000001) * ANGLE_sf58);\n float ANGLE_sf5a = (_utrees * 2.20000005);\n float ANGLE_sf5b = (ANGLE_sf5a - 0.800000012);\n float ANGLE_sf5c = clamp(ANGLE_sf5b, 0.0, 1.0);\n float ANGLE_sf5d = (ANGLE_sf5c * 0.600000024);\n _udiffuseColor = mix(_udiffuseColor, ANGLE_sf59, ANGLE_sf5d);\n float ANGLE_sf5 = (_ubreakup * 0.5);\n float ANGLE_sf60 = (1.0 + ANGLE_sf5);\n _udiffuseColor *= ANGLE_sf60;\n _udiffuseColor = mix(_udiffuseColor, vec3(1.0, 1.0, 1.0), _udrainage);\n }\n else\n {\n bool ANGLE_sf62 = (_umaterial == 1);\n if (ANGLE_sf62)\n {\n vec3 ANGLE_sf63 = (_udiff * vec3(130.0, 190.0, 250.0));\n vec3 ANGLE_sf64 = cos(ANGLE_sf63);\n vec3 _ustrata = smoothstep(0.0, 1.0, ANGLE_sf64);\n _udiffuseColor = vec3(0.300000012, 0.300000012, 0.300000012);\n _udiffuseColor = mix(_udiffuseColor, vec3(0.5, 0.5, 0.5), _ustrata.x);\n _udiffuseColor = mix(_udiffuseColor, vec3(0.550000012, 0.550000012, 0.550000012), _ustrata.y);\n _udiffuseColor = mix(_udiffuseColor, vec3(0.600000024, 0.600000024, 0.600000024), _ustrata.z);\n float ANGLE_sf69 = (_udiff * 10.0);\n float ANGLE_sf6a = exp(ANGLE_sf69);\n vec3 ANGLE_sf6b = (ANGLE_sf6a * vec3(1.0, 0.899999976, 0.699999988));\n _udiffuseColor *= ANGLE_sf6b;\n }\n else\n {\n bool ANGLE_sf6c = (_umaterial == 2);\n if (ANGLE_sf6c)\n {\n float ANGLE_sf71;\n if (_unormal.y > 0.00999999978)\n {\n float ANGLE_sf6e = (-_udiff);\n float ANGLE_sf6 = (ANGLE_sf6e * 60.0);\n ANGLE_sf71 = exp(ANGLE_sf6);\n }\n else\n {\n ANGLE_sf71 = 0.0;\n }\n float _ushore = ANGLE_sf71;\n float ANGLE_sf76;\n if (_unormal.y > 0.00999999978)\n {\n float ANGLE_sf73 = (_ubreakup * 0.00499999989);\n float ANGLE_sf74 = (_udiff + ANGLE_sf73);\n ANGLE_sf76 = smoothstep(0.00499999989, 0.0, ANGLE_sf74);\n }\n else\n {\n ANGLE_sf76 = 0.0;\n }\n float _ufoam = ANGLE_sf76;\n _udiffuseColor = mix(vec3(0.0, 0.0500000007, 0.100000001), vec3(0.0, 0.25, 0.25), _ushore);\n _udiffuseColor = mix(_udiffuseColor, vec3(1.0, 1.0, 1.0), _ufoam);\n _usmoothness = 0.949999988;\n } else {}\n }\n }\n float _ushadow = 1.0;\n bool ANGLE_sf79 = (_umaterial != 1);\n if (ANGLE_sf79)\n {\n float _us_t = 0.0;\n int _us_material = 0;\n vec3 ANGLE_sf7a = (_upos + vec3(0.0, 9.99999975e-05, 0.0));\n _umarch(ANGLE_userUniforms, ANGLE_nonConstGlobals, ANGLE_textureEnvs, ANGLE_sf7a, _usun, _ufoo, 0u, 1u, 2u, _us_material, _us_t);\n float ANGLE_sf7b = (-_us_t);\n float ANGLE_sf7c = (ANGLE_sf7b * 20.0);\n float ANGLE_sf7d = exp(ANGLE_sf7c);\n _ushadow = (1.0 - ANGLE_sf7d);\n } else {}\n vec3 ANGLE_sf7 = _uSkyColor(_unormal, _usun);\n vec3 ANGLE_sf80 = (_udiffuseColor * ANGLE_sf7);\n float ANGLE_sf81 = _uFd_Lambert();\n _ucolor = (ANGLE_sf80 * ANGLE_sf81);\n _ucolor *= _uocclusion;\n vec3 ANGLE_sf83 = (-_urd);\n vec3 ANGLE_sf84 = (vec3(2.0, 1.96000004, 1.89999998) * _ushadow);\n vec3 ANGLE_sf85 = _uShade(_udiffuseColor, _uf0, _usmoothness, _unormal, ANGLE_sf83, _usun, ANGLE_sf84);\n _ucolor += ANGLE_sf85;\n vec3 ANGLE_sf86 = (_udiffuseColor * vec3(2.0, 1.96000004, 1.89999998));\n vec3 ANGLE_sf87 = (_usun * vec3(1.0, -1.0, 1.0));\n float ANGLE_sf88 = dot(_unormal, ANGLE_sf87);\n float ANGLE_sf89 = (ANGLE_sf88 * 0.5);\n float ANGLE_sf8a = (ANGLE_sf89 + 0.5);\n vec3 ANGLE_sf8b = (ANGLE_sf86 * ANGLE_sf8a);\n float ANGLE_sf8c = _uFd_Lambert();\n vec3 ANGLE_sf8d = (ANGLE_sf8b * ANGLE_sf8c);\n vec3 ANGLE_sf8e = (ANGLE_sf8d / 3.14159274);\n _ucolor += ANGLE_sf8e;\n vec3 ANGLE_sf8 = _uGetReflection(ANGLE_userUniforms, ANGLE_nonConstGlobals, ANGLE_textureEnvs, _upos, _ur, _usun, _usmoothness);\n vec3 ANGLE_sf90 = (-_urd);\n float ANGLE_sf91 = dot(ANGLE_sf90, _unormal);\n vec3 ANGLE_sf92 = _uF_Schlick(_uf0, ANGLE_sf91);\n vec3 ANGLE_sf93 = (ANGLE_sf8 * ANGLE_sf92);\n _ucolor += ANGLE_sf93;\n }\n vec3 _uboxNormal = vec3(0.0, 0.0, 0.0);\n vec2 _ubox = _uboxIntersection(_uro, _urd, ANGLE_nonConstGlobals._uboxSize, _uboxNormal);\n float _ucosth = dot(_urd, _usun);\n float _uphaseR = _uPhaseRayleigh(_ucosth);\n float _uphaseM = _uPhaseMie(_ucosth, 0.600000024);\n vec2 _uod = vec2(0.0, 0.0);\n vec3 _utsm = vec3(0.0, 0.0, 0.0);\n vec3 _usct = vec3(0.0, 0.0, 0.0);\n float ANGLE_sf99;\n if (_ut > 0.0)\n {\n ANGLE_sf99 = _ut;\n }\n else\n {\n ANGLE_sf99 = _ubox.y;\n }\n float _urayLength = (ANGLE_sf99 - _ubox.x);\n float _ustepSize = (_urayLength / 16.0);\n {\n float _ui = 0.0;\n bool ANGLE_scf8 = (_ui < 16.0);\n while (ANGLE_scf8)\n {\n {\n ANGLE_loopForwardProgress();\n {\n float ANGLE_sf9d = (_ui + 0.5);\n float ANGLE_sf9e = (ANGLE_sf9d * _ustepSize);\n float ANGLE_sf9 = (_ubox.x + ANGLE_sf9e);\n vec3 ANGLE_sfa0 = (_urd * ANGLE_sf9);\n vec3 _up = (_uro + ANGLE_sfa0);\n float ANGLE_sfa2 = (_up.y - 0.349999994);\n float _uh = max(0.0, ANGLE_sfa2);\n float ANGLE_sfa4 = (_uh / 0.200000003);\n float ANGLE_sfa5 = clamp(ANGLE_sfa4, 0.0, 1.0);\n float _ud = (1.0 - ANGLE_sfa5);\n bool ANGLE_sfa7 = (_up.y < 0.349999994);\n if (ANGLE_sfa7)\n {\n _ud = 0.0;\n } else {}\n float _udensityR = (_ud * 100000.0);\n float _udensityM = (_ud * 100000.0);\n vec2 ANGLE_sfaa = ANGLE_sd66(_udensityR, _udensityM);\n vec2 ANGLE_sfab = (_ustepSize * ANGLE_sfaa);\n _uod += ANGLE_sfab;\n vec3 ANGLE_sfac = (_uod.x * vec3(5.80200003e-06, 1.35579994e-05, 3.30999974e-05));\n vec3 ANGLE_sfad = (_uod.y * vec3(3.99600003e-06, 3.99600003e-06, 3.99600003e-06));\n vec3 ANGLE_sfae = (ANGLE_sfac + ANGLE_sfad);\n vec3 ANGLE_sfaf = (-ANGLE_sfae);\n _utsm = exp(ANGLE_sfaf);\n vec3 ANGLE_sfb1 = (_utsm * vec3(5.80200003e-06, 1.35579994e-05, 3.30999974e-05));\n vec3 ANGLE_sfb2 = (ANGLE_sfb1 * _uphaseR);\n vec3 ANGLE_sfb3 = (ANGLE_sfb2 * _udensityR);\n vec3 ANGLE_sfb4 = (ANGLE_sfb3 * _ustepSize);\n _usct += ANGLE_sfb4;\n vec3 ANGLE_sfb5 = (_utsm * vec3(3.99600003e-06, 3.99600003e-06, 3.99600003e-06));\n vec3 ANGLE_sfb6 = (ANGLE_sfb5 * _uphaseM);\n vec3 ANGLE_sfb7 = (ANGLE_sfb6 * _udensityM);\n vec3 ANGLE_sfb8 = (ANGLE_sfb7 * _ustepSize);\n _usct += ANGLE_sfb8;\n }\n }\n _ui++;\n ANGLE_scf8 = (_ui < 16.0);\n }\n }\n vec3 ANGLE_sfba = (_ucolor * _utsm);\n vec3 ANGLE_sfbb = (_usct * 10.0);\n _ucolor = (ANGLE_sfba + ANGLE_sfbb);\n _ucolor = _uTonemap_ACES(_ucolor);\n _ucolor = powr(_ucolor, vec3(0.454545438, 0.454545438, 0.454545438));\n vec2 _uchannel2Res = _uiChannelResolution[2].xy;\n vec2 ANGLE_sfbf = mod(_ufragCoord.xy, _uchannel2Res);\n vec2 _uchannel2Tiled = (ANGLE_sfbf / _uchannel2Res);\n vec4 ANGLE_sfc1 = vec4(0.0);\n vec3 ANGLE_sfc2 = (ANGLE_sfc1.xxx / 255.0);\n _ucolor += ANGLE_sfc2;\n _ufragColor = ANGLE_sd69(_ucolor, 1.0);\n}\n\n\n\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) { _umainImage(fragColor, fragCoord); }", - "views": 6999, - "likes": 402, - "createdAt": "2026-04-01T12:12:43.914Z", - "updatedAt": "2026-04-01T13:31:34.487Z", - "sourceFormat": "angle-metal-auto-converted" + "code": "/* This animation is the material of my first youtube tutorial about creative \n coding, which is a video in which I try to introduce programmers to GLSL \n and to the wonderful world of shaders, while also trying to share my recent \n passion for this community.\n Video URL: https://youtu.be/f4s1h2YETNY\n*/\n\n//https://iquilezles.org/articles/palettes/\nvec3 palette( float t ) {\n vec3 a = vec3(0.5, 0.5, 0.5);\n vec3 b = vec3(0.5, 0.5, 0.5);\n vec3 c = vec3(1.0, 1.0, 1.0);\n vec3 d = vec3(0.263,0.416,0.557);\n\n return a + b*cos( 6.28318*(c*t+d) );\n}\n\n//https://www.shadertoy.com/view/mtyGWy\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord ) {\n vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;\n vec2 uv0 = uv;\n vec3 finalColor = vec3(0.0);\n \n for (float i = 0.0; i < 4.0; i++) {\n uv = fract(uv * 1.5) - 0.5;\n\n float d = length(uv) * exp(-length(uv0));\n\n vec3 col = palette(length(uv0) + i*.4 + iTime*.4);\n\n d = sin(d*8. + iTime)/8.;\n d = abs(d);\n\n d = pow(0.01 / d, 1.2);\n\n finalColor += col * d;\n }\n \n fragColor = vec4(finalColor, 1.0);\n}", + "views": 14780, + "likes": 487, + "createdAt": "2026-04-01T15:17:20.407Z", + "sourceFormat": "glsl", + "updatedAt": "2026-04-01T15:23:17.765Z" + }, + { + "id": "d5728c14-a698-4a58-94d7-76a81f97cc99", + "name": "云层", + "author": "unknown", + "code": "/*\n \"Rocaille\" by @XorDev\n \n This time I added multiple layers of turbulence\n with time and color offsets. Loved the shapes.\n \n -1 Thanks to GregRostami\n*/\nvoid mainImage(out vec4 O, vec2 I)\n{\n //Vector for scaling and turbulence\n vec2 v = iResolution.xy,\n //Centered and scaled coordinates\n p = (I+I-v)/v.y/.3;\n \n //Iterators for layers and turbulence frequency\n float i, f;\n for(O*=i;i++<9.;\n //Add coloring, attenuating with turbulent coordinates\n O += (cos(i+vec4(0,1,2,3))+1.)/6./length(v))\n //Turbulence loop\n //https://mini.gmshaders.com/p/turbulence\n for(v=p,f=0.;f++<9.;v+=sin(v.yx*f+i+iTime)/f);\n \n //Tanh tonemapping\n //https://www.shadertoy.com/view/ms3BD7\n O = tanh(O*O);\n}", + "views": 19808, + "likes": 171, + "createdAt": "2026-04-01T15:06:25.335Z", + "sourceFormat": "glsl", + "updatedAt": "2026-04-01T15:23:17.766Z" }, { "id": "alien-core-ported", diff --git a/display.js b/display.js index cd55ba5..e25758a 100644 --- a/display.js +++ b/display.js @@ -13,6 +13,27 @@ const backBtn = document.getElementById("back-btn"); const API_BASE = "/api/shaders"; +/** Grid previews: limit fill-rate so many cards can stay near 60fps (detail view uses full quality). */ +const PREVIEW_MAX_PIXEL_RATIO = 1.25; +const PREVIEW_MAX_BUFFER_LONG_SIDE = 520; +const DETAIL_MAX_PIXEL_RATIO = 2; +const DETAIL_MAX_BUFFER_LONG_SIDE = 2560; + +const GL_CONTEXT_OPTS = { + alpha: false, + antialias: false, + depth: false, + stencil: false, + powerPreference: "high-performance", + desynchronized: true, +}; + +/** Browsers cap concurrent WebGL contexts (~8); keep grid below so detail view + pool stay safe. */ +const MAX_GRID_WEBGL_CONTEXTS = 7; +const WEBGL_TEARDOWN_DEBOUNCE_MS = 450; + +let gridGlTouchCounter = 0; + const vertexShaderSource = `#version 300 es precision highp float; layout(location = 0) in vec2 aPosition; @@ -85,6 +106,10 @@ uniform float iTime; uniform float iTimeDelta; uniform int iFrame; uniform vec4 iMouse; +uniform sampler2D iChannel0; +uniform sampler2D iChannel1; +uniform sampler2D iChannel2; +uniform sampler2D iChannel3; ${userCode} void main() { mainImage(outColor, gl_FragCoord.xy); }`; } @@ -130,7 +155,253 @@ function compileProgram(gl, fragmentShaderSource) { return program; } +function createTexture(gl, width, height, data) { + const tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); + gl.bindTexture(gl.TEXTURE_2D, null); + return tex; +} + +function createDefaultChannelTextures(gl, noiseSize = 256) { + // iChannel0: audio-like lookup texture (matches many shadertoy audio assumptions) + const w0 = 512; + const h0 = 2; + const d0 = new Uint8Array(w0 * h0 * 4); + for (let x = 0; x < w0; x++) { + const t = x / (w0 - 1); + const fft = Math.floor(255 * Math.pow(1.0 - t, 1.8)); + const wave = Math.floor(128 + 127 * Math.sin(t * Math.PI * 10.0)); + // row0: fft, row1: waveform + const i0 = (x + 0 * w0) * 4; + const i1 = (x + 1 * w0) * 4; + d0[i0] = fft; d0[i0 + 1] = fft; d0[i0 + 2] = fft; d0[i0 + 3] = 255; + d0[i1] = wave; d0[i1 + 1] = wave; d0[i1 + 2] = wave; d0[i1 + 3] = 255; + } + + // iChannel1/2/3: tiling noise/grain-like textures (smaller in grid previews). + const size = noiseSize; + const makeNoise = (scaleA, scaleB) => { + const d = new Uint8Array(size * size * 4); + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + const i = (y * size + x) * 4; + const n = Math.floor( + 127 + + 127 * + Math.sin((x * scaleA + y * scaleB) * 0.11) * + Math.cos((x * scaleB - y * scaleA) * 0.07) + ); + d[i] = n; + d[i + 1] = (n * 37) & 255; + d[i + 2] = (n * 73) & 255; + d[i + 3] = 255; + } + } + return d; + }; + + return [ + createTexture(gl, w0, h0, d0), + createTexture(gl, size, size, makeNoise(1.0, 0.7)), + createTexture(gl, size, size, makeNoise(0.8, 1.3)), + createTexture(gl, size, size, makeNoise(1.7, 0.4)), + ]; +} + +function bindChannelTextures(gl, channelUniformLocs, channelTextures) { + for (let i = 0; i < 4; i++) { + if (channelUniformLocs[i] == null) continue; + gl.activeTexture(gl.TEXTURE0 + i); + gl.bindTexture(gl.TEXTURE_2D, channelTextures[i]); + gl.uniform1i(channelUniformLocs[i], i); + } + gl.activeTexture(gl.TEXTURE0); +} + +function computePreviewBufferSize(cssW, cssH) { + const dpr = Math.min(window.devicePixelRatio || 1, PREVIEW_MAX_PIXEL_RATIO); + let w = Math.max(1, Math.floor(cssW * dpr)); + let h = Math.max(1, Math.floor(cssH * dpr)); + const long = Math.max(w, h); + if (long > PREVIEW_MAX_BUFFER_LONG_SIDE) { + const s = PREVIEW_MAX_BUFFER_LONG_SIDE / long; + w = Math.max(1, Math.floor(w * s)); + h = Math.max(1, Math.floor(h * s)); + } + return { w, h }; +} + +function computeDetailBufferSize(cssW, cssH) { + const dpr = Math.min(window.devicePixelRatio || 1, DETAIL_MAX_PIXEL_RATIO); + let w = Math.max(1, Math.floor(cssW * dpr)); + let h = Math.max(1, Math.floor(cssH * dpr)); + const long = Math.max(w, h); + if (long > DETAIL_MAX_BUFFER_LONG_SIDE) { + const s = DETAIL_MAX_BUFFER_LONG_SIDE / long; + w = Math.max(1, Math.floor(w * s)); + h = Math.max(1, Math.floor(h * s)); + } + return { w, h }; +} + +function countGridWebGLContexts() { + let n = 0; + for (const p of previews) { + if (p.gl) n += 1; + } + return n; +} + +function tearDownPreviewWebGL(state) { + if (state._tearDownTimer) { + clearTimeout(state._tearDownTimer); + state._tearDownTimer = null; + } + state._staticRendered = false; + state._staticDirty = true; + if (!state.gl) return; + const gl = state.gl; + try { + if (state.program) gl.deleteProgram(state.program); + if (state.vao) gl.deleteVertexArray(state.vao); + if (state.vbo) gl.deleteBuffer(state.vbo); + if (state.channelTextures) state.channelTextures.forEach((t) => gl.deleteTexture(t)); + } catch (_) { + /* context may already be lost */ + } + const ext = gl.getExtension("WEBGL_lose_context"); + if (ext) ext.loseContext(); + state.gl = null; + state.program = null; + state.vao = null; + state.vbo = null; + state.channelTextures = null; + state.channelUniforms = null; + state.uniforms = null; +} + +/** Only evict GPU for cards that are not visible / filtered out — avoids thrash when many cards are on-screen. */ +function evictOffscreenGridWebGLContext() { + const off = previews.filter((p) => p.gl && (!p.visible || p.card.style.display === "none")); + if (!off.length) return false; + off.sort((a, b) => (a._glTouchSeq || 0) - (b._glTouchSeq || 0)); + tearDownPreviewWebGL(off[0]); + return true; +} + +function ensurePreviewWebGL(state) { + if (state.gl || state.compileFailed) return; + const errorEl = state.card.querySelector(".error"); + while (countGridWebGLContexts() >= MAX_GRID_WEBGL_CONTEXTS) { + if (!evictOffscreenGridWebGLContext()) break; + } + if (countGridWebGLContexts() >= MAX_GRID_WEBGL_CONTEXTS) { + return; + } + const gl = state.canvas.getContext("webgl2", GL_CONTEXT_OPTS); + if (!gl) { + errorEl.textContent = "当前浏览器不支持 WebGL2"; + state.compileFailed = true; + return; + } + let program; + let codeForRender = state.code; + try { + program = compileProgram(gl, buildFragmentShader(codeForRender)); + errorEl.textContent = ""; + } catch (_err1) { + try { + codeForRender = toPortableGlsl(state.code); + program = compileProgram(gl, buildFragmentShader(codeForRender)); + errorEl.textContent = ""; + } catch (_err2) { + codeForRender = fallbackShader(state.name); + try { + program = compileProgram(gl, buildFragmentShader(codeForRender)); + errorEl.textContent = ""; + } catch (err3) { + errorEl.textContent = `编译失败:\n${String(err3.message || err3)}`; + state.compileFailed = true; + const ext = gl.getExtension("WEBGL_lose_context"); + if (ext) ext.loseContext(); + return; + } + } + } + state.codeForRender = codeForRender; + const { vao, vbo } = createQuad(gl); + const channelTextures = createDefaultChannelTextures(gl, 128); + const channelUniforms = [ + gl.getUniformLocation(program, "iChannel0"), + gl.getUniformLocation(program, "iChannel1"), + gl.getUniformLocation(program, "iChannel2"), + gl.getUniformLocation(program, "iChannel3"), + ]; + const uniforms = { + iResolution: gl.getUniformLocation(program, "iResolution"), + iTime: gl.getUniformLocation(program, "iTime"), + iTimeDelta: gl.getUniformLocation(program, "iTimeDelta"), + iFrame: gl.getUniformLocation(program, "iFrame"), + iMouse: gl.getUniformLocation(program, "iMouse"), + }; + state.gl = gl; + state.program = program; + state.vao = vao; + state.vbo = vbo; + state.channelTextures = channelTextures; + state.channelUniforms = channelUniforms; + state.uniforms = uniforms; + state._glTouchSeq = ++gridGlTouchCounter; + state._staticDirty = true; +} + const previews = []; +/** Driven by scheduleRender(); only runs while detail / hover / pending static thumbs need a frame. */ +let renderRafId = 0; + +function scheduleRender() { + if (renderRafId) return; + renderRafId = requestAnimationFrame((ts) => { + renderRafId = 0; + renderAll(ts); + }); +} + +function shouldKeepAnimatingGrid() { + for (const p of previews) { + if (p.card.style.display === "none") continue; + if (!p.visible) continue; + if (p.isPointerOver) return true; + } + return false; +} + +function needsStaticThumbnailPass() { + for (const p of previews) { + if (p.card.style.display === "none") continue; + if (!p.visible) continue; + if (p.isPointerOver) continue; + if (p.compileFailed) continue; + if (p._staticRendered && !p._staticDirty) continue; + if (!p.gl && countGridWebGLContexts() >= MAX_GRID_WEBGL_CONTEXTS) continue; + return true; + } + return false; +} + +function shouldScheduleNextFrame() { + if (detailRuntime) return true; + if (shouldKeepAnimatingGrid()) return true; + if (needsStaticThumbnailPass()) return true; + return false; +} + let paused = false; let elapsed = 0; let frame = 0; @@ -168,64 +439,57 @@ function createPreviewCard(shader) { const canvas = card.querySelector("canvas"); const errorEl = card.querySelector(".error"); const pauseLocalBtn = card.querySelector(".pause-local-btn"); - const gl = canvas.getContext("webgl2", { antialias: false, alpha: false }); - if (!gl) { - errorEl.textContent = "当前浏览器不支持 WebGL2"; - return; - } - - let program; - let codeForRender = code; - try { - program = compileProgram(gl, buildFragmentShader(codeForRender)); - } catch (_err1) { - try { - codeForRender = toPortableGlsl(code); - program = compileProgram(gl, buildFragmentShader(codeForRender)); - errorEl.textContent = ""; - } catch (_err2) { - codeForRender = fallbackShader(name); - try { - program = compileProgram(gl, buildFragmentShader(codeForRender)); - errorEl.textContent = ""; - } catch (err3) { - errorEl.textContent = `编译失败:\n${String(err3.message || err3)}`; - return; - } - } - } - - const { vao } = createQuad(gl); - const uniforms = { - iResolution: gl.getUniformLocation(program, "iResolution"), - iTime: gl.getUniformLocation(program, "iTime"), - iTimeDelta: gl.getUniformLocation(program, "iTimeDelta"), - iFrame: gl.getUniformLocation(program, "iFrame"), - iMouse: gl.getUniformLocation(program, "iMouse"), - }; const state = { id, name, code, - codeForRender, + codeForRender: code, + compileFailed: false, card, canvas, - gl, - program, - vao, - uniforms, + gl: null, + program: null, + vao: null, + vbo: null, + channelTextures: null, + channelUniforms: null, + uniforms: null, mouse: { x: 0, y: 0, downX: 0, downY: 0, down: false }, isPlaying: true, localTime: 0, localFrame: 0, lastTick: performance.now(), + visible: false, + _layoutW: 0, + _layoutH: 0, + _glTouchSeq: 0, + _tearDownTimer: null, + isPointerOver: false, + _staticRendered: false, + _staticDirty: true, }; + card.addEventListener("mouseenter", () => { + state.isPointerOver = true; + state.lastTick = performance.now(); + scheduleRender(); + }); + card.addEventListener("mouseleave", () => { + state.isPointerOver = false; + state.localTime = 0; + state.localFrame = 0; + state._staticDirty = true; + state._staticRendered = false; + scheduleRender(); + }); + canvas.addEventListener("mousemove", (event) => { const rect = canvas.getBoundingClientRect(); - state.mouse.x = ((event.clientX - rect.left) / rect.width) * canvas.width; - state.mouse.y = ((rect.bottom - event.clientY) / rect.height) * canvas.height; + const bw = canvas.width || Math.max(1, state._layoutW || rect.width); + const bh = canvas.height || Math.max(1, state._layoutH || rect.height); + state.mouse.x = ((event.clientX - rect.left) / rect.width) * bw; + state.mouse.y = ((rect.bottom - event.clientY) / rect.height) * bh; }); canvas.addEventListener("mousedown", () => { state.mouse.down = true; @@ -241,15 +505,63 @@ function createPreviewCard(shader) { state.isPlaying = !state.isPlaying; state.lastTick = performance.now(); pauseLocalBtn.textContent = state.isPlaying ? "暂停" : "继续"; + scheduleRender(); }); canvas.addEventListener("click", () => openDetail(state)); gridEl.appendChild(card); + + const ro = new ResizeObserver((entries) => { + for (const entry of entries) { + if (entry.target !== canvas) continue; + const cr = entry.contentRect; + state._layoutW = cr.width; + state._layoutH = cr.height; + state._staticDirty = true; + scheduleRender(); + } + }); + ro.observe(canvas); + state._resizeObserver = ro; + + const io = new IntersectionObserver( + (entries) => { + for (const e of entries) { + if (e.target !== canvas) continue; + state.visible = e.isIntersecting; + if (e.isIntersecting) { + if (state._tearDownTimer) { + clearTimeout(state._tearDownTimer); + state._tearDownTimer = null; + } + state._staticDirty = true; + state._staticRendered = false; + ensurePreviewWebGL(state); + scheduleRender(); + } else { + if (state._tearDownTimer) clearTimeout(state._tearDownTimer); + state._tearDownTimer = setTimeout(() => { + state._tearDownTimer = null; + if (!state.visible) tearDownPreviewWebGL(state); + }, WEBGL_TEARDOWN_DEBOUNCE_MS); + } + } + }, + { root: null, rootMargin: "120px", threshold: 0.01 } + ); + io.observe(canvas); + state._io = io; + previews.push(state); } function clearPreviews() { - previews.forEach((preview) => preview.card.remove()); + previews.forEach((preview) => { + tearDownPreviewWebGL(preview); + if (preview._resizeObserver) preview._resizeObserver.disconnect(); + if (preview._io) preview._io.disconnect(); + preview.card.remove(); + }); previews.length = 0; } @@ -257,16 +569,18 @@ function closeDetail() { detailViewEl.classList.remove("active"); detailViewEl.setAttribute("aria-hidden", "true"); if (!detailRuntime) return; - const { gl, program, vao, vbo } = detailRuntime; + const { gl, program, vao, vbo, channelTextures = [], _detailResizeObserver } = detailRuntime; + if (_detailResizeObserver) _detailResizeObserver.disconnect(); gl.deleteProgram(program); gl.deleteVertexArray(vao); gl.deleteBuffer(vbo); + channelTextures.forEach((tex) => gl.deleteTexture(tex)); detailRuntime = null; } function openDetail(previewState) { closeDetail(); - const gl = detailCanvas.getContext("webgl2", { antialias: false, alpha: false }); + const gl = detailCanvas.getContext("webgl2", GL_CONTEXT_OPTS); if (!gl) return; let program; const detailCode = previewState.codeForRender || previewState.code; @@ -277,11 +591,20 @@ function openDetail(previewState) { return; } const { vao, vbo } = createQuad(gl); + const channelTextures = createDefaultChannelTextures(gl, 256); + const channelUniforms = [ + gl.getUniformLocation(program, "iChannel0"), + gl.getUniformLocation(program, "iChannel1"), + gl.getUniformLocation(program, "iChannel2"), + gl.getUniformLocation(program, "iChannel3"), + ]; detailRuntime = { gl, program, vao, vbo, + channelTextures, + channelUniforms, uniforms: { iResolution: gl.getUniformLocation(program, "iResolution"), iTime: gl.getUniformLocation(program, "iTime"), @@ -290,10 +613,24 @@ function openDetail(previewState) { iMouse: gl.getUniformLocation(program, "iMouse"), }, mouse: { x: 0, y: 0, downX: 0, downY: 0, down: false }, + _layoutW: 0, + _layoutH: 0, }; + const dro = new ResizeObserver((entries) => { + for (const e of entries) { + if (e.target !== detailCanvas) continue; + const cr = e.contentRect; + detailRuntime._layoutW = cr.width; + detailRuntime._layoutH = cr.height; + } + }); + dro.observe(detailCanvas); + detailRuntime._detailResizeObserver = dro; + detailTitleEl.textContent = previewState.name; detailViewEl.classList.add("active"); detailViewEl.setAttribute("aria-hidden", "false"); + scheduleRender(); } function applySearch() { @@ -301,6 +638,7 @@ function applySearch() { for (const preview of previews) { preview.card.style.display = !keyword || preview.card.dataset.search.includes(keyword) ? "" : "none"; } + scheduleRender(); } async function loadShaders() { @@ -346,29 +684,63 @@ function renderAll(ts) { fpsCounter += 1; } + const detailOpen = !!detailRuntime; + for (const preview of previews) { - const { gl, canvas, program, vao, uniforms, mouse } = preview; - const now = performance.now(); - const localDt = Math.min((now - preview.lastTick) / 1000, 0.05); - preview.lastTick = now; - if (preview.isPlaying && !paused) { - preview.localTime += localDt; - preview.localFrame += 1; + let localDt = 0; + if (!detailOpen) { + const now = performance.now(); + localDt = Math.min((now - preview.lastTick) / 1000, 0.05); + preview.lastTick = now; + if (preview.isPointerOver && preview.isPlaying && !paused) { + preview.localTime += localDt; + preview.localFrame += 1; + } } - const rect = canvas.getBoundingClientRect(); - const dpr = Math.min(window.devicePixelRatio || 1, 2); - const w = Math.max(1, Math.floor(rect.width * dpr)); - const h = Math.max(1, Math.floor(rect.height * dpr)); + + if ( + !detailOpen && + preview.card.style.display !== "none" && + preview.visible && + !preview.gl && + !preview.compileFailed + ) { + ensurePreviewWebGL(preview); + } + + if (detailOpen) continue; + if (preview.card.style.display === "none") continue; + if (preview.visible === false) continue; + if (!preview.gl) continue; + + const isAnim = preview.isPointerOver; + if (!isAnim && preview._staticRendered && !preview._staticDirty) continue; + + const { gl, canvas, program, vao, uniforms, mouse, channelTextures, channelUniforms } = preview; + if (!preview._layoutW || !preview._layoutH) { + const r = canvas.getBoundingClientRect(); + preview._layoutW = r.width; + preview._layoutH = r.height; + } + const { w, h } = computePreviewBufferSize(preview._layoutW, preview._layoutH); if (canvas.width !== w || canvas.height !== h) { canvas.width = w; canvas.height = h; gl.viewport(0, 0, w, h); + if (!isAnim) preview._staticDirty = true; } gl.useProgram(program); + bindChannelTextures(gl, channelUniforms, channelTextures); gl.uniform3f(uniforms.iResolution, canvas.width, canvas.height, 1); - gl.uniform1f(uniforms.iTime, preview.localTime); - gl.uniform1f(uniforms.iTimeDelta, preview.isPlaying && !paused ? localDt : 0); - gl.uniform1i(uniforms.iFrame, preview.localFrame); + if (isAnim) { + gl.uniform1f(uniforms.iTime, preview.localTime); + gl.uniform1f(uniforms.iTimeDelta, preview.isPlaying && !paused ? localDt : 0); + gl.uniform1i(uniforms.iFrame, preview.localFrame); + } else { + gl.uniform1f(uniforms.iTime, 0); + gl.uniform1f(uniforms.iTimeDelta, 0); + gl.uniform1i(uniforms.iFrame, 0); + } gl.uniform4f( uniforms.iMouse, mouse.x, @@ -379,19 +751,27 @@ function renderAll(ts) { gl.bindVertexArray(vao); gl.drawArrays(gl.TRIANGLES, 0, 6); gl.bindVertexArray(null); + preview._glTouchSeq = ++gridGlTouchCounter; + if (!isAnim) { + preview._staticRendered = true; + preview._staticDirty = false; + } } if (detailRuntime) { - const { gl, program, vao, uniforms, mouse } = detailRuntime; - const dpr = Math.min(window.devicePixelRatio || 1, 2); - const w = Math.max(1, Math.floor(detailCanvas.clientWidth * dpr)); - const h = Math.max(1, Math.floor(detailCanvas.clientHeight * dpr)); + const { gl, program, vao, uniforms, mouse, channelTextures, channelUniforms } = detailRuntime; + const lw = + detailRuntime._layoutW > 0 ? detailRuntime._layoutW : detailCanvas.clientWidth || 1; + const lh = + detailRuntime._layoutH > 0 ? detailRuntime._layoutH : detailCanvas.clientHeight || 1; + const { w, h } = computeDetailBufferSize(lw, lh); if (detailCanvas.width !== w || detailCanvas.height !== h) { detailCanvas.width = w; detailCanvas.height = h; gl.viewport(0, 0, w, h); } gl.useProgram(program); + bindChannelTextures(gl, channelUniforms, channelTextures); gl.uniform3f(uniforms.iResolution, detailCanvas.width, detailCanvas.height, 1); gl.uniform1f(uniforms.iTime, elapsed); gl.uniform1f(uniforms.iTimeDelta, dt); @@ -416,13 +796,14 @@ function renderAll(ts) { } } - requestAnimationFrame(renderAll); + if (shouldScheduleNextFrame()) scheduleRender(); } pauseBtn.addEventListener("click", () => { paused = !paused; pauseBtn.textContent = paused ? "全局继续" : "全局暂停"; syncStats(); + scheduleRender(); }); resetBtn.addEventListener("click", () => { elapsed = 0; @@ -432,8 +813,12 @@ resetBtn.addEventListener("click", () => { detailLastSec = 0; detailFpsCounter = 0; syncStats(); + scheduleRender(); +}); +backBtn.addEventListener("click", () => { + closeDetail(); + scheduleRender(); }); -backBtn.addEventListener("click", closeDetail); detailCanvas.addEventListener("mousemove", (event) => { if (!detailRuntime) return; const rect = detailCanvas.getBoundingClientRect(); @@ -457,4 +842,4 @@ searchInput.addEventListener("input", (event) => { loadShaders(); setInterval(loadShaders, 3000); -requestAnimationFrame(renderAll); +scheduleRender(); diff --git a/index.html b/index.html index b23686d..836f144 100644 --- a/index.html +++ b/index.html @@ -100,6 +100,14 @@ color: #c3c5cd; } + .view-hint { + margin: 8px 0 0; + font-size: 12px; + line-height: 1.45; + color: #8b92a8; + max-width: 720px; + } + .main { padding: 16px; } @@ -124,6 +132,8 @@ } .card { + content-visibility: auto; + contain-intrinsic-size: 300px 220px; border: 1px solid rgba(104, 129, 255, 0.35); border-radius: 12px; overflow: hidden; @@ -294,6 +304,9 @@
准备就绪
+

+ 列表默认仅显示首帧静态预览;鼠标悬停在卡片上时才会持续渲染动画。点击进入全屏仍为实时播放。 +

diff --git a/server.js b/server.js index c35333b..e6ab6fc 100644 --- a/server.js +++ b/server.js @@ -81,6 +81,35 @@ function extractFunctionBlocks(code) { return blocks; } +function buildFunctionMap(blocks) { + const map = new Map(); + for (const block of blocks) { + const m = block.match(/^\s*(?:void|float|vec[234]|mat[234]|int|uint)\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/m); + if (!m) continue; + map.set(m[1], block); + } + return map; +} + +function collectFunctionDependencies(fnMap, roots) { + const keep = new Set(); + const queue = [...roots]; + while (queue.length) { + const name = queue.shift(); + if (keep.has(name)) continue; + const block = fnMap.get(name); + if (!block) continue; + keep.add(name); + const callPattern = /\b([A-Za-z_][A-Za-z0-9_]*)\s*\(/g; + let m; + while ((m = callPattern.exec(block)) !== null) { + const callee = m[1]; + if (fnMap.has(callee) && !keep.has(callee)) queue.push(callee); + } + } + return keep; +} + function convertAngleLikeToGlsl(code) { let s = code; const cut = s.indexOf("fragment ANGLE_FragmentOut"); @@ -110,6 +139,14 @@ function convertAngleLikeToGlsl(code) { .replace(/\bANGLE_userUniforms\._uiTime\b/g, "iTime") .replace(/\bANGLE_userUniforms\._uiMouse\b/g, "iMouse") .replace(/\bANGLE_userUniforms\./g, "") + .replace(/ANGLE_texture\(\s*ANGLE_textureEnvs\._uiChannel0\s*,\s*([^)]+)\)/g, "texture(iChannel0, $1)") + .replace(/ANGLE_texture\(\s*ANGLE_textureEnvs\._uiChannel1\s*,\s*([^)]+)\)/g, "texture(iChannel1, $1)") + .replace(/ANGLE_texture\(\s*ANGLE_textureEnvs\._uiChannel2\s*,\s*([^)]+)\)/g, "texture(iChannel2, $1)") + .replace(/ANGLE_texture\(\s*ANGLE_textureEnvs\._uiChannel3\s*,\s*([^)]+)\)/g, "texture(iChannel3, $1)") + .replace(/ANGLE_texelFetch\(\s*ANGLE_textureEnvs\._uiChannel0\s*,\s*([^,]+)\s*,\s*([^)]+)\)/g, "texelFetch(iChannel0, $1, $2)") + .replace(/ANGLE_texelFetch\(\s*ANGLE_textureEnvs\._uiChannel1\s*,\s*([^,]+)\s*,\s*([^)]+)\)/g, "texelFetch(iChannel1, $1, $2)") + .replace(/ANGLE_texelFetch\(\s*ANGLE_textureEnvs\._uiChannel2\s*,\s*([^,]+)\s*,\s*([^)]+)\)/g, "texelFetch(iChannel2, $1, $2)") + .replace(/ANGLE_texelFetch\(\s*ANGLE_textureEnvs\._uiChannel3\s*,\s*([^,]+)\s*,\s*([^)]+)\)/g, "texelFetch(iChannel3, $1, $2)") .replace(/ANGLE_texture\([^)]*\)/g, "vec4(0.0)") .replace(/ANGLE_texelFetch\([^)]*\)/g, "vec4(0.0)") .replace(/\bANGLE_mod\(/g, "mod(") @@ -123,14 +160,21 @@ function convertAngleLikeToGlsl(code) { .replace(/\(\s*,/g, "(") .replace(/,\s*,/g, ",") .replace(/,\s*\)/g, ")") + .replace(/\bANGLE_nonConstGlobals\./g, "") .replace(/(\d+\.\d+|\d+)f\b/g, "$1") .replace(/;\s*;/g, ";"); s = s.replace(/void\s+_umainImage\s*\([^)]*\)/g, "void _umainImage(out vec4 _ufragColor, vec2 _ufragCoord)"); - const blocks = extractFunctionBlocks(s).filter((b) => + const fnBlocks = extractFunctionBlocks(s).filter((b) => /(ANGLE_sc|ANGLE_sd|_u|mainImage|ANGLE_loopForwardProgress|_umainImage)/.test(b) ); + const fnMap = buildFunctionMap(fnBlocks); + const keepNames = collectFunctionDependencies(fnMap, ["mainImage", "_umainImage"]); + if (fnMap.has("ANGLE_loopForwardProgress")) keepNames.add("ANGLE_loopForwardProgress"); + const blocks = [...fnMap.entries()] + .filter(([name]) => keepNames.has(name)) + .map(([, block]) => block); if (!blocks.length || !s.includes("_umainImage")) return ""; @@ -153,6 +197,42 @@ function convertAngleLikeToGlsl(code) { return withoutDupLoop.join("\n\n"); } +/** Strip ShaderToy export preamble (uniform iResolution…), fix `}uniform` gluing, keep first mainImage only. */ +function sanitizeShadertoyUserGlsl(code) { + if (!code || typeof code !== "string") return ""; + let s = code.replace(/\r\n/g, "\n"); + s = s.replace(/\}\s*(?=uniform\s+)/g, "}\n"); + const lines = s.split("\n"); + s = lines + .filter((line) => !/^\s*uniform\s+/.test(line.trim())) + .join("\n"); + s = s.replace(/^\s+/, "").replace(/\s+$/, ""); + + const re = /\bvoid\s+mainImage\s*\(/g; + const matches = [...s.matchAll(re)]; + if (matches.length <= 1) return s; + + const start = matches[0].index; + const braceStart = s.indexOf("{", s.indexOf("(", start)); + if (braceStart < 0) return s; + let depth = 0; + let i = braceStart; + for (; i < s.length; i++) { + const ch = s[i]; + if (ch === "{") depth++; + else if (ch === "}") { + depth--; + if (depth === 0) { + i++; + break; + } + } + } + const firstMain = s.slice(start, i); + const prefix = s.slice(0, start).trimEnd(); + return (prefix ? `${prefix}\n\n` : "") + firstMain.trim(); +} + function normalizeIncomingCode(code) { if (!code || typeof code !== "string") return { error: "code 不能为空", normalized: "" }; if (isAngleLike(code)) { @@ -162,10 +242,11 @@ function normalizeIncomingCode(code) { } return { error: "", normalized: converted }; } - if (!code.includes("mainImage")) { + const sanitized = sanitizeShadertoyUserGlsl(code); + if (!sanitized.includes("mainImage")) { return { error: "code 必须包含 mainImage", normalized: "" }; } - return { error: "", normalized: code }; + return { error: "", normalized: sanitized }; } async function autoNormalizeStoredShaders() { @@ -173,9 +254,10 @@ async function autoNormalizeStoredShaders() { let changed = false; const next = shaders.map((item) => { const code = String(item.code || ""); - if (isAngleLike(code) || code.includes("struct ANGLE_") || item.sourceFormat === "angle-metal-auto-converted") { + const angle = isAngleLike(code) || code.includes("struct ANGLE_"); + if (angle) { const { error, normalized } = normalizeIncomingCode(code); - if (!error && normalized) { + if (!error && normalized && normalized !== code) { changed = true; return { ...item, @@ -184,6 +266,18 @@ async function autoNormalizeStoredShaders() { sourceFormat: "angle-metal-auto-converted", }; } + return item; + } + const { error, normalized } = normalizeIncomingCode(code); + if (!error && normalized && normalized !== code) { + changed = true; + const fixTag = item.sourceFormat === "angle-metal-auto-converted" ? { sourceFormat: "glsl" } : {}; + return { + ...item, + code: normalized, + updatedAt: new Date().toISOString(), + ...fixTag, + }; } return item; }); @@ -195,10 +289,13 @@ app.get("/api/shaders", async (_req, res) => { let shaders = await readDb(); // Runtime safeguard: always return normalized code for display layer. shaders = shaders.map((item) => { - const { error, normalized } = normalizeIncomingCode(String(item.code || "")); + const raw = String(item.code || ""); + const { error, normalized } = normalizeIncomingCode(raw); if (error || !normalized) return item; - if (normalized === item.code) return item; - return { ...item, code: normalized, sourceFormat: "angle-metal-auto-converted" }; + if (normalized === raw) return item; + const next = { ...item, code: normalized }; + if (isAngleLike(raw)) next.sourceFormat = "angle-metal-auto-converted"; + return next; }); res.json(shaders); } catch { @@ -250,8 +347,10 @@ app.delete("/api/shaders/:id", async (req, res) => { } }); -ensureDb().then(() => { - autoNormalizeStoredShaders().catch(() => {}); +ensureDb().then(async () => { + try { + await autoNormalizeStoredShaders(); + } catch (_) {} app.listen(PORT, () => { console.log(`Server running: http://localhost:${PORT}`); });