56 float bass = texture(
spectrum, 0.04).r;
57 float mid = texture(
spectrum, 0.22).r;
58 float hiMid = texture(
spectrum, 0.40).r;
59 float treble = texture(
spectrum, 0.58).r;
60 float air = texture(
spectrum, 0.80).r;
62 vec2 uv = tc * 2.0 - 1.0;
66 float angle = atan(uv.y, uv.x);
69 float cellScale = 6.0 + bass * 4.0;
70 vec2 cellUV = uv * cellScale;
71 vec2 cellID = floor(cellUV);
72 vec2 cellF = fract(cellUV);
75 float secondDist = 10.0;
76 vec2 nearestID = vec2(0.0);
78 for (
int y = -1; y <= 1; y++) {
79 for (
int x = -1; x <= 1; x++) {
80 vec2 neighbor = vec2(
float(x),
float(y));
81 vec2 point =
hash2(cellID + neighbor);
82 point = 0.5 + 0.5 * sin(
time_f * 0.5 + 6.28318 * point);
83 float d = length(cellF - neighbor - point);
87 nearestID = cellID + neighbor;
88 }
else if (d < secondDist) {
95 float crack = secondDist - minDist;
96 float crackMask = smoothstep(0.0, 0.05 + treble * 0.03, crack);
97 float crackGlow = 1.0 - crackMask;
100 float cellHash = fract(sin(dot(nearestID, vec2(12.9898, 78.233))) * 43758.5453);
101 vec2 cellOffset = vec2(cellHash * 0.02, fract(cellHash * 7.0) * 0.02);
102 vec2 sampUV = tc + cellOffset * (1.0 + mid * 2.0);
105 float chroma = 0.008 + air * 0.02;
107 baseTex.r = texture(samp, sampUV + vec2(chroma, 0.0)).r;
108 baseTex.g = texture(samp, sampUV).g;
109 baseTex.b = texture(samp, sampUV - vec2(chroma, 0.0)).b;
113 vec3 crackColor = stressColor * crackGlow * (2.0 + hiMid * 3.0);
116 float sheen = sin(r * 10.0 + angle * 3.0 +
time_f) * 0.5 + 0.5;
119 vec3 finalColor = baseTex * crackMask + crackColor;
120 finalColor += metalSheen * crackMask;
123 float center = exp(-r * (5.0 -
amp_smooth * 3.0));
124 finalColor += vec3(1.0, 0.95, 0.9) * center * (1.5 +
amp_peak * 2.0);
126 color = vec4(finalColor, 1.0);