High Noon
by MusicBar, progress bar
A tumbleweed rolls and bounces across a desert at dusk to the playhead, past saguaros and mesas wavering in the heat, trailing golden dust and hopping higher on every beat.
How it installs, its SHA-256 and its code
Click Apply: MusicBar downloads it, checks its SHA-256 and puts it on the taskbar, or just puts it on if it already has it. Needs MusicBar 1.8 or newer.
SHA-256 9b350261c356f34c3327cf16f4d9bd7c5cb9ac096fa1bcfcebc6d38604103f1b
//! name: High Noon
//! author: MusicBar
//! kind: progress
//! description: A tumbleweed rolls and bounces across a desert at dusk to the playhead, past saguaros and mesas wavering in the heat, kicking up a dust trail and hopping higher on every beat toward a big low sun.
float hash1(float n) { return frac(sin(n * 127.1 + 311.7) * 43758.5453); }
// Smooth value noise, for dust and the lie of the land.
float vnoise(float2 p)
{
float2 i = floor(p), f = frac(p);
f = f * f * (3.0 - 2.0 * f);
float n = i.x + i.y * 57.0;
return lerp(lerp(hash1(n), hash1(n + 1.0), f.x), lerp(hash1(n + 57.0), hash1(n + 58.0), f.x), f.y);
}
float2 rot(float2 p, float a) { float c = cos(a), s = sin(a); return float2(c * p.x - s * p.y, s * p.x + c * p.y); }
float sdSeg(float2 p, float2 a, float2 b) { float2 pa = p - a, ba = b - a; return length(pa - ba * saturate(dot(pa, ba) / dot(ba, ba))); }
// A saguaro of height h in pixels, trunk width w: a trunk and an elbowed arm on each side (the left one only sometimes).
float saguaro(float2 p, float h, float w, float a1, float a2, float left)
{
float r = 2.4 * w;
float d = sdSeg(p, float2(0.0, 0.0), float2(0.0, h)) - w;
d = min(d, min(sdSeg(p, float2(0.0, a1), float2(r, a1)), sdSeg(p, float2(r, a1), float2(r, a1 + 3.6 * w))) - w * 0.8);
return min(d, min(sdSeg(p, float2(0.0, a2), float2(-r, a2)), sdSeg(p, float2(-r, a2), float2(-r, a2 + 2.8 * w))) - w * 0.75 + 99.0 * (1.0 - left));
}
// Lays a color over what is there (premultiplied light, and how much of the pixel it covers).
void layer(inout float3 acc, inout float cover, float3 rgb, float a) { a = saturate(a); acc = rgb * a + acc * (1.0 - a); cover = a + cover * (1.0 - a); }
float4 main(float2 uv : TEXCOORD) : COLOR
{
float u = size.y;
float2 px = float2(uv.x * size.x, (1.0 - uv.y) * u); // pixels, y up the screen so the desert never hangs upside down
float head = progress * size.x;
float3 acc = float3(0, 0, 0);
float cover = 0;
float played = smoothstep(head + 0.3 * u, head - 0.8 * u, px.x); // where the tumbleweed has been
float vis = lerp(0.55, 1.0, played); // the desert ahead still lies in shadow
float3 gold = lerp(colorC.rgb, colorA.rgb, 0.35);
// Heat shimmer bends everything near the ground, more when the song is loud.
float2 sp = px + float2(sin(px.y / u * 38.0 + time * 9.0 + px.x / u * 3.0) * (0.012 + 0.015 * level) * u * exp(-px.y / (0.45 * u)), 0.0);
// The dusk glow along the horizon, warmest where the tumbleweed has passed.
layer(acc, cover, lerp(colorA.rgb, colorB.rgb, saturate(px.y / u)), exp(-px.y / (0.45 * u)) * lerp(0.1, 0.28, played));
// The big low sun at the far end, half sunk, its lower half sliced into ribbons by the mirage.
float2 sc = float2(size.x - 1.1 * u, 0.24 * u);
float sd = length(sp - sc) - 0.5 * u * (1.0 + 0.04 * beat);
float gap = 0.45 * saturate((sc.y + 0.04 * u - sp.y) / (0.3 * u));
float cut = step(frac(sp.y / (0.07 * u) - time * 0.7), gap);
layer(acc, cover, lerp(colorA.rgb, colorC.rgb, 0.3), exp(-max(sd, 0.0) / (0.45 * u)) * (0.4 + 0.15 * level));
layer(acc, cover, lerp(colorA.rgb, lerp(colorC.rgb, float3(1, 1, 1), 0.35), saturate((sp.y - sc.y) / (0.5 * u) + 0.6)), smoothstep(0.5, -0.5, sd) * (1.0 - cut));
// Mesas on the horizon: a sheer flat-topped cliff over a sloping skirt, hazy purple.
float mw = 3.4 * u, mk = floor(sp.x / mw);
float mx = abs(sp.x - (mk + 0.5) * mw) / u, mtop = 0.22 + 0.26 * hash1(mk * 3.7), hw = 0.35 + 0.55 * hash1(mk * 1.3);
float mh = max(mtop * saturate((hw - mx) / 0.05 + 1.0), mtop * (0.45 + 0.15 * step(mx, hw + 0.2)) * saturate((hw + 0.5 - mx) / 0.5));
float dM = sp.y - mh * u;
float mesa = smoothstep(fwidth(dM) * 0.7, -fwidth(dM) * 0.7, dM);
float strata = 0.85 + 0.15 * sin(sp.y / u * 60.0); // banded rock in the cliff face
float3 mc = lerp(colorB.rgb * 0.45 * strata + 0.04, lerp(colorB.rgb, colorA.rgb, 0.6) * 0.85, smoothstep(-0.04 * u, 0.0, dM) * step(mx, hw + 0.02));
layer(acc, cover, mc * vis, mesa * lerp(0.35, 0.65, played));
// Saguaros, black against the dusk with a warm rim on the side facing the sun; ribs down the trunk.
float cw = 2.3 * u, ck = floor(px.x / cw), ch = hash1(ck * 5.1);
float2 cp = px - float2((ck + 0.3 + 0.4 * hash1(ck * 2.9)) * cw, 0.0);
float cH = u * (0.5 + 0.38 * ch), cW = 0.05 * u;
float a1 = cH * (0.32 + 0.2 * hash1(ck * 7.3)), a2 = cH * (0.42 + 0.2 * hash1(ck * 8.1)), left = step(0.4, ch);
float dC = saguaro(cp, cH, cW, a1, a2, left);
float rim = saturate((saguaro(cp + float2(0.03 * u, 0.0), cH, cW, a1, a2, left) - dC) / (0.03 * u)) * smoothstep(-0.035 * u, 0.0, dC);
float3 cactus = float3(0.07, 0.045, 0.07) * (0.85 + 0.15 * cos(cp.x / cW * 7.0)) + gold * rim * lerp(0.35, 0.9, played);
layer(acc, cover, cactus, smoothstep(0.5, -0.5, dC) * step(0.3, hash1(ck * 4.4)) * lerp(0.6, 0.95, played));
// The ground: a low ridge of sand, its crest catching the last light.
float gy = u * (0.09 + 0.025 * sin(px.x / u * 1.3) + 0.02 * vnoise(float2(px.x / u * 4.0, 0.0)));
float dG = px.y - gy;
float3 sand = lerp(float3(0.32, 0.18, 0.14), gold * 0.85, smoothstep(-0.07 * u, 0.0, dG));
layer(acc, cover, sand * vis, smoothstep(0.5, -0.5, dG) * lerp(0.55, 0.9, played));
// The dust trail: thick and tall right behind the tumbleweed, thinning to a golden haze over the road behind.
float back = (head - px.x) / u;
float dn = vnoise(float2(px.x / u * 2.5 + time * 0.8, px.y / u * 3.0 - time * 0.4)) * 0.6 + vnoise(float2(px.x / u * 6.0 + time * 1.6, px.y / u * 7.0)) * 0.4;
float trail = smoothstep(0.1, 0.6, back) * exp(-max(back, 0.0) / 3.5);
float dust = trail * smoothstep((0.2 + 0.45 * exp(-max(back, 0.0) / 1.5)) * u, 0.0, px.y) * smoothstep(0.3, 0.75, dn);
layer(acc, cover, lerp(gold, float3(1.0, 0.9, 0.75), 0.35) * (0.75 + 0.35 * dn), dust * (0.5 + 0.3 * level + 0.3 * beat));
layer(acc, cover, gold, played * exp(-px.y / (0.3 * u)) * 0.14 * dn);
// The tumbleweed: it hops along (higher on the beat), squashes a little when it lands, and rolls.
float R = 0.26 * u;
float hop = abs(sin(time * 4.8));
float lift = (0.11 * hop + 0.32 * beat) * u;
float squash = 1.0 - 0.14 * smoothstep(0.3, 0.0, hop) * (1.0 - beat);
float2 c = float2(head, R * squash + gy * 0.6 + lift);
float2 off = (px - c) / R;
off.y /= squash;
float2 lp = rot(off, time * 5.5);
float r = length(off);
// Its shadow on the sand, smaller the higher it flies.
float lift01 = saturate(lift / (0.4 * u));
layer(acc, cover, float3(0.12, 0.06, 0.05), smoothstep(1.0, 0.3, length((px - float2(head + 0.1 * u, gy)) / (R * float2(1.1, 0.25) * (1.0 - 0.4 * lift01)))) * 0.45 * (1.0 - 0.6 * lift01));
// A loose tangle of wiry twigs: curls of circles through the ball, clipped to its lumpy outline,
// with a few broken ends poking out.
float ang = atan2(lp.y, lp.x);
float edge = 0.92 + 0.08 * sin(ang * 3.0 + 1.0) + 0.05 * sin(ang * 7.0);
float tw = abs(r - edge * 0.97), tone = 1.0;
[unroll] for (int i = 0; i < 11; i++)
{
float fi = i;
float2 wp = lp + 0.07 * sin(lp.yx * (5.0 + fi) + fi * 2.0); // each curl bent its own way
float di = abs(length(wp - (float2(hash1(fi * 3.1), hash1(fi * 7.7)) - 0.5) * 1.1) - (0.22 + 0.45 * hash1(fi * 5.3)));
tone = di < tw ? 0.55 + 0.45 * hash1(fi * 8.9) : tone; // some twigs sit deeper in the tangle
tw = min(tw, di);
}
tw = max(tw, r - edge);
float sk = floor(ang / 6.2832 * 9.0 + 4.5), sa = (sk + 0.2 + 0.6 * hash1(sk * 4.1)) / 9.0 * 6.2832 - 3.1416;
float2 sdir = float2(cos(sa), sin(sa));
float spk = max(abs(lp.x * sdir.y - lp.y * sdir.x), max(edge - 0.1 - dot(lp, sdir), dot(lp, sdir) - edge - 0.3 * hash1(sk * 9.7)));
tw = min(tw, spk + 99.0 * step(hash1(sk * 2.3), 0.35));
float twig = smoothstep(0.5, -0.5, tw * R - max(0.5, 0.015 * u));
float lightT = saturate(0.45 + 0.6 * off.x - 0.2 * off.y); // the sun is ahead and low
float3 straw = lerp(float3(0.42, 0.27, 0.14), lerp(float3(1.0, 0.84, 0.56), colorC.rgb, 0.3), lightT);
layer(acc, cover, float3(0.2, 0.12, 0.06), smoothstep(0.5, -0.5, (r - edge) * R) * 0.35);
layer(acc, cover, straw * tone * lerp(0.7, 1.05, saturate(r / edge)), twig);
return paint(acc / max(cover, 0.001), cover);
}