Tweak: Synthwave run car

This commit is contained in:
Dejvino 2026-05-24 14:28:35 +02:00
parent ec2465222c
commit 887d3970ab

View File

@ -111,16 +111,28 @@ void main() {
}
}
// 4. Car Silhouette (Simplified)
vec2 carP = p - vec2(0.0, -0.75);
carP.x = abs(carP.x);
if (carP.y > -0.1 && carP.y < 0.1 && carP.x < 0.25) {
float body = step(carP.x, 0.25) * step(abs(carP.y), 0.05);
float cabin = step(carP.x, 0.15) * step(carP.y, 0.1) * step(0.0, carP.y);
if (body + cabin > 0.0) {
finalColor = mix(finalColor, vec3(0.0), 0.9);
finalColor += colorSec * 0.5 * body * (smoothstep(0.0, 0.05, abs(carP.x - 0.2))); // Tail lights / glow
}
// 4. Car Silhouette
float carDrift = sin(t * 0.1) * 0.2;
float carVibration = sin(t * 30.0) * 0.001;
vec2 carPos = vec2(carDrift, -0.78 + carVibration);
vec2 cp = p - carPos;
float cpX = abs(cp.x);
float mainBody = step(cpX, 0.35) * step(abs(cp.y), 0.12);
float rearGlass = step(cpX, 0.22) * step(abs(cp.y - 0.18), 0.07);
float wingTop = step(cpX, 0.32) * step(abs(cp.y - 0.20), 0.025);
float wingSides = step(abs(cpX - 0.30), 0.03) * step(abs(cp.y - 0.12), 0.1);
if (mainBody + rearGlass + wingTop + wingSides > 0.0) {
finalColor = mix(finalColor, vec3(0.015), 0.95); // Dark silhouette
// Iconic quad round taillights
float tlY = 0.03;
float tlRadius = 0.025;
float l1 = smoothstep(tlRadius, tlRadius * 0.6, length(vec2(cpX - 0.21, cp.y - tlY)));
float l2 = smoothstep(tlRadius, tlRadius * 0.6, length(vec2(cpX - 0.29, cp.y - tlY)));
vec3 lightColor = vec3(1.0, 0.0, 0.0) * (0.6 + beat * 1.4);
finalColor = mix(finalColor, lightColor, clamp(l1 + l2, 0.0, 1.0));
}
gl_FragColor = vec4(finalColor, mask * u_opacity);