From 50c96ceae4dbceab03888cee8e65bf9eb81501e7 Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Mon, 12 Oct 2026 19:52:23 +0200 Subject: [PATCH] contrails: add jagged edges and restore 5 minute lifetime --- config.js | 2 +- vendor/clouds3d.js | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/config.js b/config.js index 3011bc0..055b47d 100644 --- a/config.js +++ b/config.js @@ -206,7 +206,7 @@ window.CONFIG = { // above contrailStartKm, visible for contrailLifeS seconds. contrailChance: 1.00, contrailStartKm: 4, - contrailLifeS: 600, + contrailLifeS: 300, contrailWidthM: 1400, // full trail width contrailFadeKm: 300, // fully faded at this distance (ramp starts at 35 %) // Night contrast: a physically scaled contrail is a faint grey thread diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index bf35b90..5c2cb94 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -5435,11 +5435,23 @@ var CT2_FRAG_SRC = [ 'varying float vV;', 'varying float vS;', 'varying vec3 vWorld;', + 'float hash1(float x) {', + 'return fract(sin(x * 127.1) * 43758.5453);', + '}', + 'float noise1(float x) {', + 'float i = floor(x);', + 'float f = fract(x);', + 'return mix(hash1(i), hash1(i + 1.0), f);', + '}', 'void main() {', 'float side = abs(vV);', - 'float edge = 1.0 - smoothstep(0.25, 1.0, side);', - 'float head = 0.35 + 0.65 * vU;', - 'float a = clamp(vS * edge * head, 0.0, 0.85);', + 'float wob = 0.48 + 0.42 * noise1(vU * 24.0);', + 'float jag = noise1(vU * 61.0 + vV * 17.0) - 0.5;', + 'float edge = 1.0 - smoothstep(wob * 0.16, wob, side + jag * 0.18);', + 'edge *= 0.42 + 0.58 * pow(vU, 0.65);', + 'float dens = 0.58 + 0.42 * noise1(vU * 31.0);', + 'float head = 0.32 + 0.68 * vU;', + 'float a = clamp(vS * edge * head * dens, 0.0, 0.88);', 'if (a <= 0.004) discard;', 'vec3 dayCol = vec3(1.0, 1.0, 1.0);', 'vec3 nightCol = vec3(0.45, 0.55, 0.75);',