Files
airdef/horizon-patches/0030-HD-smoke-young-trails-drawn-at-least-as-wide-as-a-gr.patch
T
chexit ccc3e20902
build / mod (push) Successful in 4m4s
release / windows (push) Successful in 23m13s
Playtest fixes: smoke by engine, searchlights, far launch sites that load their chunks, air defence balance, last chance and radar-cued shots, radars in smart raids, echo, Windows release build from a tag
Smoke: one rule by engine, no heat on trails, no trail on P1-SUN. Searchlights: two lamps a target, off with an empty sky. Halos fade before their reach and their sum is limited. Launch sites load chunks through the server thread, go off-map as a last resort, and reach 4000 blocks. Air defence: ranges x1.5, shots grow with urgency, claims released, /airdef lastchance, long shots on a big radar's tracks. Build: rust-toolchain.toml, airdef.py check, generator manifest and --check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 23:44:14 +03:00

60 lines
2.8 KiB
Diff

From 20f699796afb12b600236a4e8859cd97430f86f0 Mon Sep 17 00:00:00 2001
From: chexit <chexit@duck.com>
Date: Fri, 30 Oct 2026 03:44:45 +0300
Subject: [PATCH 30/40] HD smoke: young trails drawn at least as wide as a grid
cell (density scaled to keep the mass), gentler bulges, so a trail is a
smooth ribbon and not a chain of puffs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---
crates/horizon-client/src/gfx/hd/smoke.rs | 12 ++++++++++++
crates/horizon-client/src/gfx/hd/smoke_grid.wgsl | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/crates/horizon-client/src/gfx/hd/smoke.rs b/crates/horizon-client/src/gfx/hd/smoke.rs
index dee0932e8..c751df4f4 100644
--- a/crates/horizon-client/src/gfx/hd/smoke.rs
+++ b/crates/horizon-client/src/gfx/hd/smoke.rs
@@ -46,6 +46,8 @@ const MAX_INDICES: usize = 120_000;
pub const MAX_LIGHTS: usize = 16;
/// How fast the wind carries smoke (blocks per second, x and z).
const WIND: [f32; 2] = [1.6, 1.2];
+/// The thinnest a trail is drawn, in blocks of radius (a cell is `CELL`).
+const MIN_TUBE: f32 = 3.6;
/// Smoke is on unless `HORIZON_HD_SMOKE=0`.
pub fn smoke_enabled() -> bool {
@@ -402,6 +404,16 @@ fn bake(s: &HdSmoke) -> Option<Baked> {
// Spreading thins it (the core's mass over a wider tube), and it fades out towards its end.
let thin = (r0 / radius).powf(0.5);
let density = s.shape[2] * (1.0 - u).powi(2) * thin * (t / 0.25).min(1.0).max(0.2);
+ // A tube thinner than the grid's cells is sampled unevenly (cells near its axis get it, their
+ // neighbours miss it): a chain of blobs. Trails are kept at least a cell and a bit wide, with
+ // the same mass per length, so a young trail is a continuous ribbon.
+ let d = [s.b[0] - s.a[0], s.b[1] - s.a[1], s.b[2] - s.a[2]];
+ let tube = d[0] * d[0] + d[1] * d[1] + d[2] * d[2] > 0.25;
+ let (radius, density) = if tube && radius < MIN_TUBE {
+ (MIN_TUBE, density * radius / MIN_TUBE)
+ } else {
+ (radius, density)
+ };
let heat = s.shape[3] * (-t / 1.5).exp();
let clear_amount = (1.0 - u).powf(0.8);
let clear = s.motion[1] * (1.0 + 0.4 * u);
diff --git a/crates/horizon-client/src/gfx/hd/smoke_grid.wgsl b/crates/horizon-client/src/gfx/hd/smoke_grid.wgsl
index 01b6e082a..0adcd55f6 100644
--- a/crates/horizon-client/src/gfx/hd/smoke_grid.wgsl
+++ b/crates/horizon-client/src/gfx/hd/smoke_grid.wgsl
@@ -40,7 +40,7 @@ fn fs_smoke_grid(in: FullOut) -> @location(0) vec4<f32> {
let seed = segs[i + 3u].x;
let len = sqrt(len2);
// Bulges along the tube, so it is not a pipe.
- let r = pa.w * (1.0 + 0.22 * sin(along * len * 0.6 + seed * 40.0));
+ let r = pa.w * (1.0 + 0.07 * sin(along * len * 0.35 + seed * 40.0));
if d < r && pb.w > 0.0 {
let q = d / r;
var w = (1.0 - q * q);
--
2.54.0 (Apple Git-157)