Neon Cruise GT
của Rinz, visualizer
Khoang lái GT tương lai lướt êm trên cao tốc ướt hướng về mặt trời hoàng hôn đập theo nhịp nhạc.
43 lượt tải
Tải file, 30.5 KB
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 e88d94da1321c9c39f1f4058011489b859258e06b767cde0f029d01db93f0e28
//! name: Neon Cruise GT
//! author: Rinz
//! kind: visualizer
//! description: Cần Direct3D 11. Khoang lái GT tương lai lướt êm trên cao tốc ướt hướng về mặt trời hoàng hôn đập theo nhịp nhạc.
#define TAU 6.283185
float2 wrapCell(float2 b)
{
return b - 512.0 * floor(b / 512.0);
}
float hash1(float p)
{
float3 p3 = frac(p * float3(5.3983, 5.4427, 6.9371));
p3 += dot(p3, p3.yzx + 19.19);
return frac((p3.x + p3.y) * p3.z);
}
float hash1(float2 p2)
{
p2 = frac(p2 * float2(5.3983, 5.4427));
p2 += dot(p2.yx, p2.xy + float2(21.5351, 14.3137));
return frac(p2.x * p2.y * 95.4337);
}
float hash1(float2 p2, float p)
{
float3 p3 = frac(float3(5.3983 * p2.x, 5.4427 * p2.y, 6.9371 * p));
p3 += dot(p3, p3.yzx + 19.19);
return frac((p3.x + p3.y) * p3.z);
}
float2 hash2(float2 p2, float p)
{
float3 p3 = frac(float3(5.3983 * p2.x, 5.4427 * p2.y, 6.9371 * p));
p3 += dot(p3, p3.yzx + 19.19);
return frac((p3.xx + p3.yz) * p3.zy);
}
float vnoise(float2 p)
{
float2 i = floor(p);
float2 f = frac(p);
float2 u = f * f * (3.0 - 2.0 * f);
return lerp(lerp(hash1(i + float2(0.0, 0.0)), hash1(i + float2(1.0, 0.0)), u.x),
lerp(hash1(i + float2(0.0, 1.0)), hash1(i + float2(1.0, 1.0)), u.x), u.y);
}
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);
}
float sdBox(float2 p, float2 b)
{
float2 d = abs(p) - b;
return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
}
float3 boxHit(float3 eye, float3 ri, float3 ray, float3 side, float3 lo, float3 hi)
{
float3 wall = lerp(hi, lo, side);
float3 t = (wall - eye) * ri;
float3 dm = step(t.zxy, t) * step(t.yzx, t);
float maxT = dot(dm, t);
float maxFace = dm.x - dm.y;
float3 p = eye + maxT * ray;
dm += step(lo, p) * step(p, hi);
float hit = step(0.5, dm.x * dm.y * dm.z) * step(0.001, maxT);
return float3(maxT, maxFace, hit);
}
float4 castRay(float3 eye, float3 ray, float maxDist, out float edgeOut, out float2 hitBlock)
{
float2 block = floor(eye.xz);
float3 safeRay = float3(
(abs(ray.x) < 1e-5) ? 1e-5 : ray.x,
(abs(ray.y) < 1e-5) ? 1e-5 : ray.y,
(abs(ray.z) < 1e-5) ? 1e-5 : ray.z
);
float3 ri = 1.0 / safeRay;
float3 rs = sign(safeRay);
float3 side = 0.5 + 0.5 * rs;
float2 ris = ri.xz * rs.xz;
float2 dis = (block - eye.xz + 0.5 + rs.xz * 0.5) * ri.xz;
float4 result = float4(100.0, 0.0, 0.0, 0.0);
edgeOut = 1.0;
hitBlock = float2(0.0, 0.0);
[loop]
for (int i = 0; i < 20; ++i)
{
float nextT = min(dis.x, dis.y);
if (nextT > maxDist)
break;
if (block.x < -2.5 || block.x > 1.5)
{
float2 hb = wrapCell(block);
float height = 1.15 + 2.35 * hash1(hb) + 0.30 * sin(hb.x * 0.7 + hb.y * 0.4);
float dist = 500.0;
float face = 0.0;
float edgeV = 1.0;
[unroll]
for (int j = 0; j < 2; ++j)
{
float top = height - 0.45 * float(j);
float2 loXZ = block + 0.30 * hash2(hb, float(j));
float2 hiXZ = block + 0.70 + 0.30 * hash2(hb, float(j) + 0.5);
float3 lo = float3(loXZ.x, -0.5, loXZ.y);
float3 hi = float3(hiXZ.x, top, hiXZ.y);
float3 h = boxHit(eye, ri, ray, side, lo, hi);
if (h.z > 0.5 && h.x < dist)
{
dist = h.x;
face = h.y;
float3 q = eye + h.x * ray;
float exd = min(q.x - lo.x, hi.x - q.x);
float eyd = min(q.y - lo.y, hi.y - q.y);
float ezd = min(q.z - lo.z, hi.z - q.z);
if (h.y > 0.5) edgeV = min(eyd, ezd);
else if (h.y < -0.5) edgeV = min(exd, ezd);
else edgeV = min(exd, eyd);
}
}
if (dist < maxDist)
{
result = float4(dist, height, face, 1.0);
edgeOut = edgeV;
hitBlock = hb;
break;
}
}
float2 stepDim = step(dis.xy, dis.yx);
dis += stepDim * ris;
block += stepDim * rs.xz;
}
return result;
}
float3 windowGlow(float y, float2 pos, float2 id, float pxDist, float tw)
{
float windowSize = 0.06 + 0.09 * hash1(id + 0.1);
float windowProb = 0.36 + 0.55 * hash1(id + 0.2);
float depth = y / windowSize;
float lv = floor(depth);
float3 warmGold = float3(1.00, 0.76, 0.34);
float3 neonCyan = float3(0.22, 0.88, 1.00);
float3 neonPink = float3(1.00, 0.24, 0.68);
float sel = hash1(id, lv + 0.7);
float3 wCol = (sel < 0.55) ? warmGold : ((sel < 0.82) ? neonCyan : neonPink);
float noise = vnoise(16.0 * pos + 80.0 * hash1(lv));
float ne = clamp(8.0 * pxDist, 0.02, 0.10);
wCol *= 0.20 + 0.90 * smoothstep(0.35 - ne, 0.35 + ne, noise);
float tt = tw * 0.15;
float te = floor(tt);
float onA = step(0.10, hash1(id, lv + 0.3 + te));
float onB = step(0.10, hash1(id, lv + 0.3 + te + 1.0));
float onOff = lerp(onA, onB, smoothstep(0.7, 1.0, tt - te));
float on = step(windowProb, hash1(id, lv + 0.1)) * onOff;
float f = depth - lv;
float wa = clamp(0.7 * pxDist / windowSize, 0.03, 0.28);
float mask = smoothstep(0.12, 0.12 + 2.0 * wa, f) * (1.0 - smoothstep(0.88 - 2.0 * wa, 0.88, f));
float colGrid = frac(pos.x * 6.5);
float colMask = smoothstep(0.16, 0.24, colGrid) * (1.0 - smoothstep(0.76, 0.84, colGrid));
float colOn = step(0.22, hash1(id, floor(pos.x * 6.5) + lv * 13.0));
float hasSign = step(0.84, hash1(id + 4.3));
float signX = 0.25 + 0.50 * hash1(id + 5.1);
float signStrip = hasSign * (1.0 - smoothstep(0.02, 0.04, abs(frac(pos.x) - signX))) * step(0.6, y) * step(y, 1.9);
float3 signCol = lerp(neonCyan, neonPink, step(0.5, hash1(id + 6.7))) * 1.15;
return wCol * on * mask * colMask * colOn * 0.95 + signCol * signStrip;
}
float3 addPointGlow(float3 eye, float3 ray, float sceneT, float3 lightPos, float3 col, float radius, float intensity)
{
float s = dot(lightPos - eye, ray);
if (s <= 0.1 || s > 24.0 || s > sceneT + 0.20)
return float3(0.0, 0.0, 0.0);
float3 dVec = (eye + s * ray) - lightPos;
float d2 = dot(dVec, dVec);
float r2 = radius * radius;
float occ = 1.0 - smoothstep(sceneT - 0.15, sceneT + 0.20, s);
float fog = saturate(1.0 - max(s - 3.5, 0.0) * 0.055);
float core = r2 / (d2 + r2 * 0.35);
float halo = 0.32 * r2 / (d2 * 0.20 + r2 * 2.4);
return col * (core + halo) * intensity * occ * fog * fog;
}
float4 main(float2 uv : TEXCOORD) : COLOR
{
float H = max(size.y, 1.0);
float2 px = float2(uv.x * size.x, rise(uv) * H);
float cx = size.x * 0.5;
float hy = H * 0.40;
float tw = time - 4096.0 * floor(time / 4096.0);
float bass = saturate(spectrum(0.03) * 0.75 + level * 0.25);
float mid = saturate(spectrum(0.28) * 0.80 + level * 0.20);
float high = saturate(spectrum(0.72) * 0.85 + level * 0.15);
float pulse = saturate(beat);
float3 themeA = colorA.rgb;
float3 themeB = colorB.rgb;
float3 themeC = colorC.rgb;
float lampPeriod = 6.0;
float3 eye = float3(0.0, 0.44, tw * 3.2);
float3 sceneCol = float3(0.0, 0.0, 0.0);
// Optimization 1: Early-out entire 3D exterior on opaque dashboard/sill & roof pixels
[branch]
if (px.y >= H * 0.125 && px.y <= H * 0.935)
{
float halfW = max(size.x * 0.5, H * 10.0);
float rx = (px.x - cx) / halfW * 1.25;
float ry = (px.y - hy) / H * 0.65;
float3 ray = normalize(float3(rx, ry, 1.0));
// 1. Background: Synthwave dusk sky, clouds, stars & pulsing sun
float skyT = saturate((px.y - hy) / max(H - hy, 1.0));
float3 skyLow = lerp(float3(0.92, 0.28, 0.50), themeB, 0.35);
float3 skyMid = lerp(float3(0.48, 0.10, 0.44), themeB * 0.65, 0.35);
float3 skyTop = float3(0.11, 0.04, 0.24);
float3 bgCol = lerp(lerp(skyLow, skyMid, smoothstep(0.0, 0.45, skyT)), skyTop, smoothstep(0.38, 1.0, skyT));
float cxq = (px.x - cx) / H;
float cloudWave = sin(cxq * 0.85 + tw * 0.08 + sin(skyT * 9.0) * 1.3) * 0.5 + 0.5;
float cloud = smoothstep(0.35, 0.85, cloudWave) * smoothstep(0.05, 0.35, skyT) * (1.0 - smoothstep(0.55, 0.95, skyT));
bgCol = lerp(bgCol, lerp(float3(0.96, 0.42, 0.58), themeB, 0.30), cloud * 0.22);
float2 sc = floor(px / 5.0);
float twinkle = 0.5 + 0.5 * sin(tw * 2.0 + hash1(sc + 1.3) * 30.0);
float star = step(0.968, hash1(sc)) * smoothstep(1.3, 0.3, length(frac(px / 5.0) * 5.0 - 2.5)) * twinkle;
bgCol += float3(1.0, 0.96, 1.0) * star * smoothstep(0.35, 0.85, skyT) * (0.45 + 0.25 * high);
float R = H * (0.48 + 0.20 * bass + 0.08 * pulse);
float2 sunAt = float2(cx, hy - R * 0.08);
float sunDist = length(px - sunAt);
float sunV = saturate((px.y - hy) / max(sunAt.y + R - hy, 1.0));
float3 sunBot = lerp(float3(1.00, 0.26, 0.18), themeC, 0.35);
float3 sunTop = lerp(float3(1.00, 0.88, 0.32), lerp(themeC, float3(1.0, 1.0, 0.8), 0.5), 0.30);
float3 sunCol = lerp(sunBot, sunTop, smoothstep(0.0, 0.92, sunV));
float halo = exp(-max(sunDist - R, 0.0) / max(R * 0.65, 1.0)) * step(hy, px.y);
float shockR = R * (1.12 + 0.32 * pulse);
float shockRing = exp(-abs(sunDist - shockR) / max(H * 0.06, 1.0)) * step(hy, px.y) * pulse;
float disc = smoothstep(R + 0.9, R - 0.9, sunDist) * step(hy, px.y);
bgCol = lerp(bgCol, lerp(float3(1.00, 0.36, 0.42), themeA, 0.30), saturate(halo * (0.34 + 0.35 * bass + 0.18 * pulse)));
bgCol += lerp(float3(1.00, 0.65, 0.40), themeC, 0.35) * shockRing * 0.42;
bgCol = lerp(bgCol, sunCol * (1.0 + 0.24 * pulse), disc * 0.96);
// 2. Distance-clipped 3D DDA Skyscrapers & Open Wet Reflective Highway
float tRoad = (ray.y < -0.0005) ? (-eye.y / ray.y) : 100.0;
float maxD = min(tRoad, 24.0);
float edgeOut = 1.0;
float2 hitBlock = float2(0.0, 0.0);
float4 bldg = castRay(eye, ray, maxD, edgeOut, hitBlock);
float tBldg = (bldg.w > 0.5) ? bldg.x : 100.0;
float sceneT = min(tBldg, tRoad);
sceneCol = bgCol;
float3 fogCol = lerp(float3(0.76, 0.22, 0.48), themeB, 0.45);
float sweepZ = frac(tw * 0.65) * 22.0 + eye.z;
if (tRoad < tBldg && tRoad < 90.0)
{
float3 hitRoad = eye + tRoad * ray;
float wX = max(0.0022 * tRoad, 0.002);
float roadNoise = vnoise(float2(hitRoad.x * 14.0, hitRoad.z * 3.0));
float wetMod = 0.70 + 0.55 * roadNoise;
float3 roadCol = float3(0.035, 0.015, 0.072);
float railLine = (1.0 - smoothstep(0.0, wX * 1.8 + 0.018, abs(abs(hitRoad.x) - 0.96))) * saturate(1.4 - wX * 2.0);
float beatWave = exp(-abs(hitRoad.z - sweepZ) * 0.55) * (0.30 + 1.15 * pulse);
float3 railCol = lerp(themeB, themeA, saturate(beatWave * 0.75)) * (0.85 + 0.50 * pulse + 1.10 * beatWave);
roadCol = lerp(roadCol, railCol, railLine * 0.95);
float dash = step(0.45, frac(hitRoad.z * 0.42));
float centerLine = (1.0 - smoothstep(0.0, wX * 1.5 + 0.012, abs(hitRoad.x))) * dash;
float laneLine = (1.0 - smoothstep(0.0, wX * 1.3 + 0.010, abs(abs(hitRoad.x) - 0.48))) * dash * 0.65;
roadCol = lerp(roadCol, float3(0.92, 0.55, 0.85), saturate(centerLine + laneLine) * 0.65);
float shimmer = (0.45 + 0.55 * step(frac((px.y + tw * 6.0) / 3.0), 0.5))
* exp(-abs(hitRoad.x) / 0.28)
* exp(-tRoad * 0.080) * wetMod;
roadCol += lerp(sunBot, sunTop, 0.55) * shimmer * (0.36 + 0.26 * bass);
float roadFog = (1.0 - exp(-0.038 * max(tRoad - 3.5, 0.0))) * 0.78;
sceneCol = lerp(roadCol, fogCol, roadFog);
}
else if (bldg.w > 0.5)
{
float3 p = eye + tBldg * ray;
float pxDist = 1.6 * tBldg / max(H * 2.0, 1.0);
float3 wallCol = (bldg.z > 0.5) ? float3(0.075, 0.028, 0.16) : float3(0.048, 0.018, 0.11);
if (bldg.z > -0.5)
{
float2 winPos = (bldg.z > 0.5) ? p.zy : p.xy;
float3 win = windowGlow(p.y + 0.5, winPos, hitBlock, pxDist, tw);
float specX = saturate((p.y + 0.2) / 3.2);
float3 specBoost = spectrum(specX);
float satBoost = 1.0 + 0.45 * length(specBoost);
float gray = dot(win, float3(0.33, 0.33, 0.33));
win = lerp(float3(gray, gray, gray), win, satBoost);
wallCol += win * (0.60 + 2.40 * specBoost);
}
float rim = 1.0 - smoothstep(0.0, max(0.025, pxDist * 1.8), edgeOut);
float bBeat = exp(-abs(p.z - sweepZ) * 0.50) * pulse * (1.0 - saturate(p.y / 1.8));
wallCol += lerp(float3(0.96, 0.28, 0.68), themeB, 0.45) * (0.35 + 0.75 * mid + 1.10 * bBeat) * rim;
float bldgFog = 1.0 - exp(-0.095 * max(tBldg - 3.5, 0.0));
sceneCol = lerp(wallCol, lerp(fogCol, float3(0.32, 0.08, 0.35), saturate(p.y / 3.0)), bldgFog);
}
// 3. Culled 3D Y-Shaped Streetlamps & Sparse Overhead Gantries
[branch]
if (abs(rx) < 0.88 && px.y > H * 0.18)
{
float baseCell = floor(eye.z / lampPeriod) + 1.0;
[unroll]
for (int k = 0; k < 3; ++k)
{
float cellId = baseCell + float(k);
float lz = cellId * lampPeriod;
float tP = (lz - eye.z) / max(ray.z, 1e-4);
if (tP > 0.25 && tP < sceneT)
{
float3 hp = eye + tP * ray;
float pxW = 1.4 * tP / max(H * 2.0, 1.0);
float3 metalCol = float3(0.035, 0.018, 0.065);
float pFog = 1.0 - exp(-0.065 * max(tP - 3.0, 0.0));
float trunk = (1.0 - smoothstep(0.0042, 0.0042 + pxW * 0.75, abs(abs(hp.x) - 1.35))) * step(0.0, hp.y) * step(hp.y, 0.85);
float armT = saturate((hp.y - 0.85) / 0.27);
float armIn = 1.0 - smoothstep(0.0038, 0.0038 + pxW * 0.75, abs(abs(hp.x) - (1.35 - 0.13 * armT)));
float armOut = 1.0 - smoothstep(0.0038, 0.0038 + pxW * 0.75, abs(abs(hp.x) - (1.35 + 0.13 * armT)));
float arms = max(armIn, armOut) * step(0.85, hp.y) * step(hp.y, 1.12);
float poleMask = max(trunk, arms);
float isGantry = step(abs(fmod(cellId, 5.0)), 0.5);
if (isGantry > 0.5)
{
float beam = (1.0 - smoothstep(0.010, 0.010 + pxW, abs(hp.y - 1.05))) * step(abs(hp.x), 1.35);
float gPost = (1.0 - smoothstep(0.012, 0.012 + pxW, abs(abs(hp.x) - 1.35))) * step(0.0, hp.y) * step(hp.y, 1.24);
float signDist = min(min(sdBox(hp.xy - float2(-0.65, 1.095), float2(0.24, 0.145)),
sdBox(hp.xy - float2( 0.00, 1.095), float2(0.24, 0.145))),
sdBox(hp.xy - float2( 0.65, 1.095), float2(0.24, 0.145)));
float signs = 1.0 - smoothstep(0.0, max(0.01, pxW), signDist);
float signRim = (1.0 - smoothstep(0.0, max(0.015, pxW * 1.5), abs(signDist))) * step(signDist, 0.01);
float gMask = max(max(beam, gPost), signs);
if (gMask > 0.01)
{
float3 gCol = lerp(metalCol + float3(0.92, 0.28, 0.62) * 0.45 * signRim, fogCol, pFog);
sceneCol = lerp(sceneCol, gCol, gMask);
}
}
else if (poleMask > 0.01)
{
sceneCol = lerp(sceneCol, lerp(metalCol, fogCol, pFog), poleMask);
}
}
sceneCol += addPointGlow(eye, ray, sceneT, float3(-1.22, 1.12, lz), float3(1.00, 0.82, 0.46), 0.020, 0.65 + 0.18 * high);
sceneCol += addPointGlow(eye, ray, sceneT, float3( 1.22, 1.12, lz), float3(1.00, 0.82, 0.46), 0.020, 0.65 + 0.18 * high);
sceneCol += addPointGlow(eye, ray, sceneT, float3(-1.48, 1.12, lz), float3(1.00, 0.82, 0.46), 0.018, 0.55 + 0.16 * high);
sceneCol += addPointGlow(eye, ray, sceneT, float3( 1.48, 1.12, lz), float3(1.00, 0.82, 0.46), 0.018, 0.55 + 0.16 * high);
}
}
}
float3 acc = sceneCol;
float cover = 1.0;
// 4. Black-Dash 2077 Cockpit (bounding-box culled sub-elements)
float3 cabinCol = float3(0.024, 0.022, 0.040);
float3 dashDark = float3(0.018, 0.018, 0.032);
float3 dashLight = float3(0.036, 0.038, 0.058);
float lampPhase = frac(eye.z / lampPeriod);
float lpDist = min(lampPhase, 1.0 - lampPhase) * 6.5;
float passProx = exp(-(lpDist * lpDist));
float topGusset = max(px.y - H * 0.78, 0.0);
float botGusset = max(H * 0.24 - px.y, 0.0);
float pillarHalfW = H * 0.11 + topGusset + botGusset;
float leftPillarX = cx - H * 4.4 + H * 0.90 * (px.y / H);
float rightPillarX = cx + H * 4.4 - H * 0.90 * (px.y / H);
float leftInnerEdge = leftPillarX + pillarHalfW;
float rightInnerEdge = rightPillarX - pillarHalfW;
float inWindshield = step(leftPillarX, px.x) * step(px.x, rightPillarX);
float inSideWindow = 1.0 - inWindshield;
// Subtle 2077 windshield HUD corner brackets near inner A-pillars
[branch]
if (inWindshield > 0.5 && px.y >= H * 0.33 && px.y <= H * 0.71)
{
float hudCap = step(H * 0.66, px.y) + step(px.y, H * 0.38);
float hudLeft = exp(-abs(px.x - (leftInnerEdge + H * 0.26)) / 0.8);
float hudRight = exp(-abs(px.x - (rightInnerEdge - H * 0.26)) / 0.8);
float hudCapL = step(leftInnerEdge + H * 0.26, px.x) * step(px.x, leftInnerEdge + H * 0.44) * hudCap;
float hudCapR = step(rightInnerEdge - H * 0.44, px.x) * step(px.x, rightInnerEdge - H * 0.26) * hudCap;
layer(acc, cover, float3(0.12, 0.88, 1.00), saturate(hudLeft + hudRight + hudCapL + hudCapR) * 0.14);
}
// Side windows: tint + steep coupe window pillar (INNER rim light only!) + door sill
[branch]
if (inSideWindow > 0.5)
{
layer(acc, cover, float3(0.032, 0.020, 0.070), 0.15);
float strutX = H * 4.22 + H * 0.50 * saturate((px.y - H * 0.16) / (H * 0.84));
float strutDist = abs(abs(px.x - cx) - strutX);
float strutHalfW = H * 0.105;
float strutMask = (1.0 - smoothstep(strutHalfW - 1.0, strutHalfW + 1.0, strutDist)) * step(H * 0.14, px.y);
float strutShade = saturate(1.0 - strutDist / max(strutHalfW, 1.0));
float strutInnerEdge = strutX - strutHalfW;
float strutInnerRim = exp(-abs(abs(px.x - cx) - strutInnerEdge) / 1.0) * step(H * 0.14, px.y);
layer(acc, cover, lerp(cabinCol, float3(0.055, 0.052, 0.085), strutShade * 0.55), strutMask);
layer(acc, cover, lerp(themeA, float3(1.00, 0.68, 0.35), passProx * 0.65), strutInnerRim * 0.45);
float doorSill = step(px.y, H * 0.135);
layer(acc, cover, cabinCol, doorSill);
float sillLed = exp(-abs(px.y - H * 0.135) / 1.0) + exp(-abs(px.y - H * 0.135) / 3.6) * 0.28;
float sideT = saturate((abs(px.x - cx) - H * 4.4) / max(size.x * 0.5 - H * 4.4, 1.0));
layer(acc, cover, lerp(themeC, themeA, sideT) * (0.75 + 0.55 * level + 0.50 * pulse), sillLed * 0.80);
}
// Exterior camera-wing side mirrors (bounding-box culled)
[branch]
if (abs(abs(px.x - cx) - H * 4.74) < H * 0.34 && px.y > H * 0.15 && px.y < H * 0.38)
{
float wingDx = abs(px.x - cx) - H * 4.45;
float camMirrorD = sdBox(float2(abs(px.x - cx) - H * 4.74, px.y - (H * 0.23 + max(wingDx, 0.0) * 0.16)), float2(H * 0.26, H * 0.042));
float camMirror = 1.0 - smoothstep(0.0, 1.0, camMirrorD);
float camMirrorRim = exp(-abs(camMirrorD) / 1.0);
float camTipLed = step(H * 4.94, abs(px.x - cx)) * camMirror;
float3 camBody = lerp(cabinCol, float3(0.075, 0.068, 0.115), saturate((px.y - H * 0.19) / (H * 0.10)));
layer(acc, cover, camBody, camMirror);
layer(acc, cover, lerp(themeA, float3(1.00, 0.72, 0.42), passProx * 0.65), camMirrorRim * 0.48);
layer(acc, cover, themeA * (0.9 + 0.4 * pulse), camTipLed * 0.88);
}
// Chamfered A-pillars
float dPillarL = abs(px.x - leftPillarX);
float dPillarR = abs(px.x - rightPillarX);
if (min(dPillarL, dPillarR) < pillarHalfW + 3.0)
{
float leftPillarMask = 1.0 - smoothstep(pillarHalfW - 1.0, pillarHalfW + 1.0, dPillarL);
float rightPillarMask = 1.0 - smoothstep(pillarHalfW - 1.0, pillarHalfW + 1.0, dPillarR);
float pillars = max(leftPillarMask, rightPillarMask);
float pShade = saturate(1.0 - min(dPillarL, dPillarR) / max(pillarHalfW, 1.0));
layer(acc, cover, lerp(cabinCol, float3(0.065, 0.058, 0.100), pShade * 0.55), pillars);
float slitL = exp(-abs(px.x - (leftInnerEdge - H * 0.045)) / 0.9) * leftPillarMask;
float slitR = exp(-abs(px.x - (rightInnerEdge + H * 0.045)) / 0.9) * rightPillarMask;
float3 slitCol = lerp(themeA, float3(1.00, 0.68, 0.35), passProx * 0.75);
layer(acc, cover, slitCol * (0.65 + 0.55 * passProx), saturate(slitL + slitR) * 0.78);
}
// Roof header & Digital Rearview Mirror (bounding-box culled)
float roofBase = lerp(H * 0.87, H * 0.89, inWindshield);
float roof = smoothstep(roofBase, roofBase + H * 0.04, px.y);
layer(acc, cover, float3(0.045, 0.048, 0.072), roof);
[branch]
if (abs(px.x - cx) < H * 0.40 && px.y > H * 0.82)
{
float stem = 1.0 - smoothstep(0.0, 0.9, sdBox(px - float2(cx, H * 0.90), float2(H * 0.035, H * 0.025)));
layer(acc, cover, float3(0.10, 0.11, 0.15), stem);
float mirrorBox = sdBox(px - float2(cx, H * 0.875), float2(H * 0.32, H * 0.030));
float mirror = 1.0 - smoothstep(0.0, 1.0, mirrorBox);
float mirrorRim = exp(-abs(mirrorBox) / 0.9);
float mirGrad = saturate((px.y - H * 0.845) / (H * 0.060));
float3 mirGlass = lerp(lerp(float3(0.16, 0.05, 0.20), themeB * 0.35, 0.45), float3(0.05, 0.04, 0.12), mirGrad);
layer(acc, cover, mirGlass, mirror);
layer(acc, cover, lerp(float3(0.65, 0.72, 0.85), themeA, 0.40), mirrorRim * 0.70);
float statusDot = exp(-length(px - float2(cx + H * 0.26, H * 0.875)) / max(H * 0.015, 0.8));
layer(acc, cover, themeA * (0.85 + 0.65 * pulse), statusDot * mirror * 0.90);
}
// Black Dashboard & Sub-Panels (bounding-box culled)
float scrLeft = cx - H * 4.05;
float scrRight = cx + H * 4.05;
float scrTop = H * 0.215;
[branch]
if (inWindshield > 0.5 && px.y < scrTop + H * 0.10)
{
float scrBox = sdBox(px - float2(cx, scrTop * 0.5), float2((scrRight - scrLeft) * 0.5, scrTop * 0.5));
float scrMask = 1.0 - smoothstep(0.0, 1.0, scrBox);
float dashShade = saturate(px.y / max(scrTop, 1.0));
layer(acc, cover, lerp(dashDark, dashLight, dashShade), scrMask);
float dashTopTrim = exp(-abs(px.y - scrTop) / 0.95) * step(scrLeft, px.x) * step(px.x, scrRight);
layer(acc, cover, lerp(float3(0.45, 0.50, 0.65), themeA, 0.40), dashTopTrim * 0.65);
// Compact Co-Pilot 3-Band Telemetry Mini-Display
float ventCx = cx + H * 2.55;
if (abs(px.x - ventCx) < H * 0.65 && px.y < H * 0.20)
{
float cpBox = sdBox(px - float2(ventCx, H * 0.095), float2(H * 0.56, H * 0.058));
float cpMask = (1.0 - smoothstep(0.0, 0.9, cpBox)) * scrMask;
float cpRim = exp(-abs(cpBox) / 0.9) * scrMask;
layer(acc, cover, float3(0.014, 0.015, 0.026), cpMask);
layer(acc, cover, lerp(float3(0.40, 0.46, 0.58), themeA, 0.45), cpRim * 0.70);
float cpLeft = ventCx - H * 0.48;
float cpU = (px.x - cpLeft) / max(H * 0.80, 1.0);
if (cpU > 0.0 && cpU < 1.0 && cpMask > 0.5)
{
float b1 = (1.0 - smoothstep(0.0, 0.8, abs(px.y - H * 0.125) - H * 0.008)) * step(cpU, 0.18 + 0.80 * bass);
float b2 = (1.0 - smoothstep(0.0, 0.8, abs(px.y - H * 0.095) - H * 0.008)) * step(cpU, 0.18 + 0.80 * mid);
float b3 = (1.0 - smoothstep(0.0, 0.8, abs(px.y - H * 0.065) - H * 0.008)) * step(cpU, 0.18 + 0.80 * high);
layer(acc, cover, themeC * (0.90 + 0.45 * pulse), b1 * 0.90);
layer(acc, cover, themeB * (0.90 + 0.35 * level), b2 * 0.90);
layer(acc, cover, themeA * (0.90 + 0.35 * high), b3 * 0.90);
}
float cpDot = exp(-length(px - float2(ventCx + H * 0.45, H * 0.095)) / max(H * 0.015, 0.8));
layer(acc, cover, themeA * (0.85 + 0.65 * pulse), cpDot * cpMask * 0.90);
}
// Digital Side-Mirror LCD Screens at Both Outer Ends of the Dashboard
if (abs(abs(px.x - cx) - H * 3.68) < H * 0.42 && px.y < H * 0.21)
{
float lcdD = sdBox(float2(abs(px.x - cx) - H * 3.68, px.y - H * 0.105), float2(H * 0.34, H * 0.072));
float lcdMask = (1.0 - smoothstep(0.0, 0.9, lcdD)) * scrMask;
float lcdRim = exp(-abs(lcdD) / 0.85) * scrMask;
float lcdGrad = saturate((px.y - H * 0.033) / (H * 0.144));
float3 lcdFeed = lerp(lerp(float3(0.18, 0.06, 0.24), themeB * 0.40, 0.45), float3(0.04, 0.03, 0.12), lcdGrad);
float lcdHoriz = exp(-abs(px.y - H * 0.095) / 1.0) * lcdMask;
layer(acc, cover, lcdFeed, lcdMask);
layer(acc, cover, lerp(themeA, float3(1.0, 0.72, 0.45), 0.45) * (0.65 + 0.40 * level), lcdHoriz * 0.75);
layer(acc, cover, lerp(float3(0.50, 0.56, 0.70), themeA, 0.45), lcdRim * 0.80);
float lcdDot = exp(-length(float2(abs(px.x - cx) - H * 3.92, px.y - H * 0.150)) / max(H * 0.014, 0.7));
layer(acc, cover, themeA * (0.85 + 0.55 * pulse), lcdDot * lcdMask * 0.90);
}
// Balanced Centered 52-Bar Dense Spectrum Screen
float visLeft = cx - H * 1.80;
float visRight = cx + H * 1.80;
float visU = (px.x - visLeft) / max(visRight - visLeft, 1.0);
if (visU > -0.05 && visU < 1.05)
{
float visBox = sdBox(px - float2(cx, scrTop * 0.48), float2((visRight - visLeft) * 0.5, scrTop * 0.48));
float visMask = (1.0 - smoothstep(0.0, 1.0, visBox)) * scrMask;
float visBezel = exp(-abs(visBox) / 1.0) * scrMask;
layer(acc, cover, float3(0.014, 0.014, 0.028), visMask);
float inVisZone = step(0.0, visU) * step(visU, 1.0);
float scrSpill = exp(-max(px.y - scrTop, 0.0) / max(H * 0.075, 1.0)) * inVisZone;
layer(acc, cover, lerp(themeA, themeB, abs(visU - 0.5) * 2.0), scrSpill * (0.14 * level + 0.34 * pulse));
if (inVisZone > 0.5 && px.y < scrTop - 1.5)
{
float barCount = 52.0;
float barIdx = floor(visU * barCount);
float barF = frac(visU * barCount);
float barGap = step(0.16, barF) * step(barF, 0.84);
float symX = abs((barIdx + 0.5) / barCount - 0.5) * 2.0;
float barVal = spectrum(saturate(symX));
float barH = (scrTop - 2.5) * (0.12 + 0.86 * barVal);
float barMask = barGap * step(px.y, barH) * visMask;
float peakCap = barGap * exp(-abs(px.y - barH) / 0.85) * visMask;
float3 barCol = lerp(themeC, themeB, smoothstep(0.0, 0.55, symX));
barCol = lerp(barCol, themeA, smoothstep(0.55, 1.0, symX));
layer(acc, cover, barCol * (0.95 + 0.55 * pulse), barMask * 0.92);
layer(acc, cover, float3(1.0, 0.98, 1.0), peakCap * 0.95);
}
float3 bezelCol = lerp(themeA, themeB, visU);
bezelCol = lerp(bezelCol, float3(1.00, 0.76, 0.44), passProx * 0.30);
layer(acc, cover, bezelCol * (0.85 + 0.45 * pulse), visBezel * 0.82);
}
}
// Softer Rounded & Neutral Matte Graphite/Stone-Grey Lexus Yoke (bounding-box culled)
float wheelCx = cx - H * 2.55;
[branch]
if (abs(px.x - wheelCx) < H * 0.72 && px.y < H * 0.40)
{
float2 wRel = px - float2(wheelCx, -H * 0.04);
float absX = abs(wRel.x);
float rad = H * 0.028;
float gripD = sdBox(float2(absX - H * 0.52, wRel.y - H * 0.16), float2(H * 0.068, H * 0.20) - rad) - rad;
float hornD = sdBox(float2(absX - H * 0.43, wRel.y - H * 0.30), float2(H * 0.13, H * 0.046) - rad) - rad;
float outerFrameD = min(gripD, hornD);
float thumbBridgeD = sdBox(float2(absX - H * 0.35, wRel.y - H * 0.14), float2(H * 0.14, H * 0.045) - H * 0.018) - H * 0.018;
float hubD = sdBox(wRel - float2(0.0, H * 0.12), float2(H * 0.22, H * 0.085) - rad) - rad;
float lexusYokeD = min(outerFrameD, min(thumbBridgeD, hubD));
float yokeMask = 1.0 - smoothstep(0.0, 1.0, lexusYokeD);
float outerMask = 1.0 - smoothstep(0.0, 1.0, outerFrameD);
float bridgeMask = 1.0 - smoothstep(0.0, 1.0, thumbBridgeD);
float hubMask = 1.0 - smoothstep(0.0, 1.0, hubD);
float yokeBevel = exp(-abs(lexusYokeD) / 1.0) * step(lexusYokeD, 0.02);
float3 tiCol = lerp(float3(0.24, 0.25, 0.29), float3(0.42, 0.44, 0.48), saturate(wRel.y / (H * 0.34)));
float3 bridgeCol = lerp(float3(0.18, 0.19, 0.23), float3(0.28, 0.30, 0.35), saturate(wRel.y / (H * 0.20)));
float3 hubCol = lerp(float3(0.08, 0.09, 0.12), float3(0.14, 0.15, 0.19), saturate(wRel.y / (H * 0.22)));
layer(acc, cover, tiCol, outerMask);
layer(acc, cover, bridgeCol, bridgeMask);
layer(acc, cover, hubCol, hubMask);
layer(acc, cover, lerp(float3(0.55, 0.85, 0.98), float3(0.95, 0.72, 0.82), saturate(wRel.y / (H * 0.34))), yokeBevel * 0.65);
float gripTrim = exp(-abs(absX - H * 0.48) / 0.9) * step(H * 0.06, wRel.y) * step(wRel.y, H * 0.31) * yokeMask;
float segGap = step(0.18, frac((wRel.x + H * 0.14) / max(H * 0.06, 1.0)));
float coreBar = (1.0 - smoothstep(0.0, 0.8, sdBox(wRel - float2(0.0, H * 0.11), float2(H * 0.14, H * 0.018)))) * segGap * yokeMask;
float hubSlit = exp(-abs(wRel.x) / 0.8) * step(H * 0.14, wRel.y) * step(wRel.y, H * 0.20) * yokeMask;
layer(acc, cover, themeA * (0.85 + 0.50 * level), gripTrim * 0.88);
layer(acc, cover, lerp(themeC, themeB, 0.35) * (1.00 + 0.75 * pulse + 0.30 * bass), coreBar * 0.95);
layer(acc, cover, float3(0.85, 0.92, 1.00), hubSlit * 0.75);
}
return paint(acc / max(cover, 0.001), saturate(cover));
}