GLSL shader
Neon Kaleidoscope
A kaleidoscopic fractal tunnel written entirely in GLSL. Space is warped, mirrored into eight segments, then folded into itself again and again, and each layer adds a thin ribbon of neon light. Every pixel is computed on the GPU in real time. Use the sliders to change speed, layer count, warp, glow, and hue: from a precise, glowing mandala to something liquid and alive.
مجوز: CC BY-NC-SA 4.0: ریمیکس با ذکر نام، غیرتجاری، با همین مجوز
دیدن کد
precision highp float;
uniform float u_time;
uniform vec2 u_resolution;
uniform float u_speed;
uniform float u_detail;
uniform float u_warp;
uniform float u_glow;
uniform float u_hue;
// پالت رنگی کسینوسی
vec3 pal(float t) {
return 0.5 + 0.5 * cos(6.28318 * (t + vec3(0.0, 0.33, 0.67) + u_hue));
}
mat2 rot(float a) {
float c = cos(a), s = sin(a);
return mat2(c, -s, s, c);
}
void main() {
vec2 uv = (gl_FragCoord.xy - 0.5 * u_resolution) / min(u_resolution.x, u_resolution.y);
vec2 uv0 = uv;
// اگر اسلایدرها ساخته نشدهاند، مقدارهای پیشفرض استفاده میشود
bool noSliders = (u_detail + u_glow) < 0.01;
float speed = noSliders ? 1.0 : u_speed;
float detail = noSliders ? 4.0 : u_detail;
float warp = noSliders ? 0.6 : u_warp;
float glow = noSliders ? 1.2 : u_glow;
float t = u_time * speed;
// موجدار کردن فضا
uv += warp * 0.15 * vec2(sin(uv.y * 6.0 + t), cos(uv.x * 6.0 - t));
// کالیدوسکوپ: تکرار قطاعها با آینه
float a = atan(uv.y, uv.x);
float r = length(uv);
float seg = 6.28318 / 8.0;
a = abs(mod(a, seg) - seg * 0.5);
uv = vec2(cos(a), sin(a)) * r;
uv *= rot(t * 0.1);
vec3 col = vec3(0.0);
for (int i = 0; i < 6; i++) {
if (float(i) >= detail) break;
float fi = float(i);
uv = fract(uv * 1.5) - 0.5;
float d = length(uv) * exp(-length(uv0));
vec3 c = pal(length(uv0) + fi * 0.4 + t * 0.2);
d = sin(d * 8.0 + t) / 8.0;
d = abs(d) + 0.0005;
d = pow(0.01 / d, 1.2);
col += c * d;
}
// تونمپ نرم تا نورها نسوزند
col = 1.0 - exp(-col * glow);
gl_FragColor = vec4(col, 1.0);
}