Rain and more

This commit is contained in:
Gabrieal Jimmy
2026-10-02 13:04:49 -05:00
parent 2c99305fb0
commit 16c03afd16
15 changed files with 374 additions and 46 deletions

View File

@@ -20,17 +20,25 @@ void main() {
fragColor = vec4(vColor.rgb * a, a);
return;
}
if (vKind == 3) { // flame: teardrop eroded by scrolling noise, more as it ages
float taper = 1.0 + 0.7 * (p.y * 0.5 + 0.5);
float d = length(vec2(p.x * taper, p.y * 0.9 + 0.1));
vec2 q = vec2(p.x * 2.5, p.y * 2.0 - uTime * 3.5) + seed * 37.0;
float n = vnoise(q) * 0.6 + vnoise(q * 2.3 + 11.0) * 0.4;
float shape = 1.0 - smoothstep(0.45, 0.85, d + (n - 0.5) * (0.6 + 0.9 * life));
float core = 1.0 - smoothstep(0.0, 0.55, d);
float a = shape * vColor.a;
// Mostly additive, but each tongue also dims what is behind it a little,
// so flames stay saturated orange over bright daytime ground.
fragColor = vec4(vColor.rgb * a * (0.7 + 0.8 * core), a * 0.3);
if (vKind == 3) {
// Flame lick: a soft-topped blob with a crisp, noise-eroded silhouette,
// shaded from a hot yellow center to orange and a red rim; it reddens
// and erodes as it rises. Nearly opaque (HD-2D fires read as solid,
// painterly shapes), emissive HDR so the core blooms.
float taper = 1.0 + 0.45 * (p.y * 0.5 + 0.5);
float d = length(vec2(p.x * taper, p.y * 0.8 + 0.1));
vec2 q = vec2(p.x * 1.8, p.y * 1.5 - uTime * 2.6) + seed * 37.0;
float n = vnoise(q) * 0.7 + vnoise(q * 2.4 + 11.0) * 0.3;
float e = d + (n - 0.5) * (0.35 + 0.7 * life);
float body = 1.0 - smoothstep(0.62, 0.76, e);
if (body <= 0.0) discard;
// Young licks stay hot right to their rim so the mass merges into one
// bright body; only older, higher licks get the red edge.
float heat = clamp((1.0 - e / 0.72) * 1.35 + 0.25 * (1.0 - life), 0.0, 1.0) * (1.0 - 0.65 * life);
vec3 red = vec3(0.8, 0.1, 0.02), orange = vec3(1.8, 0.5, 0.06), yellow = vec3(2.3, 1.4, 0.32);
vec3 c = heat < 0.5 ? mix(red, orange, heat * 2.0) : mix(orange, yellow, heat * 2.0 - 1.0);
float a = body * vColor.a;
fragColor = vec4(c * vColor.rgb * a, a * 0.92);
return;
}
if (vKind == 4) { // ember