Magma Crust
của MusicBar, thanh tiến trình
Vỏ đá bazan gồ ghề nằm trên taskbar, dung nham đỏ cam nứt toác theo bài hát, tàn lửa bay lên màn hình nền như núi lửa sắp phun.
Cần MusicBar 2.0 trở lên: skin này dùng thứ bản cũ chưa có (vẽ tràn lên trên taskbar, hình động đi kèm). Bản cũ hơn không thấy nó trong kho, cập nhật app là có.
Cách cài, mã SHA-256 và mã nguồn
Bấm Áp dụng: MusicBar tự tải về, kiểm tra mã SHA-256 rồi mặc lên taskbar; có rồi thì mặc luôn. Cần MusicBar 1.8 trở lên.
SHA-256 8586151249d70c98f751e0a225673c6592b68f6dcc0280c79b115f3abb646868
//! name: Magma Crust
//! author: MusicBar
//! kind: progress
//! headroom: 140
//! description: Lớp vỏ đá bazan gồ ghề nằm trên taskbar, dung nham đỏ cam nứt toác theo bài hát, tàn lửa và giọt dung nham bay lên màn hình nền
// A crust of black basalt lies along the taskbar, its rugged top rising over the taskbar's edge. Behind the play
// head the slabs have cracked open: lava glows in every seam and in a web of finer fractures, lighting the rock's
// bevelled edges orange; ahead the stone is cold, grey-rimmed. The head is a molten bead pushing forward. Embers
// drift up onto the desktop, droplets spit on the beat, and now and then the crust erupts.
// Each slab is lit as relief: a rounded bevel toward its seam, its own tilt, and grain from value noise with
// derivatives. 140 DIPs of headroom; while hidden (headroom() is 0) the crust keeps inside the bar.
// Hash and noise follow docs/skin-art/toolbox.hlsl (Hash without Sine, Dave Hoskins, MIT); the rest is original.
float hash11(float p) { p = frac(p * 0.1031); p *= p + 33.33; p *= p + p; return frac(p); }
float hash12(float2 p) { float3 q = frac(p.xyx * 0.1031); q += dot(q, q.yzx + 33.33); return frac((q.x + q.y) * q.z); }
float2 hash22(float2 p) { float3 q = frac(p.xyx * float3(0.1031, 0.1030, 0.0973)); q += dot(q, q.yzx + 33.33); return frac((q.xx + q.yz) * q.zy); }
float vnoise(float2 p)
{
float2 i = floor(p), f = frac(p);
float2 u = f * f * (3.0 - 2.0 * f);
float a = hash12(i), b = hash12(i + float2(1.0, 0.0)), c = hash12(i + float2(0.0, 1.0)), d = hash12(i + 1.0);
return lerp(lerp(a, b, u.x), lerp(c, d, u.x), u.y);
}
// Value noise with its gradient: x the value, yz d/dp.
float3 vnoiseD(float2 p)
{
float2 i = floor(p), f = frac(p);
float2 u = f * f * (3.0 - 2.0 * f);
float2 du = 6.0 * f * (1.0 - f);
float a = hash12(i), b = hash12(i + float2(1.0, 0.0)), c = hash12(i + float2(0.0, 1.0)), d = hash12(i + 1.0);
float k1 = b - a, k2 = c - a, k4 = a - b - c + d;
return float3(a + k1 * u.x + k2 * u.y + k4 * u.x * u.y, du * float2(k1 + k4 * u.y, k2 + k4 * u.x));
}
float fill(float d, float w) { return saturate(0.5 - d / w); }
float beatAge() { return -0.12 * log(max(beat, 1e-4)); }
float sdSegment(float2 p, float2 a, float2 b) { float2 pa = p - a, ba = b - a; float h = saturate(dot(pa, ba) / max(dot(ba, ba), 1e-8)); return length(pa - ba * h); }
// A tone map that keeps the hue: orange lava stays orange; only the hottest light goes to white.
float3 toneHue(float3 c)
{
float m = max(max(c.r, c.g), max(c.b, 1e-4));
float mt = 1.0 - exp(-1.15 * m);
float3 o = c * (mt / m);
return lerp(o, float3(mt, mt, mt), saturate((m - 1.8) / 2.6) * 0.8);
}
// Lava by temperature k: 0 a dark crimson, 0.4 red-orange, 0.7 orange, 0.9 yellow, 1 white-yellow.
float3 lavaRamp(float k)
{
k = saturate(k);
float3 c0 = float3(0.40, 0.04, 0.02);
float3 c1 = float3(0.97, 0.22, 0.03);
float3 c2 = float3(1.00, 0.48, 0.07);
float3 c3 = float3(1.00, 0.76, 0.26);
float3 c4 = float3(1.00, 0.95, 0.72);
return k < 0.4 ? lerp(c0, c1, k / 0.4) : (k < 0.7 ? lerp(c1, c2, (k - 0.4) / 0.3) : (k < 0.9 ? lerp(c2, c3, (k - 0.7) / 0.2) : lerp(c3, c4, (k - 0.9) / 0.1)));
}
// Cells (the slabs): x the distance to the nearest border, in cell units; y the cell's id; zw the unit direction
// from the border into the cell. The border distance is measured to the bisector of the nearest two points.
float4 cells(float2 p, float jitter)
{
float2 n = floor(p), f = frac(p);
float2 mg = float2(0.0, 0.0), mr = float2(0.0, 0.0);
float md = 8.0;
for (int j = -1; j <= 1; j++)
for (int i = -1; i <= 1; i++)
{
float2 g = float2(i, j);
float2 o = 0.5 + (hash22(n + g) - 0.5) * jitter;
float2 r = g + o - f;
float d = dot(r, r);
if (d < md) { md = d; mr = r; mg = g; }
}
float ed = 8.0;
float2 en = float2(0.0, 1.0);
for (int jj = -2; jj <= 2; jj++)
for (int ii = -2; ii <= 2; ii++)
{
float2 g = mg + float2(ii, jj);
float2 o = 0.5 + (hash22(n + g) - 0.5) * jitter;
float2 r = g + o - f;
float2 dd = r - mr;
if (dot(dd, dd) > 1e-5)
{
float2 nn = normalize(dd);
float e = dot(0.5 * (mr + r), nn);
if (e < ed) { ed = e; en = nn; }
}
}
return float4(ed, hash12(n + mg), -en);
}
float4 main(float2 uv : TEXCOORD) : COLOR
{
float W = size.x, H = size.y;
float room = headroom(); // on screen above the taskbar now (0: hidden)
bool up = room > 1.0;
float x = uv.x * W, y = rise(uv) * H; // px; y > H in the headroom
float s = H / 48.0;
float t = time;
float on = playing;
float age = beatAge();
float lv = lerp(0.30, 0.35 + 0.65 * level, on);
float kickB = exp(-age * 5.0) * on;
// ------------------------------------------------------------------ the crust's outline (px)
float xL = 5.0 * s, xR = W - 5.0 * s;
float hx = lerp(xL + 0.35 * H, xR - 0.35 * H, saturate(progress));
float dx = hx - x; // > 0: behind the head, molten
float n1 = vnoise(float2(x / (0.80 * H), 1.7));
float n2 = vnoise(float2(x / (0.27 * H), 4.2));
float yTop = up ? H * (0.94 + 0.66 * n1 * n1 + 0.16 * n2) : H * (0.86 + 0.06 * n2 - 0.05 * n1);
float yBot = H * (0.05 + 0.04 * n2);
float dTop = yTop - y, dBot = y - yBot, dEnd = min(x - xL, xR - x);
float dOut = min(min(dTop, dBot), dEnd); // > 0 inside the crust
float inCrust = fill(-dOut, 1.0);
// ------------------------------------------------------------------ music, read once
float span = max(hx - xL, 1.0);
float spX = spectrum(lerp(0.04, 0.72, saturate(dx / span)));
float spHead = spectrum(0.06);
// the molten front: ragged, a little ahead along the seams
float jag = (vnoise(float2(y / (3.5 * s), 7.0 + floor(t * 3.0) * 0.0)) - 0.5) * 16.0 * s;
float molten = smoothstep(-5.0 * s, 5.0 * s, dx + jag);
float since = max(dx, 0.0);
float fresh = exp(-since / (110.0 * s)); // the newest lava is the hottest
// a beat sends a pulse of fresh lava back through the cracks
float xp = hx - age * 520.0 * s;
float pulse = exp(-abs(x - xp) / (34.0 * s)) * exp(-age * 2.2) * on;
float glowK = lerp(0.45, 1.0, on) * (0.70 + 0.45 * lv) * (0.80 + 0.55 * spX) + 0.9 * pulse;
float3 Lc = float3(0.0, 0.0, 0.0); // light on and in the crust (HDR)
float3 La = float3(0.0, 0.0, 0.0); // light in the air
float3 rock = float3(0.0, 0.0, 0.0);
if (dOut > -2.0)
{
// slabs: two rows in the bar, a third broken row in the rugged top; their borders wander a little
float2 cs = float2(1.25 * H, 0.54 * H);
float2 p1 = float2(x / cs.x, (y - yBot) / cs.y + 0.35);
p1 += (float2(vnoise(p1 * 2.3 + 3.1), vnoise(p1 * 2.3 + 8.7)) - 0.5) * 0.24;
float4 c1 = cells(p1, 0.92);
float2 inPx = c1.zw / cs;
float ed1 = c1.x / max(length(inPx), 1e-4);
inPx = normalize(inPx);
// the outline counts as a border too, so the crust's top and ends are rounded
float2 inOut = dTop < dBot ? float2(0.0, -1.0) : float2(0.0, 1.0);
inOut = dEnd < min(dTop, dBot) ? float2(x < 0.5 * W ? 1.0 : -1.0, 0.0) : inOut;
float useOut = step(dOut, ed1);
float e = min(ed1, dOut);
float2 inDir = lerp(inPx, inOut, useOut);
// seams run wide and narrow along their length
float wv = 0.50 + 1.00 * vnoise(float2(x, y) / (0.30 * H) + 4.0);
float seamW = (0.7 + 0.042 * H) * wv * (1.0 + 0.35 * molten * lv);
// fine fractures: the heat breaks each slab into pieces behind the head; crooked lines
float2 cs2 = float2(0.50 * H, 0.30 * H);
float2 p2 = float2(x / cs2.x + 17.3, (y - yBot) / cs2.y + 3.1);
p2 += (float2(vnoise(p2 * 1.9), vnoise(p2 * 1.9 + 5.5)) - 0.5) * 0.42;
float4 c2 = cells(p2, 0.95);
float2 in2 = c2.zw / cs2;
float ed2 = c2.x / max(length(in2), 1e-4);
in2 = normalize(in2);
float fracOn = molten * step(0.38, hash11(c2.y * 13.7 + 0.3) + 0.30 * fresh) * step(0.5 * seamW + 0.8, e);
float fw = (0.55 + 0.026 * H) * (0.6 + 0.8 * vnoise(float2(x, y) / (0.2 * H) + 9.0));
// a pillow: flat on top, a rounded rim falling to the nearest gap (a seam, or a fracture once it has opened)
float dS = e - 0.5 * seamW;
float dF = fracOn > 0.5 ? ed2 - 0.5 * fw : 1e4;
float useF = step(dF, dS);
float pd = min(dS, dF);
inDir = lerp(inDir, in2, useF);
float bev = lerp(0.075 * H + 1.0, 0.06 * H + 0.8, useF);
float relief = lerp(0.07 * H + 0.5, 0.05 * H + 0.4, useF);
float eb = saturate(pd / bev);
float slope = 2.0 * (1.0 - eb) / bev * relief;
float2 grad = inDir * slope;
float hgt = 1.0 - (1.0 - eb) * (1.0 - eb);
// grain and a slight tilt of its own for each slab
float2 gq = float2(x, y) / (0.16 * H);
float3 nz = vnoiseD(gq) * 0.6 + vnoiseD(gq * 2.17 + 5.3) * 0.3 + vnoiseD(gq * 4.31 + 1.7) * 0.15;
grad += nz.yz / (0.16 * H) * (0.030 * H) * (0.4 + 0.6 * eb);
float2 tilt = (hash22(float2(c1.y * 31.0, 2.0)) - 0.5) * float2(0.30, 0.22);
float3 nrm = normalize(float3(-grad + tilt, 1.0));
// basalt: charcoal, each slab its own shade, mottled; heated slabs a warm dark brown
float shade = 0.80 + 0.40 * hash11(c1.y * 7.1);
float mott = 0.80 + 0.40 * vnoise(float2(x, y) / (1.8 * s + 0.6)) * (0.7 + 0.3 * nz.x);
float3 alb = float3(0.100, 0.100, 0.112) * shade * mott;
alb = lerp(alb, float3(0.118, 0.098, 0.096) * shade * mott, molten);
float3 Ls = normalize(float3(-0.40, 0.72, 0.56));
float dif = saturate(dot(nrm, Ls));
float3 hv = normalize(Ls + float3(0.0, 0.0, 1.0));
float spec = pow(saturate(dot(nrm, hv)), 28.0);
float sky = 0.55 + 0.45 * nrm.y;
rock = alb * (0.30 * sky + 1.30 * dif) + float3(0.55, 0.57, 0.62) * spec * 0.14 * (1.0 - 0.6 * molten);
// the rims facing the sky catch it in a thin grey line, the ones facing away fall into shadow
float facing = dot(inDir, float2(0.35, -0.94)); // > 0: the rim on the slab's upper side
float rimBand = fill(abs(pd - 0.9) - 0.55, 1.0);
rock += float3(0.30, 0.31, 0.35) * rimBand * saturate(facing) * (1.0 - 0.45 * molten) * 0.85;
rock *= 1.0 - 0.45 * (1.0 - eb) * saturate(-facing);
rock *= lerp(0.80, 1.0, smoothstep(0.0, 0.15, uv.x) * (1.0 - smoothstep(0.85, 1.0, uv.x)));
// ---- lava in the seams and fractures
float flow = vnoise(float2(x / (13.0 * s) - t * 1.3, y / (5.0 * s) + t * 0.35));
float flow2 = vnoise(float2(x / (31.0 * s) + t * 0.6, y / (11.0 * s)));
// the lava fills the middle of the gap; a dark lip of cooled rock edges it where there is room
float lavaHalf = max(0.5 * seamW - 0.55 - 0.012 * H, 0.32 * seamW);
float seam = (1.0 - smoothstep(lavaHalf - 0.5, lavaHalf + 0.5, ed1)) * step(ed1, dOut + 0.5 * seamW);
float cc = saturate(1.0 - ed1 / max(lavaHalf, 0.5));
float kSeam = 0.36 + 0.28 * cc * saturate(wv) + 0.16 * fresh + 0.14 * (flow - 0.5) + 0.15 * pulse;
float iSeam = (0.85 + 0.55 * cc) * (0.70 + 0.55 * flow2) * glowK;
float crkHalf = max(0.5 * fw - 0.3 - 0.008 * H, 0.35 * fw);
float crk = (1.0 - smoothstep(crkHalf - 0.4, crkHalf + 0.4, ed2)) * fracOn;
float kCrk = 0.35 + 0.26 * saturate(1.0 - ed2 / max(crkHalf, 0.4)) + 0.16 * fresh + 0.12 * (flow - 0.5) + 0.12 * pulse;
// lava creeping a slab ahead of the front, faint
float ahead = exp(-max(-dx, 0.0) / (26.0 * s)) * (1.0 - molten);
float3 lavaSeam = lavaRamp(kSeam) * iSeam * seam * molten + lavaRamp(0.30 + 0.25 * cc) * seam * ahead * 0.8 * glowK;
float3 lavaCrk = lavaRamp(kCrk) * (0.90 + 0.55 * flow) * crk * glowK;
// the rock lit by the lava next to it: a soft spill, stronger on the rims facing the seam
float face1 = saturate(dot(nrm.xy, -inPx) * 1.6 + 0.35);
float lit1 = exp(-max(ed1 - 0.5 * seamW, 0.0) / (0.055 * H + 0.5)) * (0.35 + 0.65 * face1) * (molten + ahead * 0.5);
float face2 = saturate(dot(nrm.xy, -in2) * 1.6 + 0.35);
float lit2 = exp(-max(ed2 - 0.5 * fw, 0.0) / (0.045 * H + 0.4)) * (0.35 + 0.65 * face2) * fracOn;
float3 lavaLit = lavaRamp(0.40 + 0.12 * fresh) * (lit1 * lit1 * 0.75 + lit2 * lit2 * 0.50) * glowK;
// heat inside the pieces: a dull red under-glow, mostly near the seams; and the lava's light bounced on the tops
lavaLit += float3(0.30, 0.04, 0.01) * molten * (1.0 - hgt * 0.8) * (0.4 + 0.6 * fresh) * glowK * 0.25;
lavaLit += lavaRamp(0.40) * molten * (0.5 + 0.5 * nrm.y) * 0.075 * glowK;
// here and there a piece has sunk: a pool of lava with a dark skin cooling on it
float pool = molten * step(hash11(c2.y * 5.9 + 1.3), 0.03 * fresh) * step(0.5 * seamW + 0.8, e) * (1.0 - crk) * step(40.0, H);
// ropes of cooling skin drifting on it (a ridged noise, stretched along the flow)
float rs = max(s, 0.9);
float rope = 1.0 - abs(2.0 * vnoise(float2(x / (8.0 * rs) - t * 0.5 + 1.5 * vnoise(float2(x, y) / (12.0 * rs)), y / (2.6 * rs))) - 1.0);
float skin = smoothstep(0.80, 0.95, rope) * 0.7 + 0.25 * smoothstep(0.55, 0.8, vnoise(float2(x / (16.0 * rs) - t * 0.3, y / (5.0 * rs))));
float3 poolL = lavaRamp(0.44 + 0.22 * (1.0 - skin) * (0.5 + 0.5 * fresh) + 0.1 * pulse) * (1.0 + 0.4 * flow2) * (1.0 - 0.80 * skin) * glowK;
// dark spatter cooled on the rock round the head
float sp = step(0.86, hash12(floor(float2(x, y) / max(1.3 * s, 1.0)))) * exp(-abs(dx) / (0.6 * H));
rock *= 1.0 - 0.6 * sp;
// cold seams are dark crevices
float coldSeam = (1.0 - smoothstep(0.5 * seamW - 0.5, 0.5 * seamW + 0.8, ed1)) * step(ed1, dOut + 0.5 * seamW);
rock = lerp(rock, float3(0.018, 0.016, 0.018), coldSeam * 0.92);
rock = lerp(rock, rock * 0.55, crk);
rock = lerp(rock, float3(0.05, 0.025, 0.02) * (0.6 + 0.8 * skin), pool);
Lc += lavaSeam + lavaCrk + lavaLit * (1.0 - pool) + poolL * pool;
}
// ------------------------------------------------------------------ the molten bead at the head
float yo = 0.50 * H;
float2 qo = float2(x - hx, y - yo);
float ro = 0.19 * H * (1.0 + 0.12 * kickB + 0.10 * spHead * on);
float rq = length(qo);
float bead = fill(rq - ro, 1.0);
float swirl = vnoise(float2(atan2(qo.y, qo.x) * 1.4 + t * 1.6, rq / (2.5 * s) - t * 2.0));
// a molten sphere: hottest a little up and left of its centre, deep orange at its limb, a wet highlight
float2 qh = qo / max(ro, 0.5) - float2(-0.22, 0.26);
float limb = saturate(rq / max(ro, 0.5));
float kb = 0.60 + 0.38 * saturate(1.0 - dot(qh, qh) * 0.8) - 0.18 * limb * limb + 0.10 * (swirl - 0.5) + 0.10 * kickB;
float3 beadL = lavaRamp(kb) * (1.5 + 0.9 * kickB) * bead * lerp(0.55, 1.0, on);
beadL += float3(1.0, 0.97, 0.9) * exp(-dot(qh - float2(-0.05, 0.08), qh - float2(-0.05, 0.08)) * 18.0) * 1.2 * bead;
beadL += lavaRamp(0.62) * exp(-max(rq - ro, 0.0) / (0.22 * H)) * 0.95 * (1.0 - bead) * lerp(0.45, 1.0, on) * (1.0 + 0.6 * kickB);
beadL += lavaRamp(0.5) * exp(-max(rq - ro, 0.0) / (0.75 * H)) * 0.25 * lerp(0.4, 1.0, on);
Lc += beadL;
La += beadL;
// ------------------------------------------------------------------ in the air: heat glow, embers, droplets, eruptions
float above = y - yTop;
// the air over the molten crust glows
La += lavaRamp(0.45) * exp(-max(above, 0.0) / (14.0 * s)) * 0.32 * molten * (0.5 + 0.5 * fresh) * glowK * step(0.0, above);
if (above > -0.25 * H)
{
float topRoom = up ? room : 0.6 * H;
for (int e = 0; e < 3; e++)
{
float fe = e;
float cell = (8.0 + 5.0 * fe) * s;
float spd = (26.0 + 16.0 * fe) * s;
float2 gp = float2(x + 5.0 * s * sin(y / (17.0 * s) + t * (0.8 + 0.3 * fe) + fe * 2.0), y - t * spd) / cell;
float2 gi = floor(gp);
float2 rr = hash22(gi + fe * 17.0);
float2 dd = (frac(gp) - 0.5 - (rr - 0.5) * 0.7) * cell;
float ex = (gi.x + 0.5) * cell;
float behind = smoothstep(-6.0 * s, 10.0 * s, hx - ex);
float near = 0.08 + 0.92 * exp(-max(hx - ex, 0.0) / (140.0 * s));
float live = step(hash12(gi + 5.0 + fe * 11.0), (0.04 + 0.16 * lv * on + 0.03) * behind * near * (0.6 + 0.8 * spX));
float life = saturate(1.0 - max(above, 0.0) / (topRoom * (0.40 + 0.60 * rr.x)));
float flick = 0.60 + 0.40 * sin(t * (9.0 + 8.0 * rr.y) + rr.x * 6.28);
float sz = (0.75 + 0.45 * (2.0 - fe) / 2.0) * max(s, 0.8);
float dq = dot(dd, dd);
La += lavaRamp(0.60 + 0.35 * rr.y * life) * (exp(-dq / (sz * sz)) * 2.2 + exp(-sqrt(dq) / (2.5 * sz)) * 0.25) * live * life * flick * (1.3 - 0.25 * fe);
}
// droplets spat from the bead on the beat, and an eruption every 43 s
float2 o = float2(hx, yo + 0.5 * ro);
float sv = up ? max(s, 0.75) : 0.25 * s;
float g = 520.0 * sv;
float bid = floor((t - age) * 3.0);
float ep = frac(t / 43.0) * 43.0;
float erupt = step(ep, 2.2);
for (int b = 0; b < 16; b++)
{
float fb = b;
float2 rnd = hash22(float2(fb * 1.7 + 0.3, bid));
float2 rne = hash22(float2(fb * 2.3 + 0.7, floor(t / 43.0)));
// beat droplets
float a = age;
float th = 1.5708 + (rnd.x - 0.5) * 1.9;
float2 v = float2(cos(th), sin(th)) * (80.0 + 230.0 * rnd.y) * sv;
float2 p1 = o + v * a - float2(0.0, 0.5 * g * a * a);
float2 p0 = o + v * max(a - 0.035, 0.0) - float2(0.0, 0.5 * g * max(a - 0.035, 0.0) * max(a - 0.035, 0.0));
float d = sdSegment(float2(x, y), p0, p1);
float dh = length(float2(x, y) - p1);
float k = saturate(1.0 - a / 1.0);
float w = (0.9 + 0.8 * rnd.x) * max(s, 0.8);
float drop = exp(-(d * d) / (w * w)) * (0.35 + 0.65 * exp(-dh / (3.0 * w))) + exp(-dh / (2.5 * w)) * 0.3;
La += lavaRamp(0.50 + 0.45 * k) * drop * k * on * 2.6 * step(0.25, rnd.y + 0.5 * level) * step(yo, p1.y + ro);
// eruption: blobs thrown off the top of the jet, staggered
float ae = ep - 0.15 - rne.x * 1.1;
float the = 1.5708 + (rne.y - 0.5) * 1.1;
float2 ve = float2(cos(the), sin(the)) * (150.0 + 150.0 * hash11(fb * 5.3 + floor(t / 43.0))) * sv;
float2 e1 = o + ve * ae - float2(0.0, 0.5 * g * ae * ae);
float2 e0 = o + ve * max(ae - 0.018, 0.0) - float2(0.0, 0.5 * g * max(ae - 0.018, 0.0) * max(ae - 0.018, 0.0));
float de = sdSegment(float2(x, y), e0, e1);
float we = (1.1 + 0.9 * rne.x) * max(s, 0.8);
float ke = saturate(1.0 - ae / 1.4);
La += lavaRamp(0.55 + 0.40 * ke) * (exp(-(de * de) / (we * we)) * 2.6 + exp(-de / (3.0 * we)) * 0.35) * ke * erupt * step(0.0, ae) * step(yo, e1.y);
}
// the jet itself: a column of lava shooting up from the bead and falling back, breaking up at its top
float jetH = (up ? 95.0 * max(s, 0.75) : 0.45 * H) * sin(3.14159 * saturate(ep / 1.7)) * erupt;
float hj = y - yo;
float rel = saturate(hj / max(jetH, 1.0));
float jw = (3.2 + 2.6 * (1.0 - rel)) * max(s, 0.8) * (0.75 + 0.5 * vnoise(float2(hj / (5.0 * s) - t * 9.0, 3.0)));
float jx = x - hx - 2.0 * s * sin(hj / (14.0 * s) - t * 7.0) * rel;
float breakup = 1.0 - smoothstep(0.35, 0.55, vnoise(float2(jx / (2.0 * s), hj / (4.0 * s) - t * 14.0)) * rel * 1.4);
float jet = fill(abs(jx) - jw, 1.0) * step(0.0, hj) * (1.0 - smoothstep(jetH * 0.85, jetH, hj)) * lerp(1.0, breakup, rel);
float jcore = saturate(1.0 - abs(jx) / max(jw, 0.5));
La += lavaRamp(0.58 + 0.30 * jcore - 0.20 * rel) * jet * (1.6 + 1.2 * jcore) + lavaRamp(0.55) * exp(-max(abs(jx) - jw, 0.0) / (6.0 * s)) * step(0.0, hj) * (1.0 - rel) * 0.6 * step(1.0, jetH);
La += lavaRamp(0.7) * exp(-length(qo) / (0.9 * H)) * exp(-ep * 1.5) * erupt * 0.8;
}
// ------------------------------------------------------------------ put together
float3 crustRGB = rock * (1.0 - bead) + toneHue(Lc);
float3 airD = toneHue(La);
float3 rgb = lerp(airD, crustRGB + airD * 0.5, inCrust);
float alpha = max(inCrust, max(airD.r, max(airD.g, airD.b)));
// a soft dark edge round the crust so it sits on a light wallpaper too
float shadowA = exp(-max(-dOut, 0.0) / (2.5 * s)) * 0.45 * (1.0 - inCrust) * step(yBot, y);
alpha = max(alpha, shadowA);
rgb += (hash12(uv * size + frac(t * 7.13) * 91.7) - 0.5) * 0.010;
float a = saturate(max(alpha, max(rgb.r, max(rgb.g, rgb.b))));
return paint(saturate(rgb) / max(a, 1e-3), a);
}