Brighter torch flames

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 16:23:19 +01:00
1 parent 1e01fbdae3
commit 50e89a18df
1 file changed
+6 -5
+6 -5
View File
@@ -2705,16 +2705,17 @@ fn draw_torch_flame((x, z): (f32, f32), base: f32, k: f32, t: f32) {
let sway2 = (t * 5.3 + k * 2.7 + f * 1.9).cos() * 0.025 * f;
let h = base + f * 0.24 * flick;
let size = (0.11 - f * 0.08) * (1.0 + 0.18 * (t * 17.0 + k * 3.1 + f * 4.0).sin());
// bright: almost white at the bottom, golden in the middle, orange at the tip
let c = if f < 0.4 {
vec3(1.0, 0.95, 0.65).lerp(vec3(1.0, 0.68, 0.2), f / 0.4)
vec3(1.0, 1.0, 0.88).lerp(vec3(1.0, 0.86, 0.38), f / 0.4)
} else {
vec3(1.0, 0.68, 0.2).lerp(vec3(0.95, 0.25, 0.06), (f - 0.4) / 0.6)
vec3(1.0, 0.86, 0.38).lerp(vec3(1.0, 0.56, 0.16), (f - 0.4) / 0.6)
};
draw_cube(vec3(x + sway, h, z + sway2), Vec3::splat(size), None, Color::new(c.x, c.y, c.z, 0.95 - f * 0.4));
draw_cube(vec3(x + sway, h, z + sway2), Vec3::splat(size), None, Color::new(c.x, c.y, c.z, 1.0 - f * 0.15));
}
// the halo last: the glow material writes depth, so anything drawn after it inside the
// sphere would be hidden
draw_sphere(vec3(x, base + 0.1, z), 0.24 * flick, None, Color::new(1.0, 0.55, 0.15, 0.16));
// sphere would be hidden; light and thin, so it does not dim the flame
draw_sphere(vec3(x, base + 0.1, z), 0.26 * flick, None, Color::new(1.0, 0.78, 0.4, 0.12));
}
// particles that glow (embers, sparks, smoke, flashes, shock waves)